transport only.Expand description
§Parse-on-demand codec (Task 0.3a)
The data-plane spine frames bytes into a WorkBatch
WITHOUT parsing (Task 0.2). A transform / router that needs to read a field
parses on demand – and it should not care whether the record arrived as
JSON or MsgPack. This module is that parse step.
§Native, no JSON bridge
There is no rmp_serde -> serde_json::Value -> serde_json::to_vec -> sonic_rs bridge anywhere on the parse path – that double-parse-and-
re-serialise was killed in Phase 0.7c (the engine parse.rs MsgPack path
now walks rmpv straight into a sonic_rs::Value). Both this codec and
the engine decode natively:
- JSON is parsed once with
sonic_rs(SIMD, AVX2/NEON). - MsgPack is parsed once with
rmpv– the schema-lessValuedecoder from the same3Hren/msgpack-rustworkspace asrmp-serde. No intermediateserde_json::Value, no JSON re-serialise.
§Unified routing-field accessor
A router keys off ONE field (_table, org_id, …) and must not branch on
wire format. ParsedPayload exposes a format-agnostic accessor:
ParsedPayload::field_str– the common case: a top-level string field.ParsedPayload::field– aFieldRefcovering the scalar routing cases (string / int / float / bool / null), with everything else (FieldRef::Other) deliberately collapsed because routers do not key off nested containers.
Scope: top-level object-key lookup only. No deep JSON-path – routing keys live at the top level, and a deep-path query is a separate concern that YAGNI keeps out of the hot routing path.
See docs/MIGRATIONS.md (codec consolidation: native rmpv, JSON bridge
removed) and docs/SELF-REGULATION.md for where this codec sits in the
WorkBatch data-plane spine. The block contract is in
WorkBatch.
Enums§
- Codec
Error - A parse failure, tagged by the format that failed.
- Field
Ref - A borrowed view of one routing field, format-agnostic.
- Parsed
Payload - A parsed payload, retaining its native value representation.
Functions§
- parse
- Parse a framed payload into a native
ParsedPayload. - to_
json_ bytes - Serialise a JSON value to bytes via
sonic_rs(SIMD), no bridge. - to_
msgpack_ bytes - Serialise a MsgPack value to bytes via NATIVE
rmpv::encode::write_value.