xds_api/generated/
envoy.service.trace.v3.rs

1// This file is @generated by prost-build.
2#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3pub struct StreamTracesResponse {}
4impl ::prost::Name for StreamTracesResponse {
5    const NAME: &'static str = "StreamTracesResponse";
6    const PACKAGE: &'static str = "envoy.service.trace.v3";
7    fn full_name() -> ::prost::alloc::string::String {
8        "envoy.service.trace.v3.StreamTracesResponse".into()
9    }
10    fn type_url() -> ::prost::alloc::string::String {
11        "type.googleapis.com/envoy.service.trace.v3.StreamTracesResponse".into()
12    }
13}
14#[derive(Clone, PartialEq, ::prost::Message)]
15pub struct StreamTracesMessage {
16    /// Identifier data effectively is a structured metadata.
17    /// As a performance optimization this will only be sent in the first message
18    /// on the stream.
19    #[prost(message, optional, tag = "1")]
20    pub identifier: ::core::option::Option<stream_traces_message::Identifier>,
21    /// A list of Span entries
22    #[prost(message, repeated, tag = "2")]
23    pub spans: ::prost::alloc::vec::Vec<
24        super::super::super::super::opencensus::proto::trace::v1::Span,
25    >,
26}
27/// Nested message and enum types in `StreamTracesMessage`.
28pub mod stream_traces_message {
29    #[derive(Clone, PartialEq, ::prost::Message)]
30    pub struct Identifier {
31        /// The node sending the access log messages over the stream.
32        #[prost(message, optional, tag = "1")]
33        pub node: ::core::option::Option<
34            super::super::super::super::config::core::v3::Node,
35        >,
36    }
37    impl ::prost::Name for Identifier {
38        const NAME: &'static str = "Identifier";
39        const PACKAGE: &'static str = "envoy.service.trace.v3";
40        fn full_name() -> ::prost::alloc::string::String {
41            "envoy.service.trace.v3.StreamTracesMessage.Identifier".into()
42        }
43        fn type_url() -> ::prost::alloc::string::String {
44            "type.googleapis.com/envoy.service.trace.v3.StreamTracesMessage.Identifier"
45                .into()
46        }
47    }
48}
49impl ::prost::Name for StreamTracesMessage {
50    const NAME: &'static str = "StreamTracesMessage";
51    const PACKAGE: &'static str = "envoy.service.trace.v3";
52    fn full_name() -> ::prost::alloc::string::String {
53        "envoy.service.trace.v3.StreamTracesMessage".into()
54    }
55    fn type_url() -> ::prost::alloc::string::String {
56        "type.googleapis.com/envoy.service.trace.v3.StreamTracesMessage".into()
57    }
58}
59/// Generated client implementations.
60pub mod trace_service_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    /// Service for streaming traces to server that consumes the trace data. It
71    /// uses OpenCensus data model as a standard to represent trace information.
72    #[derive(Debug, Clone)]
73    pub struct TraceServiceClient<T> {
74        inner: tonic::client::Grpc<T>,
75    }
76    impl<T> TraceServiceClient<T>
77    where
78        T: tonic::client::GrpcService<tonic::body::BoxBody>,
79        T::Error: Into<StdError>,
80        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
81        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
82    {
83        pub fn new(inner: T) -> Self {
84            let inner = tonic::client::Grpc::new(inner);
85            Self { inner }
86        }
87        pub fn with_origin(inner: T, origin: Uri) -> Self {
88            let inner = tonic::client::Grpc::with_origin(inner, origin);
89            Self { inner }
90        }
91        pub fn with_interceptor<F>(
92            inner: T,
93            interceptor: F,
94        ) -> TraceServiceClient<InterceptedService<T, F>>
95        where
96            F: tonic::service::Interceptor,
97            T::ResponseBody: Default,
98            T: tonic::codegen::Service<
99                http::Request<tonic::body::BoxBody>,
100                Response = http::Response<
101                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
102                >,
103            >,
104            <T as tonic::codegen::Service<
105                http::Request<tonic::body::BoxBody>,
106            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
107        {
108            TraceServiceClient::new(InterceptedService::new(inner, interceptor))
109        }
110        /// Compress requests with the given encoding.
111        ///
112        /// This requires the server to support it otherwise it might respond with an
113        /// error.
114        #[must_use]
115        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
116            self.inner = self.inner.send_compressed(encoding);
117            self
118        }
119        /// Enable decompressing responses.
120        #[must_use]
121        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
122            self.inner = self.inner.accept_compressed(encoding);
123            self
124        }
125        /// Limits the maximum size of a decoded message.
126        ///
127        /// Default: `4MB`
128        #[must_use]
129        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
130            self.inner = self.inner.max_decoding_message_size(limit);
131            self
132        }
133        /// Limits the maximum size of an encoded message.
134        ///
135        /// Default: `usize::MAX`
136        #[must_use]
137        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
138            self.inner = self.inner.max_encoding_message_size(limit);
139            self
140        }
141        /// Envoy will connect and send StreamTracesMessage messages forever. It does
142        /// not expect any response to be sent as nothing would be done in the case
143        /// of failure.
144        pub async fn stream_traces(
145            &mut self,
146            request: impl tonic::IntoStreamingRequest<
147                Message = super::StreamTracesMessage,
148            >,
149        ) -> std::result::Result<
150            tonic::Response<super::StreamTracesResponse>,
151            tonic::Status,
152        > {
153            self.inner
154                .ready()
155                .await
156                .map_err(|e| {
157                    tonic::Status::unknown(
158                        format!("Service was not ready: {}", e.into()),
159                    )
160                })?;
161            let codec = tonic::codec::ProstCodec::default();
162            let path = http::uri::PathAndQuery::from_static(
163                "/envoy.service.trace.v3.TraceService/StreamTraces",
164            );
165            let mut req = request.into_streaming_request();
166            req.extensions_mut()
167                .insert(
168                    GrpcMethod::new(
169                        "envoy.service.trace.v3.TraceService",
170                        "StreamTraces",
171                    ),
172                );
173            self.inner.client_streaming(req, path, codec).await
174        }
175    }
176}
177/// Generated server implementations.
178pub mod trace_service_server {
179    #![allow(
180        unused_variables,
181        dead_code,
182        missing_docs,
183        clippy::wildcard_imports,
184        clippy::let_unit_value,
185    )]
186    use tonic::codegen::*;
187    /// Generated trait containing gRPC methods that should be implemented for use with TraceServiceServer.
188    #[async_trait]
189    pub trait TraceService: std::marker::Send + std::marker::Sync + 'static {
190        /// Envoy will connect and send StreamTracesMessage messages forever. It does
191        /// not expect any response to be sent as nothing would be done in the case
192        /// of failure.
193        async fn stream_traces(
194            &self,
195            request: tonic::Request<tonic::Streaming<super::StreamTracesMessage>>,
196        ) -> std::result::Result<
197            tonic::Response<super::StreamTracesResponse>,
198            tonic::Status,
199        >;
200    }
201    /// Service for streaming traces to server that consumes the trace data. It
202    /// uses OpenCensus data model as a standard to represent trace information.
203    #[derive(Debug)]
204    pub struct TraceServiceServer<T> {
205        inner: Arc<T>,
206        accept_compression_encodings: EnabledCompressionEncodings,
207        send_compression_encodings: EnabledCompressionEncodings,
208        max_decoding_message_size: Option<usize>,
209        max_encoding_message_size: Option<usize>,
210    }
211    impl<T> TraceServiceServer<T> {
212        pub fn new(inner: T) -> Self {
213            Self::from_arc(Arc::new(inner))
214        }
215        pub fn from_arc(inner: Arc<T>) -> Self {
216            Self {
217                inner,
218                accept_compression_encodings: Default::default(),
219                send_compression_encodings: Default::default(),
220                max_decoding_message_size: None,
221                max_encoding_message_size: None,
222            }
223        }
224        pub fn with_interceptor<F>(
225            inner: T,
226            interceptor: F,
227        ) -> InterceptedService<Self, F>
228        where
229            F: tonic::service::Interceptor,
230        {
231            InterceptedService::new(Self::new(inner), interceptor)
232        }
233        /// Enable decompressing requests with the given encoding.
234        #[must_use]
235        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
236            self.accept_compression_encodings.enable(encoding);
237            self
238        }
239        /// Compress responses with the given encoding, if the client supports it.
240        #[must_use]
241        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
242            self.send_compression_encodings.enable(encoding);
243            self
244        }
245        /// Limits the maximum size of a decoded message.
246        ///
247        /// Default: `4MB`
248        #[must_use]
249        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
250            self.max_decoding_message_size = Some(limit);
251            self
252        }
253        /// Limits the maximum size of an encoded message.
254        ///
255        /// Default: `usize::MAX`
256        #[must_use]
257        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
258            self.max_encoding_message_size = Some(limit);
259            self
260        }
261    }
262    impl<T, B> tonic::codegen::Service<http::Request<B>> for TraceServiceServer<T>
263    where
264        T: TraceService,
265        B: Body + std::marker::Send + 'static,
266        B::Error: Into<StdError> + std::marker::Send + 'static,
267    {
268        type Response = http::Response<tonic::body::BoxBody>;
269        type Error = std::convert::Infallible;
270        type Future = BoxFuture<Self::Response, Self::Error>;
271        fn poll_ready(
272            &mut self,
273            _cx: &mut Context<'_>,
274        ) -> Poll<std::result::Result<(), Self::Error>> {
275            Poll::Ready(Ok(()))
276        }
277        fn call(&mut self, req: http::Request<B>) -> Self::Future {
278            match req.uri().path() {
279                "/envoy.service.trace.v3.TraceService/StreamTraces" => {
280                    #[allow(non_camel_case_types)]
281                    struct StreamTracesSvc<T: TraceService>(pub Arc<T>);
282                    impl<
283                        T: TraceService,
284                    > tonic::server::ClientStreamingService<super::StreamTracesMessage>
285                    for StreamTracesSvc<T> {
286                        type Response = super::StreamTracesResponse;
287                        type Future = BoxFuture<
288                            tonic::Response<Self::Response>,
289                            tonic::Status,
290                        >;
291                        fn call(
292                            &mut self,
293                            request: tonic::Request<
294                                tonic::Streaming<super::StreamTracesMessage>,
295                            >,
296                        ) -> Self::Future {
297                            let inner = Arc::clone(&self.0);
298                            let fut = async move {
299                                <T as TraceService>::stream_traces(&inner, request).await
300                            };
301                            Box::pin(fut)
302                        }
303                    }
304                    let accept_compression_encodings = self.accept_compression_encodings;
305                    let send_compression_encodings = self.send_compression_encodings;
306                    let max_decoding_message_size = self.max_decoding_message_size;
307                    let max_encoding_message_size = self.max_encoding_message_size;
308                    let inner = self.inner.clone();
309                    let fut = async move {
310                        let method = StreamTracesSvc(inner);
311                        let codec = tonic::codec::ProstCodec::default();
312                        let mut grpc = tonic::server::Grpc::new(codec)
313                            .apply_compression_config(
314                                accept_compression_encodings,
315                                send_compression_encodings,
316                            )
317                            .apply_max_message_size_config(
318                                max_decoding_message_size,
319                                max_encoding_message_size,
320                            );
321                        let res = grpc.client_streaming(method, req).await;
322                        Ok(res)
323                    };
324                    Box::pin(fut)
325                }
326                _ => {
327                    Box::pin(async move {
328                        let mut response = http::Response::new(empty_body());
329                        let headers = response.headers_mut();
330                        headers
331                            .insert(
332                                tonic::Status::GRPC_STATUS,
333                                (tonic::Code::Unimplemented as i32).into(),
334                            );
335                        headers
336                            .insert(
337                                http::header::CONTENT_TYPE,
338                                tonic::metadata::GRPC_CONTENT_TYPE,
339                            );
340                        Ok(response)
341                    })
342                }
343            }
344        }
345    }
346    impl<T> Clone for TraceServiceServer<T> {
347        fn clone(&self) -> Self {
348            let inner = self.inner.clone();
349            Self {
350                inner,
351                accept_compression_encodings: self.accept_compression_encodings,
352                send_compression_encodings: self.send_compression_encodings,
353                max_decoding_message_size: self.max_decoding_message_size,
354                max_encoding_message_size: self.max_encoding_message_size,
355            }
356        }
357    }
358    /// Generated gRPC service name
359    pub const SERVICE_NAME: &str = "envoy.service.trace.v3.TraceService";
360    impl<T> tonic::server::NamedService for TraceServiceServer<T> {
361        const NAME: &'static str = SERVICE_NAME;
362    }
363}