pub trait IngestSourceAdapter:
Sealed
+ Send
+ Sync {
// Required method
fn parse(
&self,
raw: &str,
batch_id: &ImportBatchId,
) -> Result<Vec<IngestDocument>, MemoryError>;
}Expand description
Adapter that converts raw source material into IngestDocument values.
The trait is sealed — only implementations in zeph-memory are permitted.
This preserves the valid-by-construction invariants of IngestDocument:
non-empty content, non-empty source URI, and a hash computed from content.
§Design
Adapters are pure: no async, no I/O, no external crate dependencies beyond
zeph-llm (which zeph-memory already depends on). The binary layer reads
raw bytes off disk and passes the string in via IngestSourceAdapter::parse.
Required Methods§
Sourcefn parse(
&self,
raw: &str,
batch_id: &ImportBatchId,
) -> Result<Vec<IngestDocument>, MemoryError>
fn parse( &self, raw: &str, batch_id: &ImportBatchId, ) -> Result<Vec<IngestDocument>, MemoryError>
Parse raw source material into a list of IngestDocument values.
batch_id is embedded in every document’s provenance so that all documents
produced in one ingest_documents call share the same rollback key.
§Contract
Implementations SHOULD skip malformed individual records (e.g. a single
unparseable JSONL line) and continue parsing the rest of the input — partial
parse errors are not fatal. Err is returned only for an irrecoverable
format error where no documents could be produced from raw at all.
§Errors
Returns MemoryError::Ingest only for irrecoverable format errors where
no documents could be produced from raw. Malformed individual records are
skipped with a warning and do not cause an Err return.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".