Skip to main content

debug_frame_wire_size

Function debug_frame_wire_size 

Source
pub fn debug_frame_wire_size(
    params: &BTreeMap<String, Parameter>,
    data: Option<&[u8]>,
) -> usize
Expand description

Byte size to charge for a dora topic debug frame when accounting bandwidth.

Prefers the daemon-stamped WIRE_SIZE (the real on-wire data-sample length): the data the CLI receives is a rebuilt self-describing stream whose schema was re-prepended for inspection, so for a schema-once output data.len() over-reports what actually travelled. Falls back to the buffer length when the key is absent — an older daemon, or a non-debug frame that never carried it (dora-rs/dora#2584). A present-but-out-of-range stamp (a negative i64 that can’t be a byte count) also falls back rather than silently counting zero. Keep this the single reader of WIRE_SIZE so the daemon stamp and the CLI accounting can never disagree on the fallback rule.