Struct conserve::test_fixtures::ScratchArchive
source · pub struct ScratchArchive { /* private fields */ }Expand description
A temporary archive, deleted when it goes out of scope.
The ScratchArchive can be treated as an Archive.
Implementations§
source§impl ScratchArchive
impl ScratchArchive
pub fn new() -> ScratchArchive
pub fn path(&self) -> &Path
pub fn setup_incomplete_empty_band(&self)
pub fn store_two_versions(&self)
pub fn transport(&self) -> &dyn Transport
Methods from Deref<Target = 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.