60999df08f
In this commit, we add a new MultiFile struct. We'll use this struct in store the latest multi-channel backup on disk, swap it out atomically, and finally extract+unpack the contents of the multi-file. The format that's written to disk is the same as a regular Packed multi. The contents of this new file are meant to be used to safely implement an always up to date multi file on disk as a way for users to easily rsync or fsnotiy (when it changes) the backup state of their channels. We implement an atomic update and swap in the UpdateAndSwap. The method uses relies on the underlying file system supporting an atomic rename syscall. We first make a temporary backup file, write the latest contents to that, then swap the temp file with the main file using rename(2). This way, we ensure that we always have a single up to date file, if the protocol aborts before the rename, then we can detect this, remove the temp file, and attempt another swap. |
||
---|---|---|
.. | ||
backup_test.go | ||
backup.go | ||
backupfile_test.go | ||
backupfile.go | ||
crypto_test.go | ||
crypto.go | ||
log.go | ||
multi_test.go | ||
multi.go | ||
recover_test.go | ||
recover.go | ||
single_test.go | ||
single.go |