Skip to content

v0.7.0

Choose a tag to compare

@joaquinbejar joaquinbejar released this 16 Sep 13:36
· 13 commits to main since this release

Added

  • codegen: sequential single-pass readers (#64, #65). Every message with var data or a variable-stride repeating group gets a <Message>Reader that decodes front to back with one cursor: fixed fields, then each group, then each var data field, in schema order. Every group header, entry and var data header is visited exactly once, O(N + M) for N entries and M var data fields, where the random-access decoders re-walk the preceding variable-stride groups on every accessor call. Variable-stride groups get <Group>GroupReader / <Group>EntryReader pairs with next_entry(); fixed-stride groups come back as the existing <Group>GroupDecoder iterator. Parts the caller does not read are walked lazily, on the next accessor, on drop or on finish(), and every skipped extent is bounds-checked so a truncated frame panics instead of finishing clean. decode() reuses the decoder's header validation. On a book with 256 variable entries followed by eight var data fields the sequential path decodes in 375 ns (p50) against 2583 ns for random access (cargo bench -p ironsbe-bench --bench sequential_decode).
  • codegen: MessageEncoder::finish() completes a message and returns its encoded length; every message encoder has it (#63, #65).
  • schema: reader_name() on ResolvedMessage, reader_name() / entry_reader_name() on ResolvedGroup.
  • bench: sequential_decode, a harness-less bench timing each decode individually and reporting p50 / p99 / p99.9 for both paths at 16, 64 and 256 entries. ironsbe-bench builds its schema at build time through ironsbe-codegen.

Changed

  • codegen: generated encoders guard their variable parts (#63, #65). Message encoders with groups or var data, and entry encoders of variable-stride groups, track the parts written in schema order (groups, then <data> fields). A part the caller skips is encoded as empty, a group header with zero entries or a zero-length var data header, when a later part is written, when the entry encoder is dropped, or on finish(), so a frame is always well-formed. Writing a part out of schema order, or twice, panics with the part name instead of corrupting the following entries. Entry encoder Drop only writes headers, never asserts, and stays inert while unwinding. Flat messages and fixed-stride entries keep byte-identical output and their API. Callers that skip trailing groups or var data must call finish() instead of encoded_length() to get a complete frame.
  • codegen: a field, group or var data whose accessor collides with a generated method (wrap, decode, validate_header, encoded_length, acting_version, finish on messages; wrap, end_offset on entries) is emitted with a trailing underscore on decoders and readers (finish_()), documented on the accessor. Setters and _as_str variants keep their plain name. Until now such schemas failed to compile.

Testing

  • ironsbe-codegen-tests gains 46 compiled tests: skipped and out-of-order variable parts at message level and inside entries, reader against random-access agreement on Quote and Nested including partial reads and truncated frames, and the reserved-name regression.

Known follow-ups

  • A group encoder declared with N entries but fewer written is still unguarded.
  • SbeDecoder::encoded_length() on the random-access decoders does not check the last var data payload against the buffer length; the readers do.

Full changelog: v0.6.0...v0.7.0