pub struct VersionStore { /* private fields */ }Expand description
Manages point-in-time snapshots with browsable tree directories and JSON manifest.
Implementations§
Source§impl VersionStore
impl VersionStore
Sourcepub fn open(target_root: &Path) -> Self
pub fn open(target_root: &Path) -> Self
Open or create a version store at {target}/.foxing_versions/.
Sourcepub fn create_snapshot(
&self,
source: &Path,
target: &Path,
tag: Option<&str>,
trigger: &str,
) -> Result<SnapshotEntry>
pub fn create_snapshot( &self, source: &Path, target: &Path, tag: Option<&str>, trigger: &str, ) -> Result<SnapshotEntry>
Create a point-in-time snapshot by reflinking all files from source->target into a timestamped tree directory.
Sourcepub fn list_snapshots(&self) -> Vec<SnapshotEntry>
pub fn list_snapshots(&self) -> Vec<SnapshotEntry>
List all snapshots (point-in-time directories).
Sourcepub fn delete_snapshot(&self, timestamp: &str) -> Result<u64>
pub fn delete_snapshot(&self, timestamp: &str) -> Result<u64>
Delete a snapshot by timestamp.
Sourcepub fn tag_snapshot(&self, timestamp: &str, tag: &str) -> Result<()>
pub fn tag_snapshot(&self, timestamp: &str, tag: &str) -> Result<()>
Assigns a tag to a snapshot, exempting it from automatic pruning.
Sourcepub fn read_index(&self) -> Result<SnapshotIndex>
pub fn read_index(&self) -> Result<SnapshotIndex>
Reads and deserializes the JSON snapshot index from disk.
Sourcepub fn write_index(&self, index: &SnapshotIndex) -> Result<()>
pub fn write_index(&self, index: &SnapshotIndex) -> Result<()>
Writes the snapshot index to disk as pretty-printed JSON.
Sourcepub fn rebuild_index(&self) -> Result<SnapshotIndex>
pub fn rebuild_index(&self) -> Result<SnapshotIndex>
Rebuilds the snapshot index by scanning on-disk snapshot directories.
Sourcepub fn prune_by_age(&self, max_age: Duration) -> Result<PruneStats>
pub fn prune_by_age(&self, max_age: Duration) -> Result<PruneStats>
Remove snapshots older than max_age.
Sourcepub fn prune_by_count(&self, max_count: usize) -> Result<PruneStats>
pub fn prune_by_count(&self, max_count: usize) -> Result<PruneStats>
Keep only the last max_count snapshots (oldest removed first).
Sourcepub fn prune_by_size(&self, max_bytes: u64) -> Result<PruneStats>
pub fn prune_by_size(&self, max_bytes: u64) -> Result<PruneStats>
Remove oldest snapshots until total size is under max_bytes.
Sourcepub fn collect_snap_dirs(
&self,
timestamp_filter: Option<&str>,
) -> Result<Vec<PathBuf>>
pub fn collect_snap_dirs( &self, timestamp_filter: Option<&str>, ) -> Result<Vec<PathBuf>>
Collect snapshot directories for export. Returns paths to snapshot dirs.
Sourcepub fn export<W: Write + 'static>(
&self,
writer: W,
compress: &str,
timestamp_filter: Option<&str>,
) -> Result<ArchiveExportStats>
pub fn export<W: Write + 'static>( &self, writer: W, compress: &str, timestamp_filter: Option<&str>, ) -> Result<ArchiveExportStats>
Export snapshots as a .fxar archive (content-addressable chunk-dedup). Writes to the provided writer (file or stdout).
Sourcepub fn import<R: Read + 'static>(
&self,
reader: R,
compress: &str,
) -> Result<ImportStats>
pub fn import<R: Read + 'static>( &self, reader: R, compress: &str, ) -> Result<ImportStats>
Import snapshots from a .fxar archive.
Sourcepub fn inspect_archive<R: Read + 'static>(
reader: R,
compress: &str,
) -> Result<Vec<ArchiveEntry>>
pub fn inspect_archive<R: Read + 'static>( reader: R, compress: &str, ) -> Result<Vec<ArchiveEntry>>
List contents of a .fxar archive without extracting.
Auto Trait Implementations§
impl Freeze for VersionStore
impl RefUnwindSafe for VersionStore
impl Send for VersionStore
impl Sync for VersionStore
impl Unpin for VersionStore
impl UnsafeUnpin for VersionStore
impl UnwindSafe for VersionStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more