#[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
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
reason: DisconnectReasonStructured reason for disconnection.
connection_duration_ms: Option<u64>How long the connection was open before disconnecting (milliseconds). None if duration tracking is unavailable.
Timeout
A transaction timed out without completing.
Fields
id: TransactionThe transaction that timed out.
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
impl EventKind
Sourcepub fn contract_key(&self) -> Option<ContractKey>
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.
Sourcepub fn state_hash(&self) -> Option<&str>
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.
Sourcepub fn stored_state_hash(&self) -> Option<&str>
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.
Sourcepub fn is_update_broadcast_emitted(&self) -> bool
pub fn is_update_broadcast_emitted(&self) -> bool
Returns true if this is an Update BroadcastEmitted event.
Sourcepub fn router_snapshot_summary(&self) -> Option<(usize, usize, bool)>
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.
Sourcepub fn route_outcome_is_success(&self) -> Option<bool>
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.
Sourcepub fn get_outcome(&self) -> Option<bool>
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).
Sourcepub fn get_elapsed_ms(&self) -> Option<u64>
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.
Sourcepub fn is_forwarding_ack_received(&self) -> bool
pub fn is_forwarding_ack_received(&self) -> bool
Returns true if this is a ForwardingAck received event.
Sourcepub fn is_get_response_sent(&self) -> bool
pub fn is_get_response_sent(&self) -> bool
Returns true if this is a GET response sent event (contract found and response dispatched).
Sourcepub fn is_connect_rejected(&self) -> bool
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.
Sourcepub fn is_get_request(&self) -> bool
pub fn is_get_request(&self) -> bool
Returns true if this is a GET request event.
Sourcepub fn get_request_htl(&self) -> Option<usize>
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).
Sourcepub fn subscribe_outcome(&self) -> Option<bool>
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).
Sourcepub fn is_update_broadcast_received(&self) -> bool
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.
Sourcepub fn is_connect(&self) -> bool
pub fn is_connect(&self) -> bool
Returns true if this is a Connect event.
Sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Returns true if this is a Disconnected event.
Sourcepub fn is_connect_accepted(&self) -> bool
pub fn is_connect_accepted(&self) -> bool
Returns true if this is a ConnectEvent::RequestReceived where accepted=true.
Sourcepub fn is_connect_not_accepted(&self) -> bool
pub fn is_connect_not_accepted(&self) -> bool
Returns true if this is a ConnectEvent::RequestReceived where accepted=false.
Sourcepub fn is_connect_connected(&self) -> bool
pub fn is_connect_connected(&self) -> bool
Returns true if this is a ConnectEvent::Connected.
Sourcepub fn is_connect_initiated(&self) -> bool
pub fn is_connect_initiated(&self) -> bool
Returns true if this is a ConnectEvent::RequestSent with is_initial=true.
Sourcepub fn is_connect_terminus_accepted(&self) -> bool
pub fn is_connect_terminus_accepted(&self) -> bool
Returns true if this is a terminus acceptance (accepted=true, forwarded_to=None).
Sourcepub fn is_connect_terminus_rejected(&self) -> bool
pub fn is_connect_terminus_rejected(&self) -> bool
Returns true if this is a terminus rejection (accepted=false, forwarded_to=None).
Sourcepub fn is_connect_forwarded(&self) -> bool
pub fn is_connect_forwarded(&self) -> bool
Returns true if this is a forwarded request (forwarded_to=Some).
Sourcepub fn connect_peer_connection_count(&self) -> Option<usize>
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.
Sourcepub fn unsubscribe_received_instance_id(&self) -> Option<&ContractInstanceId>
pub fn unsubscribe_received_instance_id(&self) -> Option<&ContractInstanceId>
Returns the contract instance id if this is an UnsubscribeReceived event.
Sourcepub fn unsubscribe_sent_instance_id(&self) -> Option<&ContractInstanceId>
pub fn unsubscribe_sent_instance_id(&self) -> Option<&ContractInstanceId>
Returns the contract instance id if this is an UnsubscribeSent event.
Sourcepub fn hop_count(&self) -> Option<usize>
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.
Sourcepub fn variant_name(&self) -> &'static str
pub fn variant_name(&self) -> &'static str
Returns the variant name of this event kind.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EventKind
impl<'de> Deserialize<'de> for EventKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for EventKind
impl RefUnwindSafe for EventKind
impl Send for EventKind
impl Sync for EventKind
impl Unpin for EventKind
impl UnsafeUnpin for EventKind
impl UnwindSafe for EventKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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