1#[allow(clippy::derive_partial_eq_without_eq)]
8#[derive(Clone, PartialEq, ::prost::Message)]
9pub struct InstrumentRequest {}
10#[allow(clippy::derive_partial_eq_without_eq)]
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct TaskDetailsRequest {
15 #[prost(message, optional, tag = "1")]
17 pub id: ::core::option::Option<super::common::Id>,
18}
19#[allow(clippy::derive_partial_eq_without_eq)]
21#[derive(Clone, PartialEq, ::prost::Message)]
22pub struct PauseRequest {}
23#[allow(clippy::derive_partial_eq_without_eq)]
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct ResumeRequest {}
27#[allow(clippy::derive_partial_eq_without_eq)]
36#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct Update {
38 #[prost(message, optional, tag = "1")]
43 pub now: ::core::option::Option<::prost_types::Timestamp>,
44 #[prost(message, optional, tag = "2")]
46 pub task_update: ::core::option::Option<super::tasks::TaskUpdate>,
47 #[prost(message, optional, tag = "3")]
49 pub resource_update: ::core::option::Option<super::resources::ResourceUpdate>,
50 #[prost(message, optional, tag = "4")]
52 pub async_op_update: ::core::option::Option<super::async_ops::AsyncOpUpdate>,
53 #[prost(message, optional, tag = "5")]
55 pub new_metadata: ::core::option::Option<super::common::RegisterMetadata>,
56}
57#[allow(clippy::derive_partial_eq_without_eq)]
59#[derive(Clone, PartialEq, ::prost::Message)]
60pub struct PauseResponse {}
61#[allow(clippy::derive_partial_eq_without_eq)]
63#[derive(Clone, PartialEq, ::prost::Message)]
64pub struct ResumeResponse {}
65pub mod instrument_client {
67 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
68 use tonic::codegen::*;
69 use tonic::codegen::http::Uri;
70 #[derive(Debug, Clone)]
72 pub struct InstrumentClient<T> {
73 inner: tonic::client::Grpc<T>,
74 }
75 impl InstrumentClient<tonic::transport::Channel> {
76 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
78 where
79 D: TryInto<tonic::transport::Endpoint>,
80 D::Error: Into<StdError>,
81 {
82 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
83 Ok(Self::new(conn))
84 }
85 }
86 impl<T> InstrumentClient<T>
87 where
88 T: tonic::client::GrpcService<tonic::body::BoxBody>,
89 T::Error: Into<StdError>,
90 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
91 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
92 {
93 pub fn new(inner: T) -> Self {
94 let inner = tonic::client::Grpc::new(inner);
95 Self { inner }
96 }
97 pub fn with_origin(inner: T, origin: Uri) -> Self {
98 let inner = tonic::client::Grpc::with_origin(inner, origin);
99 Self { inner }
100 }
101 pub fn with_interceptor<F>(
102 inner: T,
103 interceptor: F,
104 ) -> InstrumentClient<InterceptedService<T, F>>
105 where
106 F: tonic::service::Interceptor,
107 T::ResponseBody: Default,
108 T: tonic::codegen::Service<
109 http::Request<tonic::body::BoxBody>,
110 Response = http::Response<
111 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
112 >,
113 >,
114 <T as tonic::codegen::Service<
115 http::Request<tonic::body::BoxBody>,
116 >>::Error: Into<StdError> + Send + Sync,
117 {
118 InstrumentClient::new(InterceptedService::new(inner, interceptor))
119 }
120 #[must_use]
125 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
126 self.inner = self.inner.send_compressed(encoding);
127 self
128 }
129 #[must_use]
131 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
132 self.inner = self.inner.accept_compressed(encoding);
133 self
134 }
135 #[must_use]
139 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
140 self.inner = self.inner.max_decoding_message_size(limit);
141 self
142 }
143 #[must_use]
147 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
148 self.inner = self.inner.max_encoding_message_size(limit);
149 self
150 }
151 pub async fn watch_updates(
153 &mut self,
154 request: impl tonic::IntoRequest<super::InstrumentRequest>,
155 ) -> std::result::Result<
156 tonic::Response<tonic::codec::Streaming<super::Update>>,
157 tonic::Status,
158 > {
159 self.inner
160 .ready()
161 .await
162 .map_err(|e| {
163 tonic::Status::new(
164 tonic::Code::Unknown,
165 format!("Service was not ready: {}", e.into()),
166 )
167 })?;
168 let codec = tonic::codec::ProstCodec::default();
169 let path = http::uri::PathAndQuery::from_static(
170 "/rs.tokio.console.instrument.Instrument/WatchUpdates",
171 );
172 let mut req = request.into_request();
173 req.extensions_mut()
174 .insert(
175 GrpcMethod::new(
176 "rs.tokio.console.instrument.Instrument",
177 "WatchUpdates",
178 ),
179 );
180 self.inner.server_streaming(req, path, codec).await
181 }
182 pub async fn watch_task_details(
184 &mut self,
185 request: impl tonic::IntoRequest<super::TaskDetailsRequest>,
186 ) -> std::result::Result<
187 tonic::Response<tonic::codec::Streaming<super::super::tasks::TaskDetails>>,
188 tonic::Status,
189 > {
190 self.inner
191 .ready()
192 .await
193 .map_err(|e| {
194 tonic::Status::new(
195 tonic::Code::Unknown,
196 format!("Service was not ready: {}", e.into()),
197 )
198 })?;
199 let codec = tonic::codec::ProstCodec::default();
200 let path = http::uri::PathAndQuery::from_static(
201 "/rs.tokio.console.instrument.Instrument/WatchTaskDetails",
202 );
203 let mut req = request.into_request();
204 req.extensions_mut()
205 .insert(
206 GrpcMethod::new(
207 "rs.tokio.console.instrument.Instrument",
208 "WatchTaskDetails",
209 ),
210 );
211 self.inner.server_streaming(req, path, codec).await
212 }
213 pub async fn pause(
215 &mut self,
216 request: impl tonic::IntoRequest<super::PauseRequest>,
217 ) -> std::result::Result<tonic::Response<super::PauseResponse>, tonic::Status> {
218 self.inner
219 .ready()
220 .await
221 .map_err(|e| {
222 tonic::Status::new(
223 tonic::Code::Unknown,
224 format!("Service was not ready: {}", e.into()),
225 )
226 })?;
227 let codec = tonic::codec::ProstCodec::default();
228 let path = http::uri::PathAndQuery::from_static(
229 "/rs.tokio.console.instrument.Instrument/Pause",
230 );
231 let mut req = request.into_request();
232 req.extensions_mut()
233 .insert(
234 GrpcMethod::new("rs.tokio.console.instrument.Instrument", "Pause"),
235 );
236 self.inner.unary(req, path, codec).await
237 }
238 pub async fn resume(
240 &mut self,
241 request: impl tonic::IntoRequest<super::ResumeRequest>,
242 ) -> std::result::Result<tonic::Response<super::ResumeResponse>, tonic::Status> {
243 self.inner
244 .ready()
245 .await
246 .map_err(|e| {
247 tonic::Status::new(
248 tonic::Code::Unknown,
249 format!("Service was not ready: {}", e.into()),
250 )
251 })?;
252 let codec = tonic::codec::ProstCodec::default();
253 let path = http::uri::PathAndQuery::from_static(
254 "/rs.tokio.console.instrument.Instrument/Resume",
255 );
256 let mut req = request.into_request();
257 req.extensions_mut()
258 .insert(
259 GrpcMethod::new("rs.tokio.console.instrument.Instrument", "Resume"),
260 );
261 self.inner.unary(req, path, codec).await
262 }
263 }
264}
265pub mod instrument_server {
267 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
268 use tonic::codegen::*;
269 #[async_trait]
271 pub trait Instrument: Send + Sync + 'static {
272 type WatchUpdatesStream: tonic::codegen::tokio_stream::Stream<
274 Item = std::result::Result<super::Update, tonic::Status>,
275 >
276 + Send
277 + 'static;
278 async fn watch_updates(
280 &self,
281 request: tonic::Request<super::InstrumentRequest>,
282 ) -> std::result::Result<
283 tonic::Response<Self::WatchUpdatesStream>,
284 tonic::Status,
285 >;
286 type WatchTaskDetailsStream: tonic::codegen::tokio_stream::Stream<
288 Item = std::result::Result<
289 super::super::tasks::TaskDetails,
290 tonic::Status,
291 >,
292 >
293 + Send
294 + 'static;
295 async fn watch_task_details(
297 &self,
298 request: tonic::Request<super::TaskDetailsRequest>,
299 ) -> std::result::Result<
300 tonic::Response<Self::WatchTaskDetailsStream>,
301 tonic::Status,
302 >;
303 async fn pause(
305 &self,
306 request: tonic::Request<super::PauseRequest>,
307 ) -> std::result::Result<tonic::Response<super::PauseResponse>, tonic::Status>;
308 async fn resume(
310 &self,
311 request: tonic::Request<super::ResumeRequest>,
312 ) -> std::result::Result<tonic::Response<super::ResumeResponse>, tonic::Status>;
313 }
314 #[derive(Debug)]
316 pub struct InstrumentServer<T: Instrument> {
317 inner: _Inner<T>,
318 accept_compression_encodings: EnabledCompressionEncodings,
319 send_compression_encodings: EnabledCompressionEncodings,
320 max_decoding_message_size: Option<usize>,
321 max_encoding_message_size: Option<usize>,
322 }
323 struct _Inner<T>(Arc<T>);
324 impl<T: Instrument> InstrumentServer<T> {
325 pub fn new(inner: T) -> Self {
326 Self::from_arc(Arc::new(inner))
327 }
328 pub fn from_arc(inner: Arc<T>) -> Self {
329 let inner = _Inner(inner);
330 Self {
331 inner,
332 accept_compression_encodings: Default::default(),
333 send_compression_encodings: Default::default(),
334 max_decoding_message_size: None,
335 max_encoding_message_size: None,
336 }
337 }
338 pub fn with_interceptor<F>(
339 inner: T,
340 interceptor: F,
341 ) -> InterceptedService<Self, F>
342 where
343 F: tonic::service::Interceptor,
344 {
345 InterceptedService::new(Self::new(inner), interceptor)
346 }
347 #[must_use]
349 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
350 self.accept_compression_encodings.enable(encoding);
351 self
352 }
353 #[must_use]
355 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
356 self.send_compression_encodings.enable(encoding);
357 self
358 }
359 #[must_use]
363 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
364 self.max_decoding_message_size = Some(limit);
365 self
366 }
367 #[must_use]
371 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
372 self.max_encoding_message_size = Some(limit);
373 self
374 }
375 }
376 impl<T, B> tonic::codegen::Service<http::Request<B>> for InstrumentServer<T>
377 where
378 T: Instrument,
379 B: Body + Send + 'static,
380 B::Error: Into<StdError> + Send + 'static,
381 {
382 type Response = http::Response<tonic::body::BoxBody>;
383 type Error = std::convert::Infallible;
384 type Future = BoxFuture<Self::Response, Self::Error>;
385 fn poll_ready(
386 &mut self,
387 _cx: &mut Context<'_>,
388 ) -> Poll<std::result::Result<(), Self::Error>> {
389 Poll::Ready(Ok(()))
390 }
391 fn call(&mut self, req: http::Request<B>) -> Self::Future {
392 let inner = self.inner.clone();
393 match req.uri().path() {
394 "/rs.tokio.console.instrument.Instrument/WatchUpdates" => {
395 #[allow(non_camel_case_types)]
396 struct WatchUpdatesSvc<T: Instrument>(pub Arc<T>);
397 impl<
398 T: Instrument,
399 > tonic::server::ServerStreamingService<super::InstrumentRequest>
400 for WatchUpdatesSvc<T> {
401 type Response = super::Update;
402 type ResponseStream = T::WatchUpdatesStream;
403 type Future = BoxFuture<
404 tonic::Response<Self::ResponseStream>,
405 tonic::Status,
406 >;
407 fn call(
408 &mut self,
409 request: tonic::Request<super::InstrumentRequest>,
410 ) -> Self::Future {
411 let inner = Arc::clone(&self.0);
412 let fut = async move {
413 <T as Instrument>::watch_updates(&inner, request).await
414 };
415 Box::pin(fut)
416 }
417 }
418 let accept_compression_encodings = self.accept_compression_encodings;
419 let send_compression_encodings = self.send_compression_encodings;
420 let max_decoding_message_size = self.max_decoding_message_size;
421 let max_encoding_message_size = self.max_encoding_message_size;
422 let inner = self.inner.clone();
423 let fut = async move {
424 let inner = inner.0;
425 let method = WatchUpdatesSvc(inner);
426 let codec = tonic::codec::ProstCodec::default();
427 let mut grpc = tonic::server::Grpc::new(codec)
428 .apply_compression_config(
429 accept_compression_encodings,
430 send_compression_encodings,
431 )
432 .apply_max_message_size_config(
433 max_decoding_message_size,
434 max_encoding_message_size,
435 );
436 let res = grpc.server_streaming(method, req).await;
437 Ok(res)
438 };
439 Box::pin(fut)
440 }
441 "/rs.tokio.console.instrument.Instrument/WatchTaskDetails" => {
442 #[allow(non_camel_case_types)]
443 struct WatchTaskDetailsSvc<T: Instrument>(pub Arc<T>);
444 impl<
445 T: Instrument,
446 > tonic::server::ServerStreamingService<super::TaskDetailsRequest>
447 for WatchTaskDetailsSvc<T> {
448 type Response = super::super::tasks::TaskDetails;
449 type ResponseStream = T::WatchTaskDetailsStream;
450 type Future = BoxFuture<
451 tonic::Response<Self::ResponseStream>,
452 tonic::Status,
453 >;
454 fn call(
455 &mut self,
456 request: tonic::Request<super::TaskDetailsRequest>,
457 ) -> Self::Future {
458 let inner = Arc::clone(&self.0);
459 let fut = async move {
460 <T as Instrument>::watch_task_details(&inner, request).await
461 };
462 Box::pin(fut)
463 }
464 }
465 let accept_compression_encodings = self.accept_compression_encodings;
466 let send_compression_encodings = self.send_compression_encodings;
467 let max_decoding_message_size = self.max_decoding_message_size;
468 let max_encoding_message_size = self.max_encoding_message_size;
469 let inner = self.inner.clone();
470 let fut = async move {
471 let inner = inner.0;
472 let method = WatchTaskDetailsSvc(inner);
473 let codec = tonic::codec::ProstCodec::default();
474 let mut grpc = tonic::server::Grpc::new(codec)
475 .apply_compression_config(
476 accept_compression_encodings,
477 send_compression_encodings,
478 )
479 .apply_max_message_size_config(
480 max_decoding_message_size,
481 max_encoding_message_size,
482 );
483 let res = grpc.server_streaming(method, req).await;
484 Ok(res)
485 };
486 Box::pin(fut)
487 }
488 "/rs.tokio.console.instrument.Instrument/Pause" => {
489 #[allow(non_camel_case_types)]
490 struct PauseSvc<T: Instrument>(pub Arc<T>);
491 impl<T: Instrument> tonic::server::UnaryService<super::PauseRequest>
492 for PauseSvc<T> {
493 type Response = super::PauseResponse;
494 type Future = BoxFuture<
495 tonic::Response<Self::Response>,
496 tonic::Status,
497 >;
498 fn call(
499 &mut self,
500 request: tonic::Request<super::PauseRequest>,
501 ) -> Self::Future {
502 let inner = Arc::clone(&self.0);
503 let fut = async move {
504 <T as Instrument>::pause(&inner, request).await
505 };
506 Box::pin(fut)
507 }
508 }
509 let accept_compression_encodings = self.accept_compression_encodings;
510 let send_compression_encodings = self.send_compression_encodings;
511 let max_decoding_message_size = self.max_decoding_message_size;
512 let max_encoding_message_size = self.max_encoding_message_size;
513 let inner = self.inner.clone();
514 let fut = async move {
515 let inner = inner.0;
516 let method = PauseSvc(inner);
517 let codec = tonic::codec::ProstCodec::default();
518 let mut grpc = tonic::server::Grpc::new(codec)
519 .apply_compression_config(
520 accept_compression_encodings,
521 send_compression_encodings,
522 )
523 .apply_max_message_size_config(
524 max_decoding_message_size,
525 max_encoding_message_size,
526 );
527 let res = grpc.unary(method, req).await;
528 Ok(res)
529 };
530 Box::pin(fut)
531 }
532 "/rs.tokio.console.instrument.Instrument/Resume" => {
533 #[allow(non_camel_case_types)]
534 struct ResumeSvc<T: Instrument>(pub Arc<T>);
535 impl<T: Instrument> tonic::server::UnaryService<super::ResumeRequest>
536 for ResumeSvc<T> {
537 type Response = super::ResumeResponse;
538 type Future = BoxFuture<
539 tonic::Response<Self::Response>,
540 tonic::Status,
541 >;
542 fn call(
543 &mut self,
544 request: tonic::Request<super::ResumeRequest>,
545 ) -> Self::Future {
546 let inner = Arc::clone(&self.0);
547 let fut = async move {
548 <T as Instrument>::resume(&inner, request).await
549 };
550 Box::pin(fut)
551 }
552 }
553 let accept_compression_encodings = self.accept_compression_encodings;
554 let send_compression_encodings = self.send_compression_encodings;
555 let max_decoding_message_size = self.max_decoding_message_size;
556 let max_encoding_message_size = self.max_encoding_message_size;
557 let inner = self.inner.clone();
558 let fut = async move {
559 let inner = inner.0;
560 let method = ResumeSvc(inner);
561 let codec = tonic::codec::ProstCodec::default();
562 let mut grpc = tonic::server::Grpc::new(codec)
563 .apply_compression_config(
564 accept_compression_encodings,
565 send_compression_encodings,
566 )
567 .apply_max_message_size_config(
568 max_decoding_message_size,
569 max_encoding_message_size,
570 );
571 let res = grpc.unary(method, req).await;
572 Ok(res)
573 };
574 Box::pin(fut)
575 }
576 _ => {
577 Box::pin(async move {
578 Ok(
579 http::Response::builder()
580 .status(200)
581 .header("grpc-status", "12")
582 .header("content-type", "application/grpc")
583 .body(empty_body())
584 .unwrap(),
585 )
586 })
587 }
588 }
589 }
590 }
591 impl<T: Instrument> Clone for InstrumentServer<T> {
592 fn clone(&self) -> Self {
593 let inner = self.inner.clone();
594 Self {
595 inner,
596 accept_compression_encodings: self.accept_compression_encodings,
597 send_compression_encodings: self.send_compression_encodings,
598 max_decoding_message_size: self.max_decoding_message_size,
599 max_encoding_message_size: self.max_encoding_message_size,
600 }
601 }
602 }
603 impl<T: Instrument> Clone for _Inner<T> {
604 fn clone(&self) -> Self {
605 Self(Arc::clone(&self.0))
606 }
607 }
608 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
609 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
610 write!(f, "{:?}", self.0)
611 }
612 }
613 impl<T: Instrument> tonic::server::NamedService for InstrumentServer<T> {
614 const NAME: &'static str = "rs.tokio.console.instrument.Instrument";
615 }
616}