pub struct Store { /* private fields */ }Expand description
Write-once, read-by-hash blob store rooted at a directory.
put returns a sha256:<hex> reference; get resolves it. Blobs are
addressed by their hex digest on disk.
Implementations§
Source§impl Store
impl Store
pub fn new(root: impl Into<PathBuf>) -> Store
pub fn root(&self) -> &Path
Sourcepub fn put_bytes(&self, data: &[u8]) -> Result<String, Error>
pub fn put_bytes(&self, data: &[u8]) -> Result<String, Error>
Store bytes; returns sha256:<hex>.
pub fn put_text(&self, text: &str) -> Result<String, Error>
pub fn put_value(&self, v: &Value) -> Result<String, Error>
pub fn get_bytes(&self, reference: &str) -> Result<Vec<u8>, Error>
pub fn get_text(&self, reference: &str) -> Result<String, Error>
pub fn exists(&self, reference: &str) -> bool
pub fn count(&self) -> usize
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