Helper type when rebuilding from snapshots. Designed to handle when rebuilding from just a
full snapshot, or from both a full snapshot and an incremental snapshot.
Bank snapshots traditionally had their accounts hash calculated prior to serialization. Since
the hash calculation takes a long time, an optimization has been put in to offload the accounts
hash calculation. The bank serialization format has not changed, so we need another way to
identify if a bank snapshot contains the calculated accounts hash or not.
When constructing a bank a snapshot, traditionally the snapshot was from a snapshot archive. Now,
the snapshot can be from a snapshot directory, or from a snapshot archive. This is the flag to
indicate which.
Build the full snapshot archive path from its components: the snapshot archives directory, the
snapshot slot, the accounts hash, and the archive format.
Build the incremental snapshot archive path from its components: the snapshot archives
directory, the snapshot base slot, the snapshot slot, the accounts hash, and the archive
format.
The account snapshot directories under <account_path>/snapshot/ contain account files hardlinked
from <account_path>/run taken at snapshot time. They are referenced by the symlinks from the
bank snapshot dir snapshot//accounts_hardlinks/. We observed that sometimes the bank snapshot dir
could be deleted but the account snapshot directories were left behind, possibly by some manual operations
or some legacy code not using the symlinks to clean up the account snapshot hardlink directories.
This function cleans up any account snapshot directories that are no longer referenced by the bank
snapshot dirs, to ensure proper snapshot operations.
Hard-link the files from accounts/ to snapshot/<bank_slot>/accounts/
This keeps the appendvec files alive and with the bank snapshot. The slot and id
in the file names are also updated in case its file is a recycled one with inconsistent slot
and id.
If the validator halts in the middle of archive_snapshot_package(), the temporary staging
directory won’t be cleaned up. Call this function to clean them up.