pub struct Index { /* private fields */ }Expand description
An embedded metadata index over one vault directory.
Implementations§
Source§impl Index
impl Index
Sourcepub fn open(dir: &Path) -> Result<Self, CoreError>
pub fn open(dir: &Path) -> Result<Self, CoreError>
Open (or create) the index at dir/index.redb.
Sourcepub fn upsert(
&self,
entry: &IndexEntry,
key: &[u8; 32],
) -> Result<(), CoreError>
pub fn upsert( &self, entry: &IndexEntry, key: &[u8; 32], ) -> Result<(), CoreError>
Insert or replace an entry. The entry is sealed before it touches disk.
Sourcepub fn remove(&self, id: &str) -> Result<(), CoreError>
pub fn remove(&self, id: &str) -> Result<(), CoreError>
Remove an entry by id (no-op if absent).
Sourcepub fn list(&self, key: &[u8; 32]) -> Result<Vec<IndexEntry>, CoreError>
pub fn list(&self, key: &[u8; 32]) -> Result<Vec<IndexEntry>, CoreError>
Enumerate all metadata entries (unsealing each). Never decrypts a value —
values live only in .sec records.
Sourcepub fn generation(&self) -> Result<u64, CoreError>
pub fn generation(&self) -> Result<u64, CoreError>
The current generation counter (0 until the first rebuild).
Sourcepub fn rebuild_from(
&self,
store_dir: &Path,
origin: &str,
key: &[u8; 32],
) -> Result<LoadOutcome, CoreError>
pub fn rebuild_from( &self, store_dir: &Path, origin: &str, key: &[u8; 32], ) -> Result<LoadOutcome, CoreError>
Rebuild the index from the records in store_dir, tolerantly: corrupt
records are skipped (already quarantined by the loader). Clears the
existing table and bumps the generation counter. Self-healing — a stale
or lost index is reconstructed from the source of truth (ADR-0001 §A.6).
Auto Trait Implementations§
impl !RefUnwindSafe for Index
impl !UnwindSafe for Index
impl Freeze for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
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