pub struct Store { /* private fields */ }Implementations§
Source§impl Store
impl Store
Sourcepub fn open_in_memory() -> Result<Self>
pub fn open_in_memory() -> Result<Self>
Open an ephemeral in-memory store (used by tests).
Sourcepub fn put(&self, node: &Node) -> Result<NodeHash>
pub fn put(&self, node: &Node) -> Result<NodeHash>
Store a node, returning its content hash. Idempotent: storing an identical node again is a no-op, which is what dedups shared subtrees.
Sourcepub fn node_count(&self) -> Result<i64>
pub fn node_count(&self) -> Result<i64>
Number of distinct nodes stored. Lets a test prove structural sharing.
Sourcepub fn checkpoint(&self, name: &str, root: &NodeHash) -> Result<()>
pub fn checkpoint(&self, name: &str, root: &NodeHash) -> Result<()>
Create an immutable checkpoint pointing at root. Errors if the name is
already taken by any ref.
Sourcepub fn branch(&self, name: &str, root: &NodeHash) -> Result<()>
pub fn branch(&self, name: &str, root: &NodeHash) -> Result<()>
Create or move a branch to root. Refuses to overwrite a checkpoint.
Sourcepub fn resolve(&self, name: &str) -> Result<Option<NodeHash>>
pub fn resolve(&self, name: &str) -> Result<Option<NodeHash>>
Resolve a ref name to its root hash.
Sourcepub fn materialize(&self, hash: &NodeHash) -> Result<Materialized>
pub fn materialize(&self, hash: &NodeHash) -> Result<Materialized>
Recursively load the full subtree rooted at hash.
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
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