Skip to main content

ContentSourceProvider

Trait ContentSourceProvider 

Source
pub trait ContentSourceProvider: Send + Sync {
    // Required methods
    fn source_type(&self) -> &str;
    fn scan_for_changes<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        since_cursor: Option<&'life1 str>,
        patterns: &'life2 [String],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SourceFile>, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn read_content<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Abstraction over content source backends.

Local sources use filesystem walking; remote sources use API polling. Both produce SourceFile metadata and string content that feeds into the shared Watchtower ingest pipeline.

Required Methods§

Source

fn source_type(&self) -> &str

Returns the source type identifier (e.g. "local_fs", "google_drive").

Source

fn scan_for_changes<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, since_cursor: Option<&'life1 str>, patterns: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<Vec<SourceFile>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Scan for files that changed since since_cursor.

  • since_cursor: opaque sync cursor from the last scan (RFC 3339 timestamp or provider-specific token). None means full scan.
  • patterns: glob patterns to filter files (e.g. ["*.md", "*.txt"]).

Returns metadata for each changed file. The caller is responsible for calling read_content on files that need ingestion.

Source

fn read_content<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the full text content of a file by its provider ID.

Implementors§