pub struct Archive { /* private fields */ }Expand description
An archive holding backup material.
Implementations§
source§impl Archive
impl Archive
sourcepub fn create_path(path: &Path) -> Result<Archive>
pub fn create_path(path: &Path) -> Result<Archive>
Make a new archive in a local directory.
sourcepub fn create(transport: Box<dyn Transport>) -> Result<Archive>
pub fn create(transport: Box<dyn Transport>) -> Result<Archive>
Make a new archive in a new directory accessed by a Transport.
sourcepub fn open_path(path: &Path) -> Result<Archive>
pub fn open_path(path: &Path) -> Result<Archive>
Open an existing archive.
Checks that the header is correct.
pub fn open(transport: Box<dyn Transport>) -> Result<Archive>
pub fn block_dir(&self) -> &BlockDir
pub fn band_exists(&self, band_id: &BandId) -> Result<bool>
pub fn band_is_closed(&self, band_id: &BandId) -> Result<bool>
sourcepub fn iter_entries(
&self,
band_selection: BandSelectionPolicy,
subtree: Apath,
exclude: Exclude
) -> Result<impl Iterator<Item = IndexEntry>>
pub fn iter_entries( &self, band_selection: BandSelectionPolicy, subtree: Apath, exclude: Exclude ) -> Result<impl Iterator<Item = IndexEntry>>
Return an iterator of entries in a selected version.
sourcepub fn list_band_ids(&self) -> Result<Vec<BandId>>
pub fn list_band_ids(&self) -> Result<Vec<BandId>>
Returns a vector of band ids, in sorted order from first to last.
pub fn resolve_band_id( &self, band_selection: BandSelectionPolicy ) -> Result<BandId>
pub fn open_stored_tree( &self, band_selection: BandSelectionPolicy ) -> Result<StoredTree>
sourcepub fn last_band_id(&self) -> Result<Option<BandId>>
pub fn last_band_id(&self) -> Result<Option<BandId>>
Return the BandId of the highest-numbered band, or Ok(None) if there
are no bands, or an Err if any occurred reading the directory.
sourcepub fn last_complete_band(&self) -> Result<Option<Band>>
pub fn last_complete_band(&self) -> Result<Option<Band>>
Return the last completely-written band id, if any.
sourcepub fn referenced_blocks(
&self,
band_ids: &[BandId]
) -> Result<HashSet<BlockHash>>
pub fn referenced_blocks( &self, band_ids: &[BandId] ) -> Result<HashSet<BlockHash>>
Returns all blocks referenced by all bands.
Shows a progress bar as they’re collected.
sourcepub fn unreferenced_blocks(&self) -> Result<impl Iterator<Item = BlockHash>>
pub fn unreferenced_blocks(&self) -> Result<impl Iterator<Item = BlockHash>>
Returns an iterator of blocks that are present and referenced by no index.
sourcepub fn delete_bands(
&self,
delete_band_ids: &[BandId],
options: &DeleteOptions
) -> Result<DeleteStats>
pub fn delete_bands( &self, delete_band_ids: &[BandId], options: &DeleteOptions ) -> Result<DeleteStats>
Delete bands, and the blocks that they reference.
If delete_band_ids is empty, this deletes no bands, but will delete any garbage
blocks referenced by no existing bands.
sourcepub fn validate(&self, options: &ValidateOptions) -> Result<()>
pub fn validate(&self, options: &ValidateOptions) -> Result<()>
Walk the archive to check all invariants.
If problems are found, they are emitted as warn or error level
tracing messages. This function only returns an error if validation
stops due to a fatal error.