pub struct IndexerService {
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>>,
}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
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 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,
Start watching a directory for changes.
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,
Stop watching.
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,
Manually trigger indexing of a path.
Auto Trait Implementations§
impl Freeze for IndexerService
impl !RefUnwindSafe for IndexerService
impl Send for IndexerService
impl Sync for IndexerService
impl Unpin for IndexerService
impl !UnwindSafe 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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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