pub struct FileMetaStore {
pub model_name: String,
pub dimensions: usize,
pub last_full_index: Option<u64>,
/* private fields */
}Expand description
Persistent store for file metadata - enables incremental indexing
Improvements over osgrep:
- Two-level check: mtime first (fast), hash only if mtime changed
- Tracks chunk IDs for efficient deletion on file update
- Stores chunk count for statistics
Fields§
§model_name: StringModel used for indexing (invalidate if model changes)
dimensions: usizeDimensions of embeddings
last_full_index: Option<u64>Last full index timestamp
Implementations§
Source§impl FileMetaStore
impl FileMetaStore
Sourcepub fn load_or_create(
db_path: &Path,
model_name: &str,
dimensions: usize,
) -> Result<Self>
pub fn load_or_create( db_path: &Path, model_name: &str, dimensions: usize, ) -> Result<Self>
Load from database directory, or create new if doesn’t exist
Sourcepub fn compute_hash(path: &Path) -> Result<String>
pub fn compute_hash(path: &Path) -> Result<String>
Compute SHA256 hash of file content
Sourcepub fn check_file(&self, path: &Path) -> Result<(bool, Vec<u32>)>
pub fn check_file(&self, path: &Path) -> Result<(bool, Vec<u32>)>
Check if a file needs re-indexing Returns: (needs_reindex, existing_chunk_ids_to_delete)
Sourcepub fn update_file(&mut self, path: &Path, chunk_ids: Vec<u32>) -> Result<()>
pub fn update_file(&mut self, path: &Path, chunk_ids: Vec<u32>) -> Result<()>
Update metadata for a file after indexing
Sourcepub fn remove_file(&mut self, path: &Path) -> Option<FileMeta>
pub fn remove_file(&mut self, path: &Path) -> Option<FileMeta>
Mark a file as deleted
Sourcepub fn tracked_files(&self) -> impl Iterator<Item = &String>
pub fn tracked_files(&self) -> impl Iterator<Item = &String>
Get all tracked files
Sourcepub fn find_deleted_files(&self) -> Vec<(String, Vec<u32>)>
pub fn find_deleted_files(&self) -> Vec<(String, Vec<u32>)>
Find files that were deleted (exist in store but not on disk)
Sourcepub fn mark_full_index(&mut self)
pub fn mark_full_index(&mut self)
Set last full index time
Trait Implementations§
Source§impl Debug for FileMetaStore
impl Debug for FileMetaStore
Source§impl<'de> Deserialize<'de> for FileMetaStore
impl<'de> Deserialize<'de> for FileMetaStore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FileMetaStore
impl RefUnwindSafe for FileMetaStore
impl Send for FileMetaStore
impl Sync for FileMetaStore
impl Unpin for FileMetaStore
impl UnsafeUnpin for FileMetaStore
impl UnwindSafe for FileMetaStore
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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