pub struct InMemoryIndex { /* private fields */ }Expand description
A simple in-memory registry — for tests and ephemeral workspaces. No tombstones: an unregistered ID is forgotten entirely.
Implementations§
Trait Implementations§
Source§impl Clone for InMemoryIndex
impl Clone for InMemoryIndex
Source§fn clone(&self) -> InMemoryIndex
fn clone(&self) -> InMemoryIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InMemoryIndex
impl Debug for InMemoryIndex
Source§impl Default for InMemoryIndex
impl Default for InMemoryIndex
Source§fn default() -> InMemoryIndex
fn default() -> InMemoryIndex
Source§impl IdIndex for InMemoryIndex
impl IdIndex for InMemoryIndex
Source§impl IndexStore for InMemoryIndex
impl IndexStore for InMemoryIndex
Source§fn register(&mut self, id: &Id, path: &Path)
fn register(&mut self, id: &Id, path: &Path)
Displacing an existing registration must not leave the other map
pointing at the old counterpart — set_path
delegates here for exactly this care. Without it a collision leaves the
registry claiming two paths for one id (or two ids for one path), which
nothing downstream can make sense of.
Eviction is the last line of defence, not the intended path: callers that
register (or move, via set_path) an id they did not just mint should
ask prov’s Workspace::registration_conflict or
prov’s Workspace::move_conflict first and refuse,
because the document being displaced still spells the id in its own
frontmatter. What this guarantees is only that the index stays
consistent when something slips through.
Source§fn set_path(&mut self, id: &Id, new_path: &Path)
fn set_path(&mut self, id: &Id, new_path: &Path)
Moving an id onto a path is the same bijection-safe upsert as
registering it there fresh — displacing in either direction must not
leave the other map pointing at the old counterpart — so this is
register, not a near-duplicate of it. Before
this delegated, a displacement in the new-path direction went
unevicted: new_path’s previous id kept a forward entry pointing at a
path it no longer owned, the exact two-ids-one-path break register
was fixed against in 11abd38.
Source§fn committed(&mut self, _persisted: bool)
fn committed(&mut self, _persisted: bool)
Nothing here is ever persisted, so persisted is irrelevant — but the
checkpoint must still be dropped on every success.
Source§fn unregister(&mut self, id: &Id)
fn unregister(&mut self, id: &Id)
Source§fn checkpoint(&mut self)
fn checkpoint(&mut self)
Source§fn rollback(&mut self)
fn rollback(&mut self)
checkpoint — the mutation
failed and its writes were unwound, so the in-memory store must forget it
too, or it would claim a move that never happened.