pub struct IndexStore<S: SnapshotStore = DiskSnapshotStore> { /* private fields */ }Expand description
Index lifecycle orchestrator backed by a [SnapshotStore] for atomic
persistence and coordination.
Implementations§
Source§impl IndexStore<DiskSnapshotStore>
impl IndexStore<DiskSnapshotStore>
Source§impl IndexStore<DiskSnapshotStore>
impl IndexStore<DiskSnapshotStore>
Sourcepub fn open_or_create(sift_dir: &Path, meta: &StoreMeta) -> Result<Self>
pub fn open_or_create(sift_dir: &Path, meta: &StoreMeta) -> Result<Self>
Open an existing store or create a new one at sift_dir.
§Errors
Returns an error if the store directory cannot be created or metadata cannot be written.
pub fn snapshot_dir(&self, id: &str) -> PathBuf
Source§impl<S: SnapshotStore> IndexStore<S>
impl<S: SnapshotStore> IndexStore<S>
pub fn current_id(&self) -> Option<&str>
Sourcepub fn build(
&mut self,
kinds: &[IndexKind],
config: &IndexConfig<'_>,
paths: &[PathBuf],
) -> Result<String>
pub fn build( &mut self, kinds: &[IndexKind], config: &IndexConfig<'_>, paths: &[PathBuf], ) -> Result<String>
Build a new snapshot using the given index kinds.
Acquires the writer session, builds each index kind as artifacts, and publishes the snapshot.
Returns the snapshot id.
§Errors
Returns an error if the writer session cannot be acquired, the index build fails, or publishing fails.
Sourcepub fn update(
&mut self,
kinds: &[IndexKind],
config: &IndexConfig<'_>,
paths: &[PathBuf],
) -> Result<Option<String>>
pub fn update( &mut self, kinds: &[IndexKind], config: &IndexConfig<'_>, paths: &[PathBuf], ) -> Result<Option<String>>
Update the current snapshot, rebuilding only indexes whose corpus changed.
Acquires the writer session, checks for changes, copies unchanged artifacts from the current snapshot, and publishes a new one.
Returns the snapshot id if a new snapshot was published, or None if
no index changed.
§Errors
Returns an error if the writer session cannot be acquired, the current snapshot cannot be opened, the update check fails, or publishing fails.
Auto Trait Implementations§
impl<S> Freeze for IndexStore<S>where
S: Freeze,
impl<S> RefUnwindSafe for IndexStore<S>where
S: RefUnwindSafe,
impl<S> Send for IndexStore<S>where
S: Send,
impl<S> Sync for IndexStore<S>where
S: Sync,
impl<S> Unpin for IndexStore<S>where
S: Unpin,
impl<S> UnsafeUnpin for IndexStore<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for IndexStore<S>where
S: UnwindSafe,
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
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>
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>
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