Skip to main content

EventKind

Enum EventKind 

Source
#[non_exhaustive]
pub enum EventKind {
Show 15 variants Connect(ConnectEvent), Put(PutEvent), Get(GetEvent), Subscribe(SubscribeEvent), Route(RouteEvent), Update(UpdateEvent), Transfer(TransferEvent), Lifecycle(PeerLifecycleEvent), Ignored, Disconnected { from: PeerId, reason: DisconnectReason, connection_duration_ms: Option<u64>, bytes_sent: Option<u64>, bytes_received: Option<u64>, }, Timeout { id: Transaction, timestamp: u64, op_type: String, target_peer: Option<String>, }, TransportSnapshot(TransportSnapshot), InterestSync(InterestSyncEvent), RoutingDecision(RoutingDecisionInfo), RouterSnapshot(Box<RouterSnapshotInfo>),
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Connect(ConnectEvent)

§

Put(PutEvent)

§

Get(GetEvent)

§

Subscribe(SubscribeEvent)

§

Route(RouteEvent)

§

Update(UpdateEvent)

§

Transfer(TransferEvent)

Data transfer events for stream-level transfers.

§

Lifecycle(PeerLifecycleEvent)

Peer lifecycle events (startup, shutdown).

§

Ignored

§

Disconnected

Fields

§from: PeerId
§reason: DisconnectReason

Structured reason for disconnection.

§connection_duration_ms: Option<u64>

How long the connection was open before disconnecting (milliseconds). None if duration tracking is unavailable.

§bytes_sent: Option<u64>

Bytes sent to this peer during the connection. None if byte tracking is unavailable.

§bytes_received: Option<u64>

Bytes received from this peer during the connection. None if byte tracking is unavailable.

§

Timeout

A transaction timed out without completing.

Fields

§id: Transaction

The transaction that timed out.

§timestamp: u64
§op_type: String

The operation type (e.g. “connect”, “put”, “get”, “subscribe”, “update”).

§target_peer: Option<String>

The target peer for the operation, if known from routing info.

§

TransportSnapshot(TransportSnapshot)

Periodic transport layer metrics snapshot.

Emitted every N seconds (default 30s) with aggregate transport statistics. This is more efficient than per-transfer events and provides trend data.

§

InterestSync(InterestSyncEvent)

Interest sync events for delta-based state synchronization.

Tracks ResyncRequests and ResyncResponses which indicate delta application failures. Useful for monitoring the health of the delta sync protocol.

§

RoutingDecision(RoutingDecisionInfo)

A routing decision snapshot: which peers were considered and why one was selected.

Currently emitted via tracing::debug! at call sites (sync context prevents async event registration). This variant is available for future async callers that want to emit routing decisions through OTLP with sampling.

§

RouterSnapshot(Box<RouterSnapshotInfo>)

Periodic snapshot of the router model (isotonic regression curves, event counts).

Boxed because RouterSnapshotInfo is by far the largest EventKind payload (regression curves + per-op maps + the #4440 node-health gauges); inlining it would bloat every other variant (clippy::large_enum_variant). Box serializes transparently, so the AOF/OTLP wire format is unchanged.

Implementations§

Source§

impl EventKind

Source

pub fn contract_key(&self) -> Option<ContractKey>

Extracts the contract key from this event, if applicable.

Returns the key for Put, Get, Subscribe, and Update events.

Source

pub fn state_hash(&self) -> Option<&str>

Extracts the state hash from this event, if applicable.

Returns the hash for Put and Update success/broadcast events.

Source

pub fn stored_state_hash(&self) -> Option<&str>

Returns the state hash only for events representing stored state changes.

This is critical for convergence checking - it only returns hashes for events where state was actually stored locally:

  • PutSuccess: State was stored after PUT operation
  • UpdateSuccess: State was updated locally
  • BroadcastApplied: State was stored after applying received broadcast

Does NOT return hashes for:

  • BroadcastReceived: Incoming state that may not have been applied yet
  • BroadcastEmitted: Outgoing state being sent to others

Using state_hash() for convergence checking would include BroadcastReceived events, which record the incoming state hash before application, not the actual stored state after merge/application.

Source

pub fn is_update_broadcast_emitted(&self) -> bool

Returns true if this is an Update BroadcastEmitted event.

Source

pub fn router_snapshot_summary(&self) -> Option<(usize, usize, bool)>

Returns router snapshot summary data for RouterSnapshot events.

Returns (failure_events, success_events, prediction_active). failure_events counts all events in the failure estimator (successes scored 0.0, failures scored 1.0). success_events counts only timed GET successes. prediction_active is true when failure_events >= 50.

Source

pub fn route_outcome_is_success(&self) -> Option<bool>

Returns whether this is a route outcome event, and if so, whether it succeeded.

Returns Some(true) for RouteOutcome::Success or SuccessUntimed, Some(false) for RouteOutcome::Failure, None for non-Route events.

Source

pub fn get_outcome(&self) -> Option<bool>

Returns the outcome of a GET operation event.

Returns Some(true) for GetSuccess, Some(false) for GetNotFound or GetFailure, None for all other events (including GET requests and responses).

Source

pub fn get_elapsed_ms(&self) -> Option<u64>

Returns the elapsed time in milliseconds for a completed GET operation.

Returns Some(ms) for GetSuccess, GetNotFound, or GetFailure, None for all other events.

Source

pub fn is_forwarding_ack_received(&self) -> bool

Returns true if this is a ForwardingAck received event.

Source

pub fn is_get_response_sent(&self) -> bool

Returns true if this is a GET response sent event (contract found and response dispatched).

Source

pub fn is_connect_rejected(&self) -> bool

Returns true if this is a CONNECT rejected event (a peer sent a Rejected upstream for a connect request).

Used by the bootstrap-acceptance regression test (#4362) to count how many connect attempts were terminus-rejected during a cold-start sim.

Source

pub fn is_get_request(&self) -> bool

Returns true if this is a GET request event.

Source

pub fn get_request_htl(&self) -> Option<usize>

Returns the HTL carried by a GET request event, None for all other events.

Useful for distinguishing originator-side dispatch from relay hops in test analysis: the client driver’s loopback Request is registered at the originating node with htl == max_hops_to_live, while every relay-received Request has already been decremented (#4361 — dispatched-vs-scheduled accounting).

Source

pub fn subscribe_outcome(&self) -> Option<bool>

Returns whether this is a subscribe outcome event (success or failure).

Returns Some(true) for SubscribeSuccess, Some(false) for the failure outcomes SubscribeNotFound and SubscribeTimeout (#3445), None for all other events (including subscribe requests/responses).

Source

pub fn is_update_broadcast_received(&self) -> bool

Returns true if this event is an update broadcast received by a peer.

Matches UpdateEvent::BroadcastReceived — the moment a peer receives an update broadcast (before application). Used to verify that subscription interest is maintained across lease cycles.

Source

pub fn is_connect(&self) -> bool

Returns true if this is a Connect event.

Source

pub fn is_disconnected(&self) -> bool

Returns true if this is a Disconnected event.

Source

pub fn is_connect_accepted(&self) -> bool

Returns true if this is a ConnectEvent::RequestReceived where accepted=true.

Source

pub fn is_connect_not_accepted(&self) -> bool

Returns true if this is a ConnectEvent::RequestReceived where accepted=false.

Source

pub fn is_connect_connected(&self) -> bool

Returns true if this is a ConnectEvent::Connected.

Source

pub fn is_connect_initiated(&self) -> bool

Returns true if this is a ConnectEvent::RequestSent with is_initial=true.

Source

pub fn is_connect_terminus_accepted(&self) -> bool

Returns true if this is a terminus acceptance (accepted=true, forwarded_to=None).

Source

pub fn is_connect_terminus_rejected(&self) -> bool

Returns true if this is a terminus rejection (accepted=false, forwarded_to=None).

Source

pub fn is_connect_forwarded(&self) -> bool

Returns true if this is a forwarded request (forwarded_to=Some).

Source

pub fn connect_peer_connection_count(&self) -> Option<usize>

Returns the open-connection count a peer had immediately after a ConnectEvent::Connected event (this_peer_connection_count), None for all other events.

Used by the bootstrap-acceptance regression test (#4362) to chart how quickly nodes climb toward min_connections during cold start.

Source

pub fn unsubscribe_received_instance_id(&self) -> Option<&ContractInstanceId>

Returns the contract instance id if this is an UnsubscribeReceived event.

Source

pub fn unsubscribe_sent_instance_id(&self) -> Option<&ContractInstanceId>

Returns the contract instance id if this is an UnsubscribeSent event.

Source

pub fn hop_count(&self) -> Option<usize>

Returns the hop_count recorded in this event, if any.

Populated for terminal GET events (GetSuccess, GetNotFound, GetFailure) since PR #4245, and for terminal PUT/SUBSCRIBE events (PutSuccess, SubscribeSuccess, SubscribeNotFound) since PR #4248. The value is the number of forward hops the originating request traversed before reaching its terminal state. Returns None for non-terminal events (e.g. Request) and for events that don’t carry a hop_count field.

Source

pub fn variant_name(&self) -> &'static str

Returns the variant name of this event kind.

Trait Implementations§

Source§

impl Clone for EventKind

Source§

fn clone(&self) -> EventKind

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 EventKind

Source§

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

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

impl<'de> Deserialize<'de> for EventKind

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 Serialize for EventKind

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

Auto Trait Implementations§

Blanket Implementations§

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> 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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = Infallible

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