console_api/generated/
rs.tokio.console.resources.rs

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