Skip to main content

update_non_finalized_state_backup

Function update_non_finalized_state_backup 

Source
pub(super) fn update_non_finalized_state_backup(
    backup_dir_path: &Path,
    non_finalized_state: &NonFinalizedState,
    backup_blocks: HashMap<Hash, PathBuf>,
)
Expand description

Updates the non-finalized state backup cache by writing any blocks that are in the non-finalized state but missing in the backup cache, and deleting any backup files that are no longer present in the non-finalized state.

backup_blocks should be the current contents of the backup directory, obtained by calling list_backup_dir_entries before the non-finalized state was updated.

This function performs blocking I/O and should be called from a blocking context, or wrapped in [tokio::task::spawn_blocking].