pub struct ObjectStore { /* private fields */ }Expand description
Content-addressed, encrypted, tamper-evident object store.
Implementations§
Source§impl ObjectStore
impl ObjectStore
pub fn new(db_root: &Path, dek: Option<Dek>) -> Result<Self>
Sourcepub fn write(&self, node: &mut Node) -> Result<String>
pub fn write(&self, node: &mut Node) -> Result<String>
Write a node. Returns the content hash (the node’s permanent ID in the DAG).
Sourcepub fn read(&self, hash: &str) -> Result<Node>
pub fn read(&self, hash: &str) -> Result<Node>
Read and verify a node by its hash. Returns error on hash mismatch (tamper).
Sourcepub fn all_hashes(&self) -> Box<dyn Iterator<Item = String> + '_>
pub fn all_hashes(&self) -> Box<dyn Iterator<Item = String> + '_>
List all object hashes (for startup index rebuild / verify).
Sourcepub fn sync(&self) -> Result<()>
pub fn sync(&self) -> Result<()>
Flush durable state for the active segment (v3): one fsync per batch, wired into Db::flush_all(). No-op for loose-object and in-memory modes.
Sourcepub fn compact(&self, live: &HashSet<String>) -> Result<CompactStats>
pub fn compact(&self, live: &HashSet<String>) -> Result<CompactStats>
Compact the packed segment store (v3), keeping only objects whose hash is
in live and reclaiming the rest. No-op (zeroed stats) for loose-object
and in-memory modes.
Sourcepub fn verify_all(&self) -> (usize, Vec<String>)
pub fn verify_all(&self) -> (usize, Vec<String>)
Verify all objects. Returns (ok_count, tampered_hashes).
Auto Trait Implementations§
impl !Freeze for ObjectStore
impl !RefUnwindSafe for ObjectStore
impl !UnwindSafe for ObjectStore
impl Send for ObjectStore
impl Sync for ObjectStore
impl Unpin for ObjectStore
impl UnsafeUnpin 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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more