lnd.xprv/chanbackup
Olaoluwa Osuntokun 60999df08f
chanbackup: add new MultiFile struct for storing+updating Multis on disk
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.
2019-01-23 18:11:31 -08:00
..
backup_test.go chanbackup: add functionality to allow external callers to backup channels 2019-01-23 18:11:28 -08:00
backup.go chanbackup: add functionality to allow external callers to backup channels 2019-01-23 18:11:28 -08:00
backupfile_test.go chanbackup: add new MultiFile struct for storing+updating Multis on disk 2019-01-23 18:11:31 -08:00
backupfile.go chanbackup: add new MultiFile struct for storing+updating Multis on disk 2019-01-23 18:11:31 -08:00
crypto_test.go chanbackup: implement crypto operations for serialized static channel baackups 2019-01-23 18:11:21 -08:00
crypto.go chanbackup: implement crypto operations for serialized static channel baackups 2019-01-23 18:11:21 -08:00
log.go chanbackup: add logger 2019-01-23 18:11:25 -08:00
multi_test.go chanbackup: introduce Multi, a multi-channel backup 2019-01-23 18:11:27 -08:00
multi.go chanbackup: introduce Multi, a multi-channel backup 2019-01-23 18:11:27 -08:00
recover_test.go chanbackup: add functions to allow recovery of existing channel backups 2019-01-23 18:11:29 -08:00
recover.go chanbackup: add functions to allow recovery of existing channel backups 2019-01-23 18:11:29 -08:00
single_test.go chanbackup: add implementation of Single Channel Backups (SCBs) 2019-01-23 18:11:26 -08:00
single.go chanbackup: add implementation of Single Channel Backups (SCBs) 2019-01-23 18:11:26 -08:00