Skip to main content

Module ecc_segment

Module ecc_segment 

Source
Expand description

ECC RVF segment type definitions (WEFT-508).

Upstream rvf-types::SegmentType covers vector/index/federation codes (0x00–0x36). WeftOS ECC structures need domain-local discriminants that do not collide with:

  • rvf-types (≤ 0x36)
  • context-router research reservations (0x40–0x42)

We allocate the 0x50–0x5F block for ECC persistence payloads. Each variant wraps a CBOR (preferred) or JSON body; this module defines the type table + encode/decode helpers. Full migration of on-disk chain blobs onto these segments is follow-up work (see migration notes).

§Segment table

CodeNamePayload
0x50CausalEdgeCausalEdge
0x51CausalNodeCausalNode
0x52ImpulseImpulse
0x53CalibrationProfileJSON profile blob (calibration / democritus)
0x54CrossRefCrossRef
0x55SpectralCheckpointλ₂ / eigenvalue snapshot
0x56CausalGraphSnapWhole-graph snapshot envelope

§Migration plan

  1. Today: ad-hoc JSON / ExoChain CBOR events remain authoritative.
  2. Writers may dual-write ECC segments alongside chain events.
  3. Readers prefer ECC segments when present; fall back to legacy.
  4. After one release cycle, stop writing legacy-only forms for new events.

Structs§

CalibrationProfileSegment
Calibration profile payload (opaque JSON-friendly map for now).
EccSegment
Framed ECC segment: type byte + codec + payload bytes.
SpectralCheckpoint
Spectral checkpoint payload (λ₂ snapshot).

Enums§

EccSegmentCodec
Codec for ECC segment payloads.
EccSegmentError
Errors for ECC segment codec.
EccSegmentType
WeftOS ECC segment discriminants (RVF type byte, domain 0x50–0x5F).

Functions§

decode_ecc_segment
Decode payload bytes into T.
encode_ecc_segment
Encode a serializable payload as an EccSegment.
segment_from_wire
Parse wire bytes produced by segment_to_wire.
segment_to_wire
Wire bytes: [type:u8][codec:u8][payload...].