import "github.com/arturalbov/atomicf"
atomicf is a go package for ensure files with atomic writing by using logging. Implemented according to https://danluu.com/file-consistency/. Should prevent file corruption on any Linux filesystem.
It contains type AtomicFile struct
decoration over standard os.File
where func (file *AtomicFile) Write(data []bytes) (n int, err error)
and func (file *AtomicFile) WriteAt(b []byte, off int64) (n int, err error)
are atomic.
File could be recovered after corruption using func (file *AtomicFile) Recover() (err error)
function.
If you have any problems with or questions about this package, please contact us through a GitHub issue.
You are invited to contribute new features, fixes, or updates, large or small; I am always thrilled to receive pull requests, and do my best to process them as fast as I can.