Function phron_finality::party::backup::rotate
source · pub fn rotate(
backup_path: Option<PathBuf>,
session_id: u32
) -> Result<(Box<dyn Write + Send + Sync>, Box<dyn Read + Send + Sync>), BackupLoadError>
Expand description
Loads the existing backups, and opens a new backup file to write to.
backup_path
is the path to the backup directory (i.e. the argument to --backup-saving-path
).
Returns the newly-created file (opened for writing), and the concatenation of the contents of all existing files.
Current directory structure (this is an implementation detail, not part of the public API):
backup-stash/ - the main directory, backup_path/–backup-saving-path
-- 18723/ - subdirectory for the current session |-- 0.abfts - files containing data |-- 1.abfts - each restart after a crash will cause another one to be created |-- 2.abfts - these numbers count up sequentially
– 3.abfts