use crate::stats; use console_api::resources; use std::sync::Arc; use tracing::span; use tracing_core::Metadata; pub(crate) enum Event { Metadata(&'static Metadata<'static>), Spawn { id: span::Id, metadata: &'static Metadata<'static>, stats: Arc, fields: Vec, location: Option, }, Resource { id: span::Id, parent_id: Option, metadata: &'static Metadata<'static>, concrete_type: String, kind: resources::resource::Kind, location: Option, is_internal: bool, stats: Arc, }, PollOp { metadata: &'static Metadata<'static>, resource_id: span::Id, op_name: String, async_op_id: span::Id, task_id: span::Id, is_ready: bool, }, AsyncResourceOp { id: span::Id, parent_id: Option, resource_id: span::Id, metadata: &'static Metadata<'static>, source: String, stats: Arc, }, } #[derive(Clone, Debug, Copy)] pub(crate) enum WakeOp { Wake { self_wake: bool }, WakeByRef { self_wake: bool }, Clone, Drop, } impl WakeOp { /// Returns `true` if `self` is a `Wake` or `WakeByRef` event. pub(crate) fn is_wake(self) -> bool { matches!(self, Self::Wake { .. } | Self::WakeByRef { .. }) } pub(crate) fn self_wake(self, self_wake: bool) -> Self { match self { Self::Wake { .. } => Self::Wake { self_wake }, Self::WakeByRef { .. } => Self::WakeByRef { self_wake }, x => x, } } }