RIS Live support - #2
Merged
Merged
Conversation
json parsing (deserialization) for all message types are implemented.
digizeph
marked this pull request as ready for review
November 11, 2021 03:42
digizeph
added a commit
that referenced
this pull request
Jul 29, 2026
Redesign per ties's fallible-encoding-redesign proposal. Replaces the try_encode()/encode() dual API (which structurally invited the bugs found in review) with a single fallible sink convention: 1. encode_to(&mut BytesMut) -> Result<(), EncodingError> as the primary API, with encode() -> Result<Bytes, EncodingError> as the convenience wrapper. Composition is child.encode_to(buf)? — the extend(Result) silent-drop footgun (review issue #1) becomes impossible. 2. Length prefixes centralized in src/encoder/sink.rs: with_u8_len, with_u16_len, and check_max write placeholder lengths, encode the payload into the same buffer, and back-patch — rolling the buffer back to its pre-call state on any error. Replaces 24 hand-rolled try_from(..).map_err(ValueTooLarge) copies (issue #12) and makes non-power-of-two bounds explicit (FlowSpec's 12-bit 0x0FFF via check_max, issue #9). 3. EncodingError gains Unencodable for values the wire format cannot express at all: ATTR_SET (unimplemented, issue #6), OPEN param_type 255 in non-extended framing (issue #5), MP_REACH/MP_UNREACH NLRI failures (issue #3). The RFC 9072 auto-upgrade for oversized OPEN params stays as documented behavior (issue #8). 4. Mutation-time validation: PeerIndexTable::add_peer returns Result<u16, EncodingError> and errors on the 65537th peer (issue #2); MrtRibEncoder::process_elem propagates it. export_bytes and all top-level encoders (MrtMessage, Bgp4MpMessage, MrtRecord) return Result, closing the inherited-panic escape hatch (issue #7). 5. Dual API deleted: all panicking encode() wrappers and try_encode adapters removed; Tlv::length()/SubTlv::length() removed (issue #10). #![deny(unused_must_use)] makes dropping an encode Result a compile error crate-wide. New regression tests: peer table overflow at 65537 with uncorrupted state, RIB entries oversized-entry and count-overflow errors, sink helper boundary tests (0/max/max+1, nested prefixes, rollback on child error). fmt + clippy -D warnings + 695 unit tests + integration + doc tests: all green. No version bump per maintainer request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request added support for parsing JSON data stream from RIS Live: https://ris-live.ripe.net