Module utils

Module utils 

Source

Constants§

ACCOUNTS_RUN_DIR
ACCOUNTS_SNAPSHOT_DIR

Functions§

create_accounts_run_and_snapshot_dirs
To allow generating a bank snapshot directory with full state information, we need to hardlink account appendvec files from the runtime operation directory to a snapshot hardlink directory. This is to create the run/ and snapshot sub directories for an account_path provided by the user. These two sub directories are on the same file system partition to allow hard-linking.
create_all_accounts_run_and_snapshot_dirs
For all account_paths, create the run/ and snapshot/ sub directories. If an account_path directory does not exist, create it. It returns (account_run_paths, account_snapshot_paths) or error
create_and_canonicalize_directories
Creates directories if they do not exist, and canonicalizes their paths
create_and_canonicalize_directory
Creates directory if it does not exist, and canonicalizes its path
move_and_async_delete_path
Delete directories/files asynchronously to avoid blocking on it. First, in sync context, check if the original path exists, if it does, rename the original path to *_to_be_deleted. If there’s an in-progress deleting thread for this path, return. Then spawn a thread to delete the renamed path.
move_and_async_delete_path_contents
Moves and asynchronously deletes the contents of a directory to avoid blocking on it. The directory is re-created after the move, and should now be empty.
remove_dir_all
Removes a directory and all its contents.
remove_dir_contents
Removes the contents of a directory, but not the directory itself.