pub struct Bundle;Expand description
Export and restore. A namespace rather than a value: neither direction holds state between calls.
Implementations§
Source§impl Bundle
impl Bundle
Sourcepub fn export(city_root: &Path, dest: &Path) -> Result<Manifest, StorageError>
pub fn export(city_root: &Path, dest: &Path) -> Result<Manifest, StorageError>
Writes a bundle of city_root into dest.
§Errors
Propagates read and write failures, naming the path; refuses a city whose ledger cannot be read, because a bundle of an unreadable history is a backup of nothing.
Sourcepub fn read_manifest(bundle: &Path) -> Result<Manifest, StorageError>
pub fn read_manifest(bundle: &Path) -> Result<Manifest, StorageError>
Reads a bundle’s manifest without restoring it.
§Errors
Refuses a directory with no readable manifest.
Sourcepub fn restore(
bundle: &Path,
city_root: &Path,
) -> Result<Manifest, StorageError>
pub fn restore( bundle: &Path, city_root: &Path, ) -> Result<Manifest, StorageError>
Restores a bundle into city_root, which must not already hold a
ledger.
Restoring verifies: the chain is walked, and the record count and head hash are compared against the manifest. A bundle that copied short is refused here rather than becoming a city that is quietly missing its last hour.
§Errors
Refuses an occupied city root, a bundle without a manifest, and any disagreement between the manifest and what was restored.