pub struct Envelope<D = GenericValue> {
pub sink: Option<SinkName>,
pub version: u8,
pub ts: DateTime<Utc>,
pub position: Option<Position>,
pub index: IndexName,
pub op: Op,
pub id: String,
pub meta: Option<EnvelopeMeta>,
pub document: Option<D>,
}Expand description
One document operation as a lane carries it and a sink receives it.
Generic over the document so one shape serves the pipeline
(Envelope<GenericValue>, the default) and a consumer of an emitting sink’s
output (Envelope<MyDocument> deserialized from the same JSON). On the
wire the position is seq, an opaque string; sink and meta are set by
the sink side and absent inside the pipeline.
Fields§
§sink: Option<SinkName>The emitting sink’s name, filled by that sink as it writes the envelope out; absent inside the pipeline, where one batch is shared by every sink.
version: u8ENVELOPE_VERSION at the time of writing.
ts: DateTime<Utc>When the ingest engine built this document.
position: Option<Position>The position of the change that produced it; None for a snapshot row.
Serialized as seq, the position rendered as an opaque string.
index: IndexNameThe logical index the document belongs to.
op: OpUpsert or delete.
id: StringThe document id within the index: the root primary key as a string.
meta: Option<EnvelopeMeta>A summary of the serialized document, filled by an emitting sink (it knows the wire format); absent inside the pipeline and on a delete.
document: Option<D>The built document; absent on a delete.
Implementations§
Source§impl<D> Envelope<D>
impl<D> Envelope<D>
Sourcepub fn map_document<E>(self, f: impl FnOnce(D) -> E) -> Envelope<E>
pub fn map_document<E>(self, f: impl FnOnce(D) -> E) -> Envelope<E>
The same envelope over a document of another type: how an emitting sink translates the pipeline’s value into its wire format.