Skip to main content

SampleRow

Struct SampleRow 

Source
pub struct SampleRow {
Show 21 fields pub key: String, pub origin: Option<String>, pub subject: Option<String>, pub t: Option<u64>, pub type_name: Option<String>, pub typed: Option<bool>, pub encoding: Option<String>, pub timestamp: Option<String>, pub qos: Option<String>, pub qos_axes: Option<String>, pub delete: bool, pub bytes: Option<String>, pub value: Option<Value>, pub payload_bytes: Option<usize>, pub source: Option<String>, pub attachment: Option<Value>, pub attachment_b64: Option<String>, pub attachment_bytes: Option<usize>, pub verdict: Option<String>, pub violations: Option<Vec<String>>, pub decode_error: Option<String>,
}
Expand description

One sample, as the explorers write it (#235).

The write side of this module’s dialect: .zrec rows (RFC 09 §5.2), zenctl echo --format ndjson, and zengui’s echo export are all this struct, so parse_row reads back what any of them wrote. Every optional field is skip_serializing_if: a writer that does not hold a fact omits it rather than nulling it, because a null here would claim a question was asked and answered negatively (RFC 09 §5.1 O4). That is also what keeps the three writers’ rows a subset relationship rather than three shapes — a .zrec row carries no origin, an echo row carries no pacing offset, and neither is lying about the other.

Fields§

§key: String

Full wire key, as received — explorers run un-namespaced (RFC 09 §5).

§origin: Option<String>

The convention-parsed origin chunk, when the key parses at all.

Absent means the key did not parse under the observer’s base, which is a fact about the key and not a claim about the fleet (O1/O3).

§subject: Option<String>

The parsed subject tail, joined — absent on the same terms as SampleRow::origin.

§t: Option<u64>

Microseconds since the capture epoch: the observer’s arrival clock, and the only thing replay paces by (RFC 09 §5.2). A live stream has no epoch to be relative to, so it omits this.

§type_name: Option<String>

The registry-declared type name, when a decode was asked for and resolved one. --no-decode never asks, so it omits this rather than nulling it (O4).

§typed: Option<bool>

Whether SampleRow::value is a schema decode rather than a structural rendering. Absent when nothing was decoded.

§encoding: Option<String>

The sample’s declared encoding, verbatim (RFC 08 §7: sample beats registry beats sniff).

§timestamp: Option<String>

The sample’s HLC, when one rode it. Whose clock it is depends on who stamped it (RFC 09 §5.1 O7); this field says only that it exists.

§qos: Option<String>

The RFC 04 §3 QoS profile name, and only when the wire’s actual axes match one.

This is the field parse_row resolves through zenkey::qos::QosProfile::from_name, so it must never carry anything else — axes matching no profile are not approximated, they ride SampleRow::qos_axes instead. Writing the axes here is exactly the bug in #235.

§qos_axes: Option<String>

The wire’s actual QoS axes as one token, priority/congestion/reliability[+express] (#120).

A fact worth carrying and not a profile name: a fleet is free to publish axes no profile declares, and the declared-vs-observed comparison is the point.

§delete: bool

A tombstone: authoritative retirement, never an empty put (RFC 04 §1.2). Always written — every sample is one or the other, and that is a fact rather than an unanswered question.

§bytes: Option<String>

Base64 of the exact wire payload — lossless and round-trippable, which is why parse_row prefers it over SampleRow::value.

§value: Option<Value>

The payload as a rendering: a schema decode when one was asked for and succeeded, else the structural degradation. It does not round-trip a binary payload, and RFC 09 §5.2 says so.

§payload_bytes: Option<usize>

True payload size, whatever the rendering above shows.

Deliberately not spelled bytes: that key has meant the base64 payload since RFC 09 §5.2, and a byte count under it makes the row unreadable rather than merely lossy (#235).

§source: Option<String>

The publishing entity, zid:eid#sn, when SourceInfo rode the sample. Usually absent: zenoh 1.9 and 1.10 deliver none to a subscriber — 1.10 even dropped setting it through the advanced API (eclipse-zenoh/zenoh#2563) — RFC 09 §5.1 O7’s practical note.

§attachment: Option<Value>

The attachment as a rendering (#117), on the same terms as SampleRow::value.

§attachment_b64: Option<String>

Base64 of the exact attachment bytes; wins over the rendering.

§attachment_bytes: Option<usize>

True attachment size, whatever the rendering above shows.

§verdict: Option<String>

The RFC 08 §7 validation verdict, present only when the pipeline was asked — and then always, so “valid” and “not checked” cannot be confused by a shared absence (#159).

§violations: Option<Vec<String>>

The failed constraints, when the verdict is invalid.

§decode_error: Option<String>

Why a decode that was asked for did not happen.

Implementations§

Source§

impl SampleRow

Source

pub fn of_key(key: &str, base: &str) -> SampleRow

The identity fields every writer shares: the wire key, and what the convention could make of it under this base.

A key that does not parse still yields a row — O1: a key that does not parse is a fact, not an error — it simply carries no origin or subject.

Source

pub fn with_wire(self, view: &SampleView) -> SampleRow

The wire facts a crate::SampleView carries, filled in.

Payload and attachment are left to the caller: an observer renders them (value), a capture stores them (bytes), and which one a writer owes is the difference between the two dialect halves.

Source

pub fn with_payload_bytes(self, payload: &[u8]) -> SampleRow

The lossless payload, base64 — what a capture owes and a live rendering does not (RFC 09 §5.2).

Source

pub fn to_line(&self) -> String

One line of ndjson, newline excluded.

Trait Implementations§

Source§

impl Clone for SampleRow

Source§

fn clone(&self) -> SampleRow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SampleRow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SampleRow

Source§

fn default() -> SampleRow

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SampleRow

Source§

fn eq(&self, other: &SampleRow) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for SampleRow

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SampleRow

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<Source> AccessAs for Source

Source§

fn ref_as<T>(&self) -> <Source as IGuardRef<T>>::Guard<'_>
where Source: IGuardRef<T>, T: ?Sized,

Provides immutable access to a type as if it were its ABI-unstable equivalent.
Source§

fn mut_as<T>(&mut self) -> <Source as IGuardMut<T>>::GuardMut<'_>
where Source: IGuardMut<T>, T: ?Sized,

Provides mutable access to a type as if it were its ABI-unstable equivalent.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsNode<T> for T

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

fn as_node_mut(&mut self) -> &mut T

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, As> IGuardMut<As> for T
where T: Into<As>, As: Into<T>,

Source§

type GuardMut<'a> = MutAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary after applying its changes to the original.
Source§

fn guard_mut_inner(&mut self) -> <T as IGuardMut<As>>::GuardMut<'_>

Construct the temporary and guard it through a mutable reference.
Source§

impl<T, As> IGuardRef<As> for T
where T: Into<As>, As: Into<T>,

Source§

type Guard<'a> = RefAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary.
Source§

fn guard_ref_inner(&self) -> <T as IGuardRef<As>>::Guard<'_>

Construct the temporary and guard it through an immutable reference.
Source§

impl<T> Includes<End> for T

Source§

type Output = End

The result
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more