pub struct IncrementalIndexer { /* private fields */ }Expand description
Incremental indexer for processing file changes.
The IncrementalIndexer batches file system events and processes
them on flush, avoiding full re-indexing of the codebase.
§Examples
use forgekit_core::indexing::IncrementalIndexer;
use forgekit_core::watcher::WatchEvent;
use std::path::PathBuf;
let indexer = IncrementalIndexer::new(store);
// Queue some changes (only src/ and tests/ files will be indexed)
indexer.queue(WatchEvent::Modified(PathBuf::from("src/lib.rs")));
indexer.queue(WatchEvent::Created(PathBuf::from("tests/test.rs")));
indexer.queue(WatchEvent::Modified(PathBuf::from("target/debug/build.rs"))); // Ignored
// Process changes
indexer.flush().await?;Implementations§
Source§impl IncrementalIndexer
impl IncrementalIndexer
Sourcepub fn new(store: Arc<UnifiedGraphStore>) -> Self
pub fn new(store: Arc<UnifiedGraphStore>) -> Self
Creates a new incremental indexer with default path filtering.
By default, only files in src/ and tests/ directories are indexed.
§Arguments
store- The graph store for index updates
Sourcepub fn with_filter(store: Arc<UnifiedGraphStore>, filter: PathFilter) -> Self
pub fn with_filter(store: Arc<UnifiedGraphStore>, filter: PathFilter) -> Self
Creates a new incremental indexer with a custom path filter.
§Arguments
store- The graph store for index updatesfilter- Custom path filter
Sourcepub fn filter(&self) -> &PathFilter
pub fn filter(&self) -> &PathFilter
Returns a reference to the path filter.
Sourcepub fn set_filter(&mut self, filter: PathFilter)
pub fn set_filter(&mut self, filter: PathFilter)
Sets a new path filter.
Sourcepub fn queue(&self, event: WatchEvent)
pub fn queue(&self, event: WatchEvent)
Queues a watch event for processing.
Only files matching the path filter will be queued.
§Arguments
event- The watch event to queue
Sourcepub async fn flush(&self) -> Result<FlushStats>
pub async fn flush(&self) -> Result<FlushStats>
Sourcepub async fn full_rescan(&self, root: &Path) -> Result<usize>
pub async fn full_rescan(&self, root: &Path) -> Result<usize>
Sourcepub async fn pending_count(&self) -> usize
pub async fn pending_count(&self) -> usize
Returns the number of pending files to process.
Sourcepub async fn clear_pending(&self)
pub async fn clear_pending(&self)
Clears all pending changes without processing.
Trait Implementations§
Source§impl Clone for IncrementalIndexer
impl Clone for IncrementalIndexer
Source§fn clone(&self) -> IncrementalIndexer
fn clone(&self) -> IncrementalIndexer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for IncrementalIndexer
impl !UnwindSafe for IncrementalIndexer
impl Freeze for IncrementalIndexer
impl Send for IncrementalIndexer
impl Sync for IncrementalIndexer
impl Unpin for IncrementalIndexer
impl UnsafeUnpin for IncrementalIndexer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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