Expand description
Streaming record framing: the seam that cuts a decoded byte stream into records.
Framing is a transport- and format-agnostic seam. Any streaming/pull
source — object-storage backfills (spate-s3) today, HTTP chunked bodies,
WebSocket message streams, or file tails tomorrow — must turn a byte stream
into records before a Deserializer decodes
each one. That “one payload → one record” split is what lets a single
decoder serve every source; the framer decides what one payload is.
spate-core owns only the seam here — the RecordFramer trait, the
FramerWriter decompressor shim, and the FramingContract handshake.
The concrete framers are owned by the format crates, because how a byte
stream splits into records is a property of the format, not the transport:
spate-json provides newline-delimited framing for NDJSON, a future
spate-avro an object-container block framer, and so on. A source stays
format-agnostic and receives its framer at pipeline-assembly time (e.g.
S3Source::with_framer), so the same framer serves every streaming source
and no source hard-codes a format.
A RecordFramer is fed decoded bytes in arbitrary chunks and yields
completed record byte-slices. It must be a pure function of the byte
stream — independent of how the bytes are chunked — so a source that
resumes by record index replays deterministically (this is load-bearing for
at-least-once resume; see the spate-s3 offset model). Compression is not
part of framing: a source that decompresses wraps its decompressor around a
FramerWriter, so the framer only ever sees already-decoded bytes.
Dispatch through Box<dyn RecordFramer> happens once per fed chunk, never
per record, so each impl’s per-record scan stays monomorphized.
Structs§
- Framer
Writer - A
Writeadapter over aRecordFramer, so a source whose decompressor (or any otherWrite-sink codec) emits decoded bytes throughWritecan feed a framer without the framer implementingWriteitself. Everywriteforwards the buffer toRecordFramer::push.
Enums§
- Framing
Contract - What one payload emitted by a source represents, so the framework can pair a source with a deserializer without the two being coordinated by hand.
Traits§
- Record
Framer - A streaming record framer: fed decoded bytes, yields record byte-payloads.