Skip to main content

Bundle

Struct Bundle 

Source
pub struct Bundle;
Expand description

Export and restore. A namespace rather than a value: neither direction holds state between calls.

Implementations§

Source§

impl Bundle

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.