hds_console_api/generated/
rs.tokio.console.trace.rs1#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct WatchRequest {
5 #[prost(string, tag = "1")]
7 pub filter: ::prost::alloc::string::String,
8}
9#[allow(clippy::derive_partial_eq_without_eq)]
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct TraceEvent {
13 #[prost(oneof = "trace_event::Event", tags = "1, 2, 3, 4, 5, 6")]
15 pub event: ::core::option::Option<trace_event::Event>,
16}
17pub mod trace_event {
19 #[allow(clippy::derive_partial_eq_without_eq)]
21 #[derive(Clone, PartialEq, ::prost::Message)]
22 pub struct RegisterThreads {
23 #[prost(map = "uint64, string", tag = "1")]
25 pub names: ::std::collections::HashMap<u64, ::prost::alloc::string::String>,
26 }
27 #[allow(clippy::derive_partial_eq_without_eq)]
29 #[derive(Clone, PartialEq, ::prost::Message)]
30 pub struct Enter {
31 #[prost(message, optional, tag = "1")]
33 pub span_id: ::core::option::Option<super::super::common::SpanId>,
34 #[prost(uint64, tag = "2")]
36 pub thread_id: u64,
37 #[prost(message, optional, tag = "3")]
39 pub at: ::core::option::Option<::prost_types::Timestamp>,
40 }
41 #[allow(clippy::derive_partial_eq_without_eq)]
43 #[derive(Clone, PartialEq, ::prost::Message)]
44 pub struct Exit {
45 #[prost(message, optional, tag = "1")]
47 pub span_id: ::core::option::Option<super::super::common::SpanId>,
48 #[prost(uint64, tag = "2")]
50 pub thread_id: u64,
51 #[prost(message, optional, tag = "3")]
53 pub at: ::core::option::Option<::prost_types::Timestamp>,
54 }
55 #[allow(clippy::derive_partial_eq_without_eq)]
57 #[derive(Clone, PartialEq, ::prost::Message)]
58 pub struct Close {
59 #[prost(message, optional, tag = "1")]
61 pub span_id: ::core::option::Option<super::super::common::SpanId>,
62 #[prost(message, optional, tag = "2")]
64 pub at: ::core::option::Option<::prost_types::Timestamp>,
65 }
66 #[allow(clippy::derive_partial_eq_without_eq)]
68 #[derive(Clone, PartialEq, ::prost::Oneof)]
69 pub enum Event {
70 #[prost(message, tag = "1")]
72 RegisterThread(RegisterThreads),
73 #[prost(message, tag = "2")]
75 RegisterMetadata(super::super::common::RegisterMetadata),
76 #[prost(message, tag = "3")]
78 NewSpan(super::super::common::Span),
79 #[prost(message, tag = "4")]
81 EnterSpan(Enter),
82 #[prost(message, tag = "5")]
84 ExitSpan(Exit),
85 #[prost(message, tag = "6")]
87 CloseSpan(Close),
88 }
89}
90pub mod trace_client {
92 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
93 use tonic::codegen::*;
94 use tonic::codegen::http::Uri;
95 #[derive(Debug, Clone)]
97 pub struct TraceClient<T> {
98 inner: tonic::client::Grpc<T>,
99 }
100 impl TraceClient<tonic::transport::Channel> {
101 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
103 where
104 D: TryInto<tonic::transport::Endpoint>,
105 D::Error: Into<StdError>,
106 {
107 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
108 Ok(Self::new(conn))
109 }
110 }
111 impl<T> TraceClient<T>
112 where
113 T: tonic::client::GrpcService<tonic::body::BoxBody>,
114 T::Error: Into<StdError>,
115 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
116 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
117 {
118 pub fn new(inner: T) -> Self {
119 let inner = tonic::client::Grpc::new(inner);
120 Self { inner }
121 }
122 pub fn with_origin(inner: T, origin: Uri) -> Self {
123 let inner = tonic::client::Grpc::with_origin(inner, origin);
124 Self { inner }
125 }
126 pub fn with_interceptor<F>(
127 inner: T,
128 interceptor: F,
129 ) -> TraceClient<InterceptedService<T, F>>
130 where
131 F: tonic::service::Interceptor,
132 T::ResponseBody: Default,
133 T: tonic::codegen::Service<
134 http::Request<tonic::body::BoxBody>,
135 Response = http::Response<
136 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
137 >,
138 >,
139 <T as tonic::codegen::Service<
140 http::Request<tonic::body::BoxBody>,
141 >>::Error: Into<StdError> + Send + Sync,
142 {
143 TraceClient::new(InterceptedService::new(inner, interceptor))
144 }
145 #[must_use]
150 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
151 self.inner = self.inner.send_compressed(encoding);
152 self
153 }
154 #[must_use]
156 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
157 self.inner = self.inner.accept_compressed(encoding);
158 self
159 }
160 #[must_use]
164 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
165 self.inner = self.inner.max_decoding_message_size(limit);
166 self
167 }
168 #[must_use]
172 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
173 self.inner = self.inner.max_encoding_message_size(limit);
174 self
175 }
176 pub async fn watch(
178 &mut self,
179 request: impl tonic::IntoRequest<super::WatchRequest>,
180 ) -> std::result::Result<
181 tonic::Response<tonic::codec::Streaming<super::TraceEvent>>,
182 tonic::Status,
183 > {
184 self.inner
185 .ready()
186 .await
187 .map_err(|e| {
188 tonic::Status::new(
189 tonic::Code::Unknown,
190 format!("Service was not ready: {}", e.into()),
191 )
192 })?;
193 let codec = tonic::codec::ProstCodec::default();
194 let path = http::uri::PathAndQuery::from_static(
195 "/rs.tokio.console.trace.Trace/Watch",
196 );
197 let mut req = request.into_request();
198 req.extensions_mut()
199 .insert(GrpcMethod::new("rs.tokio.console.trace.Trace", "Watch"));
200 self.inner.server_streaming(req, path, codec).await
201 }
202 }
203}
204pub mod trace_server {
206 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
207 use tonic::codegen::*;
208 #[async_trait]
210 pub trait Trace: Send + Sync + 'static {
211 type WatchStream: tonic::codegen::tokio_stream::Stream<
213 Item = std::result::Result<super::TraceEvent, tonic::Status>,
214 >
215 + Send
216 + 'static;
217 async fn watch(
219 &self,
220 request: tonic::Request<super::WatchRequest>,
221 ) -> std::result::Result<tonic::Response<Self::WatchStream>, tonic::Status>;
222 }
223 #[derive(Debug)]
225 pub struct TraceServer<T: Trace> {
226 inner: _Inner<T>,
227 accept_compression_encodings: EnabledCompressionEncodings,
228 send_compression_encodings: EnabledCompressionEncodings,
229 max_decoding_message_size: Option<usize>,
230 max_encoding_message_size: Option<usize>,
231 }
232 struct _Inner<T>(Arc<T>);
233 impl<T: Trace> TraceServer<T> {
234 pub fn new(inner: T) -> Self {
235 Self::from_arc(Arc::new(inner))
236 }
237 pub fn from_arc(inner: Arc<T>) -> Self {
238 let inner = _Inner(inner);
239 Self {
240 inner,
241 accept_compression_encodings: Default::default(),
242 send_compression_encodings: Default::default(),
243 max_decoding_message_size: None,
244 max_encoding_message_size: None,
245 }
246 }
247 pub fn with_interceptor<F>(
248 inner: T,
249 interceptor: F,
250 ) -> InterceptedService<Self, F>
251 where
252 F: tonic::service::Interceptor,
253 {
254 InterceptedService::new(Self::new(inner), interceptor)
255 }
256 #[must_use]
258 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
259 self.accept_compression_encodings.enable(encoding);
260 self
261 }
262 #[must_use]
264 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
265 self.send_compression_encodings.enable(encoding);
266 self
267 }
268 #[must_use]
272 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
273 self.max_decoding_message_size = Some(limit);
274 self
275 }
276 #[must_use]
280 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
281 self.max_encoding_message_size = Some(limit);
282 self
283 }
284 }
285 impl<T, B> tonic::codegen::Service<http::Request<B>> for TraceServer<T>
286 where
287 T: Trace,
288 B: Body + Send + 'static,
289 B::Error: Into<StdError> + Send + 'static,
290 {
291 type Response = http::Response<tonic::body::BoxBody>;
292 type Error = std::convert::Infallible;
293 type Future = BoxFuture<Self::Response, Self::Error>;
294 fn poll_ready(
295 &mut self,
296 _cx: &mut Context<'_>,
297 ) -> Poll<std::result::Result<(), Self::Error>> {
298 Poll::Ready(Ok(()))
299 }
300 fn call(&mut self, req: http::Request<B>) -> Self::Future {
301 let inner = self.inner.clone();
302 match req.uri().path() {
303 "/rs.tokio.console.trace.Trace/Watch" => {
304 #[allow(non_camel_case_types)]
305 struct WatchSvc<T: Trace>(pub Arc<T>);
306 impl<
307 T: Trace,
308 > tonic::server::ServerStreamingService<super::WatchRequest>
309 for WatchSvc<T> {
310 type Response = super::TraceEvent;
311 type ResponseStream = T::WatchStream;
312 type Future = BoxFuture<
313 tonic::Response<Self::ResponseStream>,
314 tonic::Status,
315 >;
316 fn call(
317 &mut self,
318 request: tonic::Request<super::WatchRequest>,
319 ) -> Self::Future {
320 let inner = Arc::clone(&self.0);
321 let fut = async move {
322 <T as Trace>::watch(&inner, request).await
323 };
324 Box::pin(fut)
325 }
326 }
327 let accept_compression_encodings = self.accept_compression_encodings;
328 let send_compression_encodings = self.send_compression_encodings;
329 let max_decoding_message_size = self.max_decoding_message_size;
330 let max_encoding_message_size = self.max_encoding_message_size;
331 let inner = self.inner.clone();
332 let fut = async move {
333 let inner = inner.0;
334 let method = WatchSvc(inner);
335 let codec = tonic::codec::ProstCodec::default();
336 let mut grpc = tonic::server::Grpc::new(codec)
337 .apply_compression_config(
338 accept_compression_encodings,
339 send_compression_encodings,
340 )
341 .apply_max_message_size_config(
342 max_decoding_message_size,
343 max_encoding_message_size,
344 );
345 let res = grpc.server_streaming(method, req).await;
346 Ok(res)
347 };
348 Box::pin(fut)
349 }
350 _ => {
351 Box::pin(async move {
352 Ok(
353 http::Response::builder()
354 .status(200)
355 .header("grpc-status", "12")
356 .header("content-type", "application/grpc")
357 .body(empty_body())
358 .unwrap(),
359 )
360 })
361 }
362 }
363 }
364 }
365 impl<T: Trace> Clone for TraceServer<T> {
366 fn clone(&self) -> Self {
367 let inner = self.inner.clone();
368 Self {
369 inner,
370 accept_compression_encodings: self.accept_compression_encodings,
371 send_compression_encodings: self.send_compression_encodings,
372 max_decoding_message_size: self.max_decoding_message_size,
373 max_encoding_message_size: self.max_encoding_message_size,
374 }
375 }
376 }
377 impl<T: Trace> Clone for _Inner<T> {
378 fn clone(&self) -> Self {
379 Self(Arc::clone(&self.0))
380 }
381 }
382 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
383 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
384 write!(f, "{:?}", self.0)
385 }
386 }
387 impl<T: Trace> tonic::server::NamedService for TraceServer<T> {
388 const NAME: &'static str = "rs.tokio.console.trace.Trace";
389 }
390}