Skip to main content

IndexStorage

Trait IndexStorage 

Source
pub trait IndexStorage: Send + Sync {
    // Required methods
    fn init(&self, index_dir: &Path) -> Result<()>;
    fn persist(&self, index_dir: &Path, entry: &FileIndex) -> Result<()>;

    // Provided methods
    fn prefers_snapshot_persistence(&self) -> bool { ... }
    fn remove(&self, _index_dir: &Path, _file_path: &Path) -> Result<()> { ... }
    fn persist_batch(
        &self,
        index_dir: &Path,
        entries: &[FileIndex],
    ) -> Result<()> { ... }
}
Expand description

Persistence backend for SimpleIndexer.

Required Methods§

Source

fn init(&self, index_dir: &Path) -> Result<()>

Prepare any directories or resources required for persistence.

Source

fn persist(&self, index_dir: &Path, entry: &FileIndex) -> Result<()>

Persist an indexed file entry.

Provided Methods§

Source

fn prefers_snapshot_persistence(&self) -> bool

Whether this backend expects full-snapshot persistence.

Snapshot-aware backends receive the complete in-memory index on each update so on-disk state stays consistent across single-file and directory indexing flows.

Source

fn remove(&self, _index_dir: &Path, _file_path: &Path) -> Result<()>

Remove a previously persisted file entry.

Defaults to a no-op to keep existing custom storage backends compatible.

Source

fn persist_batch(&self, index_dir: &Path, entries: &[FileIndex]) -> Result<()>

Persist a batch of indexed file entries.

Defaults to calling IndexStorage::persist for each entry, keeping existing custom storage backends compatible.

Implementors§