@@ -50,12 +50,50 @@ pub struct Update {
50
50
#[ prost( message, optional, tag = "5" ) ]
51
51
pub new_metadata : :: core:: option:: Option < super :: common:: RegisterMetadata > ,
52
52
}
53
+ /// StateRequest requests the current state of the aggregator.
54
+ #[ derive( Clone , Copy , PartialEq , :: prost:: Message ) ]
55
+ pub struct StateRequest { }
56
+ /// State carries the current state of the aggregator.
57
+ #[ derive( Clone , Copy , PartialEq , :: prost:: Message ) ]
58
+ pub struct State {
59
+ #[ prost( enumeration = "Temporality" , tag = "1" ) ]
60
+ pub temporality : i32 ,
61
+ }
53
62
/// `PauseResponse` is the value returned after a pause request.
54
63
#[ derive( Clone , Copy , PartialEq , :: prost:: Message ) ]
55
64
pub struct PauseResponse { }
56
65
/// `ResumeResponse` is the value returned after a resume request.
57
66
#[ derive( Clone , Copy , PartialEq , :: prost:: Message ) ]
58
67
pub struct ResumeResponse { }
68
+ /// The time "state" of the aggregator.
69
+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , PartialOrd , Ord , :: prost:: Enumeration ) ]
70
+ #[ repr( i32 ) ]
71
+ pub enum Temporality {
72
+ /// The aggregator is currently live.
73
+ Live = 0 ,
74
+ /// The aggregator is currently paused.
75
+ Paused = 1 ,
76
+ }
77
+ impl Temporality {
78
+ /// String value of the enum field names used in the ProtoBuf definition.
79
+ ///
80
+ /// The values are not transformed in any way and thus are considered stable
81
+ /// (if the ProtoBuf definition does not change) and safe for programmatic use.
82
+ pub fn as_str_name ( & self ) -> & ' static str {
83
+ match self {
84
+ Self :: Live => "LIVE" ,
85
+ Self :: Paused => "PAUSED" ,
86
+ }
87
+ }
88
+ /// Creates an enum from field names used in the ProtoBuf definition.
89
+ pub fn from_str_name ( value : & str ) -> :: core:: option:: Option < Self > {
90
+ match value {
91
+ "LIVE" => Some ( Self :: Live ) ,
92
+ "PAUSED" => Some ( Self :: Paused ) ,
93
+ _ => None ,
94
+ }
95
+ }
96
+ }
59
97
/// Generated client implementations.
60
98
pub mod instrument_client {
61
99
#![ allow(
@@ -208,6 +246,36 @@ pub mod instrument_client {
208
246
) ;
209
247
self . inner . server_streaming ( req, path, codec) . await
210
248
}
249
+ /// Produces a stream of state of the aggregator.
250
+ pub async fn watch_state (
251
+ & mut self ,
252
+ request : impl tonic:: IntoRequest < super :: StateRequest > ,
253
+ ) -> std:: result:: Result <
254
+ tonic:: Response < tonic:: codec:: Streaming < super :: State > > ,
255
+ tonic:: Status ,
256
+ > {
257
+ self . inner
258
+ . ready ( )
259
+ . await
260
+ . map_err ( |e| {
261
+ tonic:: Status :: unknown (
262
+ format ! ( "Service was not ready: {}" , e. into( ) ) ,
263
+ )
264
+ } ) ?;
265
+ let codec = tonic:: codec:: ProstCodec :: default ( ) ;
266
+ let path = http:: uri:: PathAndQuery :: from_static (
267
+ "/rs.tokio.console.instrument.Instrument/WatchState" ,
268
+ ) ;
269
+ let mut req = request. into_request ( ) ;
270
+ req. extensions_mut ( )
271
+ . insert (
272
+ GrpcMethod :: new (
273
+ "rs.tokio.console.instrument.Instrument" ,
274
+ "WatchState" ,
275
+ ) ,
276
+ ) ;
277
+ self . inner . server_streaming ( req, path, codec) . await
278
+ }
211
279
/// Registers that the console observer wants to pause the stream.
212
280
pub async fn pause (
213
281
& mut self ,
@@ -302,6 +370,17 @@ pub mod instrument_server {
302
370
tonic:: Response < Self :: WatchTaskDetailsStream > ,
303
371
tonic:: Status ,
304
372
> ;
373
+ /// Server streaming response type for the WatchState method.
374
+ type WatchStateStream : tonic:: codegen:: tokio_stream:: Stream <
375
+ Item = std:: result:: Result < super :: State , tonic:: Status > ,
376
+ >
377
+ + std:: marker:: Send
378
+ + ' static ;
379
+ /// Produces a stream of state of the aggregator.
380
+ async fn watch_state (
381
+ & self ,
382
+ request : tonic:: Request < super :: StateRequest > ,
383
+ ) -> std:: result:: Result < tonic:: Response < Self :: WatchStateStream > , tonic:: Status > ;
305
384
/// Registers that the console observer wants to pause the stream.
306
385
async fn pause (
307
386
& self ,
@@ -482,6 +561,52 @@ pub mod instrument_server {
482
561
} ;
483
562
Box :: pin ( fut)
484
563
}
564
+ "/rs.tokio.console.instrument.Instrument/WatchState" => {
565
+ #[ allow( non_camel_case_types) ]
566
+ struct WatchStateSvc < T : Instrument > ( pub Arc < T > ) ;
567
+ impl <
568
+ T : Instrument ,
569
+ > tonic:: server:: ServerStreamingService < super :: StateRequest >
570
+ for WatchStateSvc < T > {
571
+ type Response = super :: State ;
572
+ type ResponseStream = T :: WatchStateStream ;
573
+ type Future = BoxFuture <
574
+ tonic:: Response < Self :: ResponseStream > ,
575
+ tonic:: Status ,
576
+ > ;
577
+ fn call (
578
+ & mut self ,
579
+ request : tonic:: Request < super :: StateRequest > ,
580
+ ) -> Self :: Future {
581
+ let inner = Arc :: clone ( & self . 0 ) ;
582
+ let fut = async move {
583
+ <T as Instrument >:: watch_state ( & inner, request) . await
584
+ } ;
585
+ Box :: pin ( fut)
586
+ }
587
+ }
588
+ let accept_compression_encodings = self . accept_compression_encodings ;
589
+ let send_compression_encodings = self . send_compression_encodings ;
590
+ let max_decoding_message_size = self . max_decoding_message_size ;
591
+ let max_encoding_message_size = self . max_encoding_message_size ;
592
+ let inner = self . inner . clone ( ) ;
593
+ let fut = async move {
594
+ let method = WatchStateSvc ( inner) ;
595
+ let codec = tonic:: codec:: ProstCodec :: default ( ) ;
596
+ let mut grpc = tonic:: server:: Grpc :: new ( codec)
597
+ . apply_compression_config (
598
+ accept_compression_encodings,
599
+ send_compression_encodings,
600
+ )
601
+ . apply_max_message_size_config (
602
+ max_decoding_message_size,
603
+ max_encoding_message_size,
604
+ ) ;
605
+ let res = grpc. server_streaming ( method, req) . await ;
606
+ Ok ( res)
607
+ } ;
608
+ Box :: pin ( fut)
609
+ }
485
610
"/rs.tokio.console.instrument.Instrument/Pause" => {
486
611
#[ allow( non_camel_case_types) ]
487
612
struct PauseSvc < T : Instrument > ( pub Arc < T > ) ;
0 commit comments