Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }

Implementations§

Source§

impl Store

Source

pub fn open(root: impl Into<PathBuf>) -> Result<Self, SnapshotError>

Source

pub fn open_with( root: impl Into<PathBuf>, opts: StoreOptions, ) -> Result<Self, SnapshotError>

Source

pub fn snapshot( &self, path: &Path, limits: Option<&Limits>, ) -> Result<Manifest, SnapshotError>

Capture the pre-action state of path (file, directory tree, symlink, or an absent-marker when the path does not exist).

Source

pub fn snapshot_excluding( &self, path: &Path, limits: Option<&Limits>, exclude: &[PathBuf], ) -> Result<Manifest, SnapshotError>

Source

pub fn snapshot_scoped( &self, path: &Path, limits: Option<&Limits>, exclude: &[PathBuf], skip: &SkipPolicy, ) -> Result<Manifest, SnapshotError>

The full snapshot entry point.

exclude prunes subtrees under an absolute path — the hook passes DOOVER_HOME so a defensive cwd snapshot of a project that CONTAINS doover’s own store never ingests doover’s internals (round 21).

skip prunes regenerable build/dependency directories found INSIDE the tree (target/, node_modules/, …) — see SkipPolicy for why a name alone is not enough. Dogfooding showed a Rust repo is 99.5% target/: without this the time budget is spent on build artifacts and the user’s actual source never gets captured. The snapshot ROOT is never skipped, so rm -rf target still snapshots target/ in full — skipping only applies to dirs we find while walking a tree the user did not point at directly.

Source

pub fn restore( &self, manifest: &Manifest, ) -> Result<RestoreReport, SnapshotError>

Restore the exact captured state, replacing whatever is at the path now. Fails before touching anything if the store is corrupt. Callers wanting conflict detection diff current state against the manifest first (undo engine, step 6).

Source

pub fn state_matches(&self, manifest: &Manifest) -> Result<bool, SnapshotError>

Does the CURRENT filesystem state at manifest.path match the manifest? Content-level comparison: file hashes (with a length fast-path), directory presence, symlink targets, fifo presence. Mode and mtime are deliberately ignored — metadata-only drift is not a conflict. Extra entries under the root or missing entries are mismatches, except under a truncated manifest, which compares only what it captured (weaker evidence — callers should warn).

Probe whether the store’s filesystem supports copy-on-write clones.

Source

pub fn prune( &self, live: &BTreeSet<String>, grace_ms: u64, dry_run: bool, ) -> Result<(u64, u64), SnapshotError>

Remove every object whose hash is NOT in live. Returns (objects_removed, bytes_freed); dry_run only counts. Objects are immutable and content-addressed, so removal is always safe for anything outside the live set — the live set is the whole contract. Remove content objects not in live. grace_ms protects objects younger than the window: a hook promotes an object into objects/ and only THEN journals the manifest that references it, so a gc racing that window would see a just-promoted object no journal row vouches for yet. Deleting it strands the about-to-be-written manifest — silent undo breakage. Young unreferenced objects are therefore treated as possibly-in-flight and kept (same guard clean_tmp gives tmp files); only aged orphans (crash leftovers) are reaped.

Source

pub fn clean_tmp( &self, max_age_ms: u64, dry_run: bool, ) -> Result<u64, SnapshotError>

Remove tmp entries older than max_age_ms — crash leftovers from interrupted ingestions. Age-gated so a concurrently-running hook’s in-flight tmp file is never yanked out from under it.

Source

pub fn object_count(&self) -> Result<u64, SnapshotError>

Source

pub fn total_bytes(&self) -> Result<u64, SnapshotError>

Apparent store size: the sum of object lengths. On CoW filesystems the blocks may be shared with the originals (actual usage lower), which is exactly why this is the PREDICTABLE bound the size cap enforces — the free-space floor covers the physical-disk side.

Source

pub fn object_paths(&self) -> Result<Vec<PathBuf>, SnapshotError>

Auto Trait Implementations§

§

impl Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more