Skip to main content

Metadata

Struct Metadata 

Source
pub struct Metadata {
    pub parameters: MetadataParameters,
    /* private fields */
}
Expand description

Additional data that is sent as part of output messages.

Includes a timestamp and additional user-provided parameters. The payload is a self-describing Arrow IPC stream, so the message carries no separate type descriptor.

A node receives a Metadata alongside every input. The timestamp and metadata_version are read through accessors, while parameters — the user-provided key/value pairs — is a public field read and written directly.

§Examples

use dora_message::metadata::{get_integer_param, Metadata, Parameter};

let timestamp = uhlc::HLC::default().new_timestamp();
let mut metadata = Metadata::new(timestamp);

// A fresh `Metadata` carries the current wire-format version and no
// user parameters.
assert_eq!(metadata.metadata_version(), Metadata::CURRENT_VERSION);
assert!(metadata.parameters.is_empty());

// Attach a typed parameter and read it back with the matching getter.
metadata
    .parameters
    .insert("frame".to_string(), Parameter::Integer(7));
assert_eq!(get_integer_param(&metadata.parameters, "frame"), Some(7));

Fields§

§parameters: MetadataParameters

User-provided key/value parameters carried alongside the payload.

A BTreeMap of Parameter values keyed by name. Read the common scalar cases through the type-checked get_string_param, get_integer_param, and get_bool_param helpers rather than matching on the Parameter variant directly.

Implementations§

Source§

impl Metadata

Source

pub const CURRENT_VERSION: u16 = 2

Current metadata wire-format version, stamped on every outgoing message.

Bumped from 0 to 1 when the ArrowTypeInfo sidecar was dropped and the wire format became Arrow-IPC-only, and from 1 to 2 when the binary encoding moved from bincode to postcard (varint integers and length prefixes, so the byte layout differs even though the field order does not). A receiver can compare metadata_version against this to detect a peer speaking an incompatible format and report it clearly instead of failing with a cryptic positional-deserialization error.

Source

pub fn new(timestamp: Timestamp) -> Self

Create metadata with the given timestamp and no user parameters.

Source

pub fn startup_marker(timestamp: Timestamp) -> Self

Metadata for a startup route-probe marker (see STARTUP_MARKER_PARAM).

Source

pub fn is_startup_marker(&self) -> bool

Whether this message is a startup route-probe marker rather than node data. Markers are consumed by the receiving node’s startup barrier and must never be decoded or surfaced to user code — see STARTUP_MARKER_PARAM.

Source

pub fn startup_ack( timestamp: Timestamp, consumer_node: &str, input_id: &str, ) -> Self

Metadata for a startup route-probe ack: the consumer-side reply to a startup marker, identifying which consumer input received it (see STARTUP_ACK_PARAM).

Source

pub fn startup_ack_identity(&self) -> Option<(&str, &str)>

Some((consumer_node, input_id)) iff this message is a well-formed startup route-probe ack — see STARTUP_ACK_PARAM. Malformed acks (missing or wrongly-typed identity parameters) return None and are ignored by producers, which keeps the affected output on the reliable daemon path instead of switching on bad evidence.

Source

pub fn from_parameters( timestamp: Timestamp, parameters: MetadataParameters, ) -> Self

Create metadata with the given timestamp and user parameters, stamping the current wire-format version (CURRENT_VERSION).

Source

pub fn metadata_version(&self) -> u16

The wire-format version stamped on this metadata. Compare against CURRENT_VERSION on receive to reject peers using an incompatible format.

Source

pub fn timestamp(&self) -> Timestamp

The hybrid-logical-clock timestamp assigned when this message was sent.

Source

pub fn open_telemetry_context(&self) -> String

The serialized OpenTelemetry propagation context carried in the open_telemetry_context parameter, or an empty string if absent.

Trait Implementations§

Source§

impl Clone for Metadata

Source§

fn clone(&self) -> Self

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 Metadata

Source§

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

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

impl<'de> Deserialize<'de> for Metadata

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Metadata

Source§

fn eq(&self, other: &Self) -> 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 Metadata

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 Metadata

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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, 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, !>

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