hds_console_api/generated/
rs.tokio.console.resources.rs

1/// A resource state update.
2///
3/// Each `ResourceUpdate` contains any resource data that has changed since the last
4/// update. This includes:
5/// - any new resources that were created since the last update
6/// - the current stats for any resource whose stats changed since the last update
7/// - any new poll ops that have been invoked on a resource
8#[allow(clippy::derive_partial_eq_without_eq)]
9#[derive(Clone, PartialEq, ::prost::Message)]
10pub struct ResourceUpdate {
11    /// A list of new resources that were created since the last `ResourceUpdate` was
12    /// sent.
13    #[prost(message, repeated, tag = "1")]
14    pub new_resources: ::prost::alloc::vec::Vec<Resource>,
15    /// Any resource stats that have changed since the last update.
16    #[prost(map = "uint64, message", tag = "2")]
17    pub stats_update: ::std::collections::HashMap<u64, Stats>,
18    /// A list of all new poll ops that have been invoked on resources since the last update.
19    #[prost(message, repeated, tag = "3")]
20    pub new_poll_ops: ::prost::alloc::vec::Vec<PollOp>,
21    /// A count of how many resource events (e.g. polls, creation, etc) were not
22    /// recorded because the application's event buffer was at capacity.
23    ///
24    /// If everything is working normally, this should be 0. If it is greater
25    /// than 0, that may indicate that some data is missing from this update, and
26    /// it may be necessary to increase the number of events buffered by the
27    /// application to ensure that data loss is avoided.
28    ///
29    /// If the application's instrumentation ensures reliable delivery of events,
30    /// this will always be 0.
31    #[prost(uint64, tag = "4")]
32    pub dropped_events: u64,
33}
34/// Static data recorded when a new resource is created.
35#[allow(clippy::derive_partial_eq_without_eq)]
36#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct Resource {
38    /// The resources's ID.
39    ///
40    /// This uniquely identifies this resource across all *currently live*
41    /// resources. This is also the primary way any operations on a resource
42    /// are associated with it
43    #[prost(message, optional, tag = "1")]
44    pub id: ::core::option::Option<super::common::Id>,
45    /// The numeric ID of the resources's `Metadata`.
46    #[prost(message, optional, tag = "2")]
47    pub metadata: ::core::option::Option<super::common::MetaId>,
48    /// The resources's concrete rust type.
49    #[prost(string, tag = "3")]
50    pub concrete_type: ::prost::alloc::string::String,
51    /// The kind of resource (e.g timer, mutex)
52    #[prost(message, optional, tag = "4")]
53    pub kind: ::core::option::Option<resource::Kind>,
54    /// The location in code where the resource was created.
55    #[prost(message, optional, tag = "5")]
56    pub location: ::core::option::Option<super::common::Location>,
57    /// The ID of the parent resource.
58    #[prost(message, optional, tag = "6")]
59    pub parent_resource_id: ::core::option::Option<super::common::Id>,
60    /// Is the resource an internal component of another resource?
61    ///
62    /// For example, a `tokio::time::Interval` resource might contain a
63    /// `tokio::time::Sleep` resource internally.
64    #[prost(bool, tag = "7")]
65    pub is_internal: bool,
66}
67/// Nested message and enum types in `Resource`.
68pub mod resource {
69    /// The kind of resource (e.g. timer, mutex).
70    #[allow(clippy::derive_partial_eq_without_eq)]
71    #[derive(Clone, PartialEq, ::prost::Message)]
72    pub struct Kind {
73        /// Every resource is either a known kind or an other (unknown) kind.
74        #[prost(oneof = "kind::Kind", tags = "1, 2")]
75        pub kind: ::core::option::Option<kind::Kind>,
76    }
77    /// Nested message and enum types in `Kind`.
78    pub mod kind {
79        /// `Known` collects the kinds of resources that are known in this version of the API.
80        #[derive(
81            Clone,
82            Copy,
83            Debug,
84            PartialEq,
85            Eq,
86            Hash,
87            PartialOrd,
88            Ord,
89            ::prost::Enumeration
90        )]
91        #[repr(i32)]
92        pub enum Known {
93            /// `TIMER` signals that this is a timer resource, e.g. waiting for a sleep to finish.
94            Timer = 0,
95        }
96        impl Known {
97            /// String value of the enum field names used in the ProtoBuf definition.
98            ///
99            /// The values are not transformed in any way and thus are considered stable
100            /// (if the ProtoBuf definition does not change) and safe for programmatic use.
101            pub fn as_str_name(&self) -> &'static str {
102                match self {
103                    Known::Timer => "TIMER",
104                }
105            }
106            /// Creates an enum from field names used in the ProtoBuf definition.
107            pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
108                match value {
109                    "TIMER" => Some(Self::Timer),
110                    _ => None,
111                }
112            }
113        }
114        /// Every resource is either a known kind or an other (unknown) kind.
115        #[allow(clippy::derive_partial_eq_without_eq)]
116        #[derive(Clone, PartialEq, ::prost::Oneof)]
117        pub enum Kind {
118            /// `known` signals that this kind of resource is known to the console API.
119            #[prost(enumeration = "Known", tag = "1")]
120            Known(i32),
121            /// `other` signals that this kind of resource is unknown to the console API.
122            #[prost(string, tag = "2")]
123            Other(::prost::alloc::string::String),
124        }
125    }
126}
127/// Task runtime stats of a resource.
128#[allow(clippy::derive_partial_eq_without_eq)]
129#[derive(Clone, PartialEq, ::prost::Message)]
130pub struct Stats {
131    /// Timestamp of when the resource was created.
132    #[prost(message, optional, tag = "1")]
133    pub created_at: ::core::option::Option<::prost_types::Timestamp>,
134    /// Timestamp of when the resource was dropped.
135    #[prost(message, optional, tag = "2")]
136    pub dropped_at: ::core::option::Option<::prost_types::Timestamp>,
137    /// State attributes of the resource. These are dependent on the type of the resource.
138    /// For example, a timer resource will have a duration while a semaphore resource may
139    /// have permits as an attribute. These values may change over time as the state of
140    /// the resource changes. Therefore, they live in the runtime stats rather than the
141    /// static data describing the resource.
142    #[prost(message, repeated, tag = "3")]
143    pub attributes: ::prost::alloc::vec::Vec<super::common::Attribute>,
144}
145/// A `PollOp` describes each poll operation that completes within the async
146/// application.
147#[allow(clippy::derive_partial_eq_without_eq)]
148#[derive(Clone, PartialEq, ::prost::Message)]
149pub struct PollOp {
150    /// The numeric ID of the op's `Metadata`.
151    ///
152    /// This identifies the `Metadata` that describes the `tracing` span
153    /// corresponding to this op. The metadata for this ID will have been sent
154    /// in a prior `RegisterMetadata` message.
155    #[prost(message, optional, tag = "2")]
156    pub metadata: ::core::option::Option<super::common::MetaId>,
157    /// The resources's ID.
158    #[prost(message, optional, tag = "3")]
159    pub resource_id: ::core::option::Option<super::common::Id>,
160    /// the name of this op (e.g. poll_elapsed, new_timeout, reset, etc.)
161    #[prost(string, tag = "4")]
162    pub name: ::prost::alloc::string::String,
163    /// Identifies the task context that this poll op has been called from.
164    #[prost(message, optional, tag = "5")]
165    pub task_id: ::core::option::Option<super::common::Id>,
166    /// Identifies the async op ID that this poll op is part of.
167    #[prost(message, optional, tag = "6")]
168    pub async_op_id: ::core::option::Option<super::common::Id>,
169    /// Whether this poll op has returned with ready or pending.
170    #[prost(bool, tag = "7")]
171    pub is_ready: bool,
172}