Skip to content

RIS Live support - #2

Merged
digizeph merged 2 commits into
mainfrom
ris-live-support
Nov 11, 2021
Merged

RIS Live support#2
digizeph merged 2 commits into
mainfrom
ris-live-support

Conversation

@digizeph

@digizeph digizeph commented Nov 8, 2021

Copy link
Copy Markdown
Member

This pull request added support for parsing JSON data stream from RIS Live: https://ris-live.ripe.net

json parsing (deserialization) for all message types are implemented.
@digizeph
digizeph marked this pull request as ready for review November 11, 2021 03:42
@digizeph
digizeph merged commit 6ea1622 into main Nov 11, 2021
@digizeph
digizeph deleted the ris-live-support branch 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant