pub struct ObjectStore { /* private fields */ }Expand description
Content-addressed object store.
Stores artifacts using BLAKE3 hash prefixes for sharding:
objects/
├── ab/
│ └── cdef1234...
├── cd/
│ └── ef5678...
└── ...Implementations§
Source§impl ObjectStore
impl ObjectStore
Sourcepub fn new<P: AsRef<Path>>(base_path: P) -> Result<Self>
pub fn new<P: AsRef<Path>>(base_path: P) -> Result<Self>
Create a new object store at the given path.
§Errors
Returns an error if the directory cannot be created.
Sourcepub fn put(&self, data: &[u8]) -> Result<ContentAddress>
pub fn put(&self, data: &[u8]) -> Result<ContentAddress>
Sourcepub fn put_with_address(&self, data: &[u8], addr: &ContentAddress) -> Result<()>
pub fn put_with_address(&self, data: &[u8], addr: &ContentAddress) -> Result<()>
Store bytes at a specific content address.
§Errors
Returns an error if writing fails or hash doesn’t match.
Sourcepub fn put_reader<R: Read>(&self, reader: R) -> Result<ContentAddress>
pub fn put_reader<R: Read>(&self, reader: R) -> Result<ContentAddress>
Store from a reader and return content address.
§Errors
Returns an error if reading or writing fails.
Sourcepub fn exists(&self, addr: &ContentAddress) -> bool
pub fn exists(&self, addr: &ContentAddress) -> bool
Check if an object exists.
Sourcepub fn delete(&self, addr: &ContentAddress) -> Result<bool>
pub fn delete(&self, addr: &ContentAddress) -> Result<bool>
Sourcepub fn total_size(&self) -> Result<u64>
pub fn total_size(&self) -> Result<u64>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ObjectStore
impl RefUnwindSafe for ObjectStore
impl Send for ObjectStore
impl Sync for ObjectStore
impl Unpin for ObjectStore
impl UnsafeUnpin for ObjectStore
impl UnwindSafe for ObjectStore
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