pub struct RawIngestRecord {
pub id: String,
pub source: IngestSource,
pub metadata: IngestMetadata,
pub payload: Option<IngestPayload>,
}Expand description
The inbound record for ingest.
RawIngestRecord is the primary input type for the ingest pipeline. It contains
all information needed to process content: identification, source metadata, and
optional payload.
§Lifecycle
- Create
RawIngestRecordwith raw data - Call
ingest()to normalize - Receive
CanonicalIngestRecordfor downstream processing
§Examples
§Text Content
use ingest::{RawIngestRecord, IngestMetadata, IngestSource, IngestPayload};
use chrono::Utc;
let record = RawIngestRecord {
id: "text-001".to_string(),
source: IngestSource::RawText,
metadata: IngestMetadata {
tenant_id: Some("tenant".to_string()),
doc_id: Some("doc".to_string()),
received_at: Some(Utc::now()),
original_source: None,
attributes: None,
},
payload: Some(IngestPayload::Text(
" Content with extra spaces ".to_string()
)),
};§Binary File
use ingest::{RawIngestRecord, IngestMetadata, IngestSource, IngestPayload};
let record = RawIngestRecord {
id: "file-001".to_string(),
source: IngestSource::File {
filename: "image.png".to_string(),
content_type: Some("image/png".to_string()),
},
metadata: IngestMetadata {
tenant_id: Some("tenant".to_string()),
doc_id: Some("doc-123".to_string()),
received_at: None,
original_source: Some("uploads/image.png".to_string()),
attributes: None,
},
payload: Some(IngestPayload::Binary(vec![0x89, 0x50, 0x4E, 0x47])),
};Fields§
§id: StringUnique identifier for this ingest operation.
This ID is used for:
- Tracing and log correlation
- Deterministic document ID derivation (when
doc_idnot provided) - Deduplication and idempotency
Should be unique per ingest request. If not provided, a UUID should be generated by the caller.
§Example
use ingest::RawIngestRecord;
let record = RawIngestRecord {
id: "ingest-550e8400-e29b-41d4-a716-446655440000".to_string(),
..Default::default()
};source: IngestSourceSource of the content.
Indicates where the content came from and affects validation rules.
See IngestSource for details.
metadata: IngestMetadataMetadata associated with the record.
Contains contextual information like tenant, timestamps, and custom attributes.
See IngestMetadata for details.
payload: Option<IngestPayload>Raw payload content.
The actual content being ingested. May be None for metadata-only events
(e.g., IngestSource::Api).
See IngestPayload for the different payload types.
Trait Implementations§
Source§impl Clone for RawIngestRecord
impl Clone for RawIngestRecord
Source§fn clone(&self) -> RawIngestRecord
fn clone(&self) -> RawIngestRecord
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more