pub struct InventoryStore {
pub dir: PathBuf,
}Expand description
Thin wrapper around the inventory directory.
Fields§
§dir: PathBufDirectory containing <hash>.json files.
Implementations§
Source§impl InventoryStore
impl InventoryStore
Sourcepub fn load(&self, hash: &str) -> Option<InventoryFile>
pub fn load(&self, hash: &str) -> Option<InventoryFile>
Loads the inventory file for hash, or None when absent or corrupt.
Sourcepub fn save(&self, hash: &str, file: &InventoryFile) -> Result<()>
pub fn save(&self, hash: &str, file: &InventoryFile) -> Result<()>
Atomically writes file to <dir>/<hash>.json via a tmp file + rename.
Sourcepub fn prune_orphans(&self) -> Result<()>
pub fn prune_orphans(&self) -> Result<()>
Reclaims inventory files whose repo_path no longer exists on disk.
This is a global garbage-collect, intentionally NOT scoped to the current refresh query: a repo gone from disk is an orphan regardless of which query triggered the refresh, so its stale memo is always removed. Repos that are merely outside the query but still present on disk are kept — they are not orphans. Removal is self-healing: a returning repo is simply recomputed on the next scan.
Called lazily from loops refresh only (ADR 0004 pattern).
Trait Implementations§
Source§impl Clone for InventoryStore
impl Clone for InventoryStore
Source§fn clone(&self) -> InventoryStore
fn clone(&self) -> InventoryStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InventoryStore
impl RefUnwindSafe for InventoryStore
impl Send for InventoryStore
impl Sync for InventoryStore
impl Unpin for InventoryStore
impl UnsafeUnpin for InventoryStore
impl UnwindSafe for InventoryStore
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
Mutably borrows from an owned value. Read more