1#[derive(Clone, Copy, PartialEq, ::prost::Message)]
9pub struct InstrumentRequest {}
10#[derive(Clone, Copy, PartialEq, ::prost::Message)]
13pub struct TaskDetailsRequest {
14 #[prost(message, optional, tag = "1")]
16 pub id: ::core::option::Option<super::common::Id>,
17}
18#[derive(Clone, Copy, PartialEq, ::prost::Message)]
20pub struct PauseRequest {}
21#[derive(Clone, Copy, PartialEq, ::prost::Message)]
23pub struct ResumeRequest {}
24#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct Update {
34 #[prost(message, optional, tag = "1")]
39 pub now: ::core::option::Option<::prost_types::Timestamp>,
40 #[prost(message, optional, tag = "2")]
42 pub task_update: ::core::option::Option<super::tasks::TaskUpdate>,
43 #[prost(message, optional, tag = "3")]
45 pub resource_update: ::core::option::Option<super::resources::ResourceUpdate>,
46 #[prost(message, optional, tag = "4")]
48 pub async_op_update: ::core::option::Option<super::async_ops::AsyncOpUpdate>,
49 #[prost(message, optional, tag = "5")]
51 pub new_metadata: ::core::option::Option<super::common::RegisterMetadata>,
52}
53#[derive(Clone, Copy, PartialEq, ::prost::Message)]
55pub struct PauseResponse {}
56#[derive(Clone, Copy, PartialEq, ::prost::Message)]
58pub struct ResumeResponse {}
59pub mod instrument_client {
61 #![allow(
62 unused_variables,
63 dead_code,
64 missing_docs,
65 clippy::wildcard_imports,
66 clippy::let_unit_value,
67 )]
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> + std::marker::Send + 'static,
91 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::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> + std::marker::Send + std::marker::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::unknown(
164 format!("Service was not ready: {}", e.into()),
165 )
166 })?;
167 let codec = tonic::codec::ProstCodec::default();
168 let path = http::uri::PathAndQuery::from_static(
169 "/rs.tokio.console.instrument.Instrument/WatchUpdates",
170 );
171 let mut req = request.into_request();
172 req.extensions_mut()
173 .insert(
174 GrpcMethod::new(
175 "rs.tokio.console.instrument.Instrument",
176 "WatchUpdates",
177 ),
178 );
179 self.inner.server_streaming(req, path, codec).await
180 }
181 pub async fn watch_task_details(
183 &mut self,
184 request: impl tonic::IntoRequest<super::TaskDetailsRequest>,
185 ) -> std::result::Result<
186 tonic::Response<tonic::codec::Streaming<super::super::tasks::TaskDetails>>,
187 tonic::Status,
188 > {
189 self.inner
190 .ready()
191 .await
192 .map_err(|e| {
193 tonic::Status::unknown(
194 format!("Service was not ready: {}", e.into()),
195 )
196 })?;
197 let codec = tonic::codec::ProstCodec::default();
198 let path = http::uri::PathAndQuery::from_static(
199 "/rs.tokio.console.instrument.Instrument/WatchTaskDetails",
200 );
201 let mut req = request.into_request();
202 req.extensions_mut()
203 .insert(
204 GrpcMethod::new(
205 "rs.tokio.console.instrument.Instrument",
206 "WatchTaskDetails",
207 ),
208 );
209 self.inner.server_streaming(req, path, codec).await
210 }
211 pub async fn pause(
213 &mut self,
214 request: impl tonic::IntoRequest<super::PauseRequest>,
215 ) -> std::result::Result<tonic::Response<super::PauseResponse>, tonic::Status> {
216 self.inner
217 .ready()
218 .await
219 .map_err(|e| {
220 tonic::Status::unknown(
221 format!("Service was not ready: {}", e.into()),
222 )
223 })?;
224 let codec = tonic::codec::ProstCodec::default();
225 let path = http::uri::PathAndQuery::from_static(
226 "/rs.tokio.console.instrument.Instrument/Pause",
227 );
228 let mut req = request.into_request();
229 req.extensions_mut()
230 .insert(
231 GrpcMethod::new("rs.tokio.console.instrument.Instrument", "Pause"),
232 );
233 self.inner.unary(req, path, codec).await
234 }
235 pub async fn resume(
237 &mut self,
238 request: impl tonic::IntoRequest<super::ResumeRequest>,
239 ) -> std::result::Result<tonic::Response<super::ResumeResponse>, tonic::Status> {
240 self.inner
241 .ready()
242 .await
243 .map_err(|e| {
244 tonic::Status::unknown(
245 format!("Service was not ready: {}", e.into()),
246 )
247 })?;
248 let codec = tonic::codec::ProstCodec::default();
249 let path = http::uri::PathAndQuery::from_static(
250 "/rs.tokio.console.instrument.Instrument/Resume",
251 );
252 let mut req = request.into_request();
253 req.extensions_mut()
254 .insert(
255 GrpcMethod::new("rs.tokio.console.instrument.Instrument", "Resume"),
256 );
257 self.inner.unary(req, path, codec).await
258 }
259 }
260}
261pub mod instrument_server {
263 #![allow(
264 unused_variables,
265 dead_code,
266 missing_docs,
267 clippy::wildcard_imports,
268 clippy::let_unit_value,
269 )]
270 use tonic::codegen::*;
271 #[async_trait]
273 pub trait Instrument: std::marker::Send + std::marker::Sync + 'static {
274 type WatchUpdatesStream: tonic::codegen::tokio_stream::Stream<
276 Item = std::result::Result<super::Update, tonic::Status>,
277 >
278 + std::marker::Send
279 + 'static;
280 async fn watch_updates(
282 &self,
283 request: tonic::Request<super::InstrumentRequest>,
284 ) -> std::result::Result<
285 tonic::Response<Self::WatchUpdatesStream>,
286 tonic::Status,
287 >;
288 type WatchTaskDetailsStream: tonic::codegen::tokio_stream::Stream<
290 Item = std::result::Result<
291 super::super::tasks::TaskDetails,
292 tonic::Status,
293 >,
294 >
295 + std::marker::Send
296 + 'static;
297 async fn watch_task_details(
299 &self,
300 request: tonic::Request<super::TaskDetailsRequest>,
301 ) -> std::result::Result<
302 tonic::Response<Self::WatchTaskDetailsStream>,
303 tonic::Status,
304 >;
305 async fn pause(
307 &self,
308 request: tonic::Request<super::PauseRequest>,
309 ) -> std::result::Result<tonic::Response<super::PauseResponse>, tonic::Status>;
310 async fn resume(
312 &self,
313 request: tonic::Request<super::ResumeRequest>,
314 ) -> std::result::Result<tonic::Response<super::ResumeResponse>, tonic::Status>;
315 }
316 #[derive(Debug)]
318 pub struct InstrumentServer<T> {
319 inner: Arc<T>,
320 accept_compression_encodings: EnabledCompressionEncodings,
321 send_compression_encodings: EnabledCompressionEncodings,
322 max_decoding_message_size: Option<usize>,
323 max_encoding_message_size: Option<usize>,
324 }
325 impl<T> InstrumentServer<T> {
326 pub fn new(inner: T) -> Self {
327 Self::from_arc(Arc::new(inner))
328 }
329 pub fn from_arc(inner: Arc<T>) -> Self {
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 + std::marker::Send + 'static,
380 B::Error: Into<StdError> + std::marker::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 match req.uri().path() {
393 "/rs.tokio.console.instrument.Instrument/WatchUpdates" => {
394 #[allow(non_camel_case_types)]
395 struct WatchUpdatesSvc<T: Instrument>(pub Arc<T>);
396 impl<
397 T: Instrument,
398 > tonic::server::ServerStreamingService<super::InstrumentRequest>
399 for WatchUpdatesSvc<T> {
400 type Response = super::Update;
401 type ResponseStream = T::WatchUpdatesStream;
402 type Future = BoxFuture<
403 tonic::Response<Self::ResponseStream>,
404 tonic::Status,
405 >;
406 fn call(
407 &mut self,
408 request: tonic::Request<super::InstrumentRequest>,
409 ) -> Self::Future {
410 let inner = Arc::clone(&self.0);
411 let fut = async move {
412 <T as Instrument>::watch_updates(&inner, request).await
413 };
414 Box::pin(fut)
415 }
416 }
417 let accept_compression_encodings = self.accept_compression_encodings;
418 let send_compression_encodings = self.send_compression_encodings;
419 let max_decoding_message_size = self.max_decoding_message_size;
420 let max_encoding_message_size = self.max_encoding_message_size;
421 let inner = self.inner.clone();
422 let fut = async move {
423 let method = WatchUpdatesSvc(inner);
424 let codec = tonic::codec::ProstCodec::default();
425 let mut grpc = tonic::server::Grpc::new(codec)
426 .apply_compression_config(
427 accept_compression_encodings,
428 send_compression_encodings,
429 )
430 .apply_max_message_size_config(
431 max_decoding_message_size,
432 max_encoding_message_size,
433 );
434 let res = grpc.server_streaming(method, req).await;
435 Ok(res)
436 };
437 Box::pin(fut)
438 }
439 "/rs.tokio.console.instrument.Instrument/WatchTaskDetails" => {
440 #[allow(non_camel_case_types)]
441 struct WatchTaskDetailsSvc<T: Instrument>(pub Arc<T>);
442 impl<
443 T: Instrument,
444 > tonic::server::ServerStreamingService<super::TaskDetailsRequest>
445 for WatchTaskDetailsSvc<T> {
446 type Response = super::super::tasks::TaskDetails;
447 type ResponseStream = T::WatchTaskDetailsStream;
448 type Future = BoxFuture<
449 tonic::Response<Self::ResponseStream>,
450 tonic::Status,
451 >;
452 fn call(
453 &mut self,
454 request: tonic::Request<super::TaskDetailsRequest>,
455 ) -> Self::Future {
456 let inner = Arc::clone(&self.0);
457 let fut = async move {
458 <T as Instrument>::watch_task_details(&inner, request).await
459 };
460 Box::pin(fut)
461 }
462 }
463 let accept_compression_encodings = self.accept_compression_encodings;
464 let send_compression_encodings = self.send_compression_encodings;
465 let max_decoding_message_size = self.max_decoding_message_size;
466 let max_encoding_message_size = self.max_encoding_message_size;
467 let inner = self.inner.clone();
468 let fut = async move {
469 let method = WatchTaskDetailsSvc(inner);
470 let codec = tonic::codec::ProstCodec::default();
471 let mut grpc = tonic::server::Grpc::new(codec)
472 .apply_compression_config(
473 accept_compression_encodings,
474 send_compression_encodings,
475 )
476 .apply_max_message_size_config(
477 max_decoding_message_size,
478 max_encoding_message_size,
479 );
480 let res = grpc.server_streaming(method, req).await;
481 Ok(res)
482 };
483 Box::pin(fut)
484 }
485 "/rs.tokio.console.instrument.Instrument/Pause" => {
486 #[allow(non_camel_case_types)]
487 struct PauseSvc<T: Instrument>(pub Arc<T>);
488 impl<T: Instrument> tonic::server::UnaryService<super::PauseRequest>
489 for PauseSvc<T> {
490 type Response = super::PauseResponse;
491 type Future = BoxFuture<
492 tonic::Response<Self::Response>,
493 tonic::Status,
494 >;
495 fn call(
496 &mut self,
497 request: tonic::Request<super::PauseRequest>,
498 ) -> Self::Future {
499 let inner = Arc::clone(&self.0);
500 let fut = async move {
501 <T as Instrument>::pause(&inner, request).await
502 };
503 Box::pin(fut)
504 }
505 }
506 let accept_compression_encodings = self.accept_compression_encodings;
507 let send_compression_encodings = self.send_compression_encodings;
508 let max_decoding_message_size = self.max_decoding_message_size;
509 let max_encoding_message_size = self.max_encoding_message_size;
510 let inner = self.inner.clone();
511 let fut = async move {
512 let method = PauseSvc(inner);
513 let codec = tonic::codec::ProstCodec::default();
514 let mut grpc = tonic::server::Grpc::new(codec)
515 .apply_compression_config(
516 accept_compression_encodings,
517 send_compression_encodings,
518 )
519 .apply_max_message_size_config(
520 max_decoding_message_size,
521 max_encoding_message_size,
522 );
523 let res = grpc.unary(method, req).await;
524 Ok(res)
525 };
526 Box::pin(fut)
527 }
528 "/rs.tokio.console.instrument.Instrument/Resume" => {
529 #[allow(non_camel_case_types)]
530 struct ResumeSvc<T: Instrument>(pub Arc<T>);
531 impl<T: Instrument> tonic::server::UnaryService<super::ResumeRequest>
532 for ResumeSvc<T> {
533 type Response = super::ResumeResponse;
534 type Future = BoxFuture<
535 tonic::Response<Self::Response>,
536 tonic::Status,
537 >;
538 fn call(
539 &mut self,
540 request: tonic::Request<super::ResumeRequest>,
541 ) -> Self::Future {
542 let inner = Arc::clone(&self.0);
543 let fut = async move {
544 <T as Instrument>::resume(&inner, request).await
545 };
546 Box::pin(fut)
547 }
548 }
549 let accept_compression_encodings = self.accept_compression_encodings;
550 let send_compression_encodings = self.send_compression_encodings;
551 let max_decoding_message_size = self.max_decoding_message_size;
552 let max_encoding_message_size = self.max_encoding_message_size;
553 let inner = self.inner.clone();
554 let fut = async move {
555 let method = ResumeSvc(inner);
556 let codec = tonic::codec::ProstCodec::default();
557 let mut grpc = tonic::server::Grpc::new(codec)
558 .apply_compression_config(
559 accept_compression_encodings,
560 send_compression_encodings,
561 )
562 .apply_max_message_size_config(
563 max_decoding_message_size,
564 max_encoding_message_size,
565 );
566 let res = grpc.unary(method, req).await;
567 Ok(res)
568 };
569 Box::pin(fut)
570 }
571 _ => {
572 Box::pin(async move {
573 let mut response = http::Response::new(empty_body());
574 let headers = response.headers_mut();
575 headers
576 .insert(
577 tonic::Status::GRPC_STATUS,
578 (tonic::Code::Unimplemented as i32).into(),
579 );
580 headers
581 .insert(
582 http::header::CONTENT_TYPE,
583 tonic::metadata::GRPC_CONTENT_TYPE,
584 );
585 Ok(response)
586 })
587 }
588 }
589 }
590 }
591 impl<T> 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 pub const SERVICE_NAME: &str = "rs.tokio.console.instrument.Instrument";
605 impl<T> tonic::server::NamedService for InstrumentServer<T> {
606 const NAME: &'static str = SERVICE_NAME;
607 }
608}