pub struct Store { /* private fields */ }Expand description
A content-addressed blob store rooted at a directory.
Layout: root/objects/<aa>/<full-hex> — a two-char fan-out so a single
directory never holds millions of entries.
Implementations§
Source§impl Store
impl Store
Sourcepub fn open(root: impl AsRef<Path>) -> Result<Self, StoreError>
pub fn open(root: impl AsRef<Path>) -> Result<Self, StoreError>
Open (creating if needed) a store rooted at root.
Sourcepub fn put(&self, bytes: &[u8]) -> Result<Hash, StoreError>
pub fn put(&self, bytes: &[u8]) -> Result<Hash, StoreError>
Store bytes, returning their content hash. Idempotent: storing identical bytes again is a no-op that returns the same hash (dedup).
Sourcepub fn get(&self, hash: &Hash) -> Result<Vec<u8>, StoreError>
pub fn get(&self, hash: &Hash) -> Result<Vec<u8>, StoreError>
Fetch bytes by hash, verifying integrity on the way out.
pub fn has(&self, hash: &Hash) -> bool
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> 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