pub struct IndexerService {Show 14 fields
root: PathBuf,
store: Arc<dyn VectorStore>,
extractors: Arc<ExtractorRegistry>,
chunkers: Arc<ChunkerRegistry>,
embedder: Arc<EmbedderPool>,
config: IndexerConfig,
stats: Arc<RwLock<IndexStats>>,
event_tx: Sender<FileEvent>,
event_rx: Arc<RwLock<Receiver<FileEvent>>>,
update_tx: Sender<IndexUpdate>,
watcher: Arc<RwLock<Option<FileWatcher>>>,
running: Arc<RwLock<bool>>,
pending: Arc<AtomicUsize>,
idle_notify: Arc<Notify>,
}Expand description
Main indexing service.
Fields§
§root: PathBufRoot path being indexed
store: Arc<dyn VectorStore>Vector store
extractors: Arc<ExtractorRegistry>Extractor registry
chunkers: Arc<ChunkerRegistry>Chunker registry
embedder: Arc<EmbedderPool>Embedder pool
config: IndexerConfigConfiguration
stats: Arc<RwLock<IndexStats>>Current stats
event_tx: Sender<FileEvent>Event sender for file watcher
event_rx: Arc<RwLock<Receiver<FileEvent>>>Event receiver
update_tx: Sender<IndexUpdate>Update broadcast
watcher: Arc<RwLock<Option<FileWatcher>>>File watcher (if active)
running: Arc<RwLock<bool>>Running flag
pending: Arc<AtomicUsize>Outstanding file events (queued or in flight)
idle_notify: Arc<Notify>Signaled when Self::pending reaches zero
Implementations§
Source§impl IndexerService
impl IndexerService
Sourcepub fn new(
root: PathBuf,
store: Arc<dyn VectorStore>,
extractors: Arc<ExtractorRegistry>,
chunkers: Arc<ChunkerRegistry>,
embedder: Arc<EmbedderPool>,
config: IndexerConfig,
) -> Self
pub fn new( root: PathBuf, store: Arc<dyn VectorStore>, extractors: Arc<ExtractorRegistry>, chunkers: Arc<ChunkerRegistry>, embedder: Arc<EmbedderPool>, config: IndexerConfig, ) -> Self
Create a new indexer service.
Sourcepub fn config(&self) -> &IndexerConfig
pub fn config(&self) -> &IndexerConfig
Configuration used by this indexer (include/exclude, chunk, force, …).
Sourcepub async fn wait_until_idle(&self)
pub async fn wait_until_idle(&self)
Wait until every queued file event has been processed.
Call this after Self::start for a one-shot index so the CLI does not
return while the background worker is still embedding files.
Sourcepub fn subscribe(&self) -> Receiver<IndexUpdate>
pub fn subscribe(&self) -> Receiver<IndexUpdate>
Subscribe to index updates.
Sourcepub async fn process_single(&self, path: &Path) -> Result<u32>
pub async fn process_single(&self, path: &Path) -> Result<u32>
Process a single file through the pipeline.
Sourcepub async fn reindex_path(&self, path: &Path) -> Result<()>
pub async fn reindex_path(&self, path: &Path) -> Result<()>
Reindex a path (file or directory).
If the path is a file, it will be reindexed (existing chunks deleted first). If the path is a directory, all files in it will be reindexed recursively.
Sourceasync fn reindex_directory(&self, dir: &Path) -> Result<()>
async fn reindex_directory(&self, dir: &Path) -> Result<()>
Recursively reindex all files in a directory.
Trait Implementations§
Source§impl Indexer for IndexerService
impl Indexer for IndexerService
Source§fn watch<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn watch<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn index<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
force: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn index<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
force: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for IndexerService
impl !UnwindSafe for IndexerService
impl Freeze for IndexerService
impl Send for IndexerService
impl Sync for IndexerService
impl Unpin for IndexerService
impl UnsafeUnpin for IndexerService
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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