1pub mod pnl_service_client {
4 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5 use tonic::codegen::http::Uri;
6 use tonic::codegen::*;
7 #[derive(Debug, Clone)]
8 pub struct PnlServiceClient<T> {
9 inner: tonic::client::Grpc<T>,
10 }
11 impl PnlServiceClient<tonic::transport::Channel> {
12 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
14 where
15 D: TryInto<tonic::transport::Endpoint>,
16 D::Error: Into<StdError>,
17 {
18 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
19 Ok(Self::new(conn))
20 }
21 }
22 impl<T> PnlServiceClient<T>
23 where
24 T: tonic::client::GrpcService<tonic::body::BoxBody>,
25 T::Error: Into<StdError>,
26 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
28 {
29 pub fn new(inner: T) -> Self {
30 let inner = tonic::client::Grpc::new(inner);
31 Self { inner }
32 }
33 pub fn with_origin(inner: T, origin: Uri) -> Self {
34 let inner = tonic::client::Grpc::with_origin(inner, origin);
35 Self { inner }
36 }
37 pub fn with_interceptor<F>(
38 inner: T,
39 interceptor: F,
40 ) -> PnlServiceClient<InterceptedService<T, F>>
41 where
42 F: tonic::service::Interceptor,
43 T::ResponseBody: Default,
44 T: tonic::codegen::Service<
45 http::Request<tonic::body::BoxBody>,
46 Response = http::Response<
47 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
48 >,
49 >,
50 <T as tonic::codegen::Service<
51 http::Request<tonic::body::BoxBody>,
52 >>::Error: Into<StdError> + Send + Sync,
53 {
54 PnlServiceClient::new(InterceptedService::new(inner, interceptor))
55 }
56 #[must_use]
61 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
62 self.inner = self.inner.send_compressed(encoding);
63 self
64 }
65 #[must_use]
67 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
68 self.inner = self.inner.accept_compressed(encoding);
69 self
70 }
71 #[must_use]
75 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
76 self.inner = self.inner.max_decoding_message_size(limit);
77 self
78 }
79 #[must_use]
83 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
84 self.inner = self.inner.max_encoding_message_size(limit);
85 self
86 }
87 pub async fn list_pnl_summaries(
88 &mut self,
89 request: impl tonic::IntoRequest<super::ListPnlSummariesRequest>,
90 ) -> std::result::Result<
91 tonic::Response<super::ListPnlSummariesResponse>,
92 tonic::Status,
93 > {
94 self.inner
95 .ready()
96 .await
97 .map_err(|e| {
98 tonic::Status::new(
99 tonic::Code::Unknown,
100 format!("Service was not ready: {}", e.into()),
101 )
102 })?;
103 let codec = tonic::codec::ProstCodec::default();
104 let path = http::uri::PathAndQuery::from_static(
105 "/log_sync.v1.pnl.PnlService/ListPnlSummaries",
106 );
107 let mut req = request.into_request();
108 req.extensions_mut()
109 .insert(
110 GrpcMethod::new("log_sync.v1.pnl.PnlService", "ListPnlSummaries"),
111 );
112 self.inner.unary(req, path, codec).await
113 }
114 }
115}
116pub mod pnl_service_server {
118 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
119 use tonic::codegen::*;
120 #[async_trait]
122 pub trait PnlService: Send + Sync + 'static {
123 async fn list_pnl_summaries(
124 &self,
125 request: tonic::Request<super::ListPnlSummariesRequest>,
126 ) -> std::result::Result<
127 tonic::Response<super::ListPnlSummariesResponse>,
128 tonic::Status,
129 >;
130 }
131 #[derive(Debug)]
132 pub struct PnlServiceServer<T: PnlService> {
133 inner: Arc<T>,
134 accept_compression_encodings: EnabledCompressionEncodings,
135 send_compression_encodings: EnabledCompressionEncodings,
136 max_decoding_message_size: Option<usize>,
137 max_encoding_message_size: Option<usize>,
138 }
139 impl<T: PnlService> PnlServiceServer<T> {
140 pub fn new(inner: T) -> Self {
141 Self::from_arc(Arc::new(inner))
142 }
143 pub fn from_arc(inner: Arc<T>) -> Self {
144 Self {
145 inner,
146 accept_compression_encodings: Default::default(),
147 send_compression_encodings: Default::default(),
148 max_decoding_message_size: None,
149 max_encoding_message_size: None,
150 }
151 }
152 pub fn with_interceptor<F>(
153 inner: T,
154 interceptor: F,
155 ) -> InterceptedService<Self, F>
156 where
157 F: tonic::service::Interceptor,
158 {
159 InterceptedService::new(Self::new(inner), interceptor)
160 }
161 #[must_use]
163 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
164 self.accept_compression_encodings.enable(encoding);
165 self
166 }
167 #[must_use]
169 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
170 self.send_compression_encodings.enable(encoding);
171 self
172 }
173 #[must_use]
177 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
178 self.max_decoding_message_size = Some(limit);
179 self
180 }
181 #[must_use]
185 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
186 self.max_encoding_message_size = Some(limit);
187 self
188 }
189 }
190 impl<T, B> tonic::codegen::Service<http::Request<B>> for PnlServiceServer<T>
191 where
192 T: PnlService,
193 B: Body + Send + 'static,
194 B::Error: Into<StdError> + Send + 'static,
195 {
196 type Response = http::Response<tonic::body::BoxBody>;
197 type Error = std::convert::Infallible;
198 type Future = BoxFuture<Self::Response, Self::Error>;
199 fn poll_ready(
200 &mut self,
201 _cx: &mut Context<'_>,
202 ) -> Poll<std::result::Result<(), Self::Error>> {
203 Poll::Ready(Ok(()))
204 }
205 fn call(&mut self, req: http::Request<B>) -> Self::Future {
206 match req.uri().path() {
207 "/log_sync.v1.pnl.PnlService/ListPnlSummaries" => {
208 #[allow(non_camel_case_types)]
209 struct ListPnlSummariesSvc<T: PnlService>(pub Arc<T>);
210 impl<
211 T: PnlService,
212 > tonic::server::UnaryService<super::ListPnlSummariesRequest>
213 for ListPnlSummariesSvc<T> {
214 type Response = super::ListPnlSummariesResponse;
215 type Future = BoxFuture<
216 tonic::Response<Self::Response>,
217 tonic::Status,
218 >;
219 fn call(
220 &mut self,
221 request: tonic::Request<super::ListPnlSummariesRequest>,
222 ) -> Self::Future {
223 let inner = Arc::clone(&self.0);
224 let fut = async move {
225 <T as PnlService>::list_pnl_summaries(&inner, request).await
226 };
227 Box::pin(fut)
228 }
229 }
230 let accept_compression_encodings = self.accept_compression_encodings;
231 let send_compression_encodings = self.send_compression_encodings;
232 let max_decoding_message_size = self.max_decoding_message_size;
233 let max_encoding_message_size = self.max_encoding_message_size;
234 let inner = self.inner.clone();
235 let fut = async move {
236 let method = ListPnlSummariesSvc(inner);
237 let codec = tonic::codec::ProstCodec::default();
238 let mut grpc = tonic::server::Grpc::new(codec)
239 .apply_compression_config(
240 accept_compression_encodings,
241 send_compression_encodings,
242 )
243 .apply_max_message_size_config(
244 max_decoding_message_size,
245 max_encoding_message_size,
246 );
247 let res = grpc.unary(method, req).await;
248 Ok(res)
249 };
250 Box::pin(fut)
251 }
252 _ => {
253 Box::pin(async move {
254 Ok(
255 http::Response::builder()
256 .status(200)
257 .header("grpc-status", tonic::Code::Unimplemented as i32)
258 .header(
259 http::header::CONTENT_TYPE,
260 tonic::metadata::GRPC_CONTENT_TYPE,
261 )
262 .body(empty_body())
263 .unwrap(),
264 )
265 })
266 }
267 }
268 }
269 }
270 impl<T: PnlService> Clone for PnlServiceServer<T> {
271 fn clone(&self) -> Self {
272 let inner = self.inner.clone();
273 Self {
274 inner,
275 accept_compression_encodings: self.accept_compression_encodings,
276 send_compression_encodings: self.send_compression_encodings,
277 max_decoding_message_size: self.max_decoding_message_size,
278 max_encoding_message_size: self.max_encoding_message_size,
279 }
280 }
281 }
282 impl<T: PnlService> tonic::server::NamedService for PnlServiceServer<T> {
283 const NAME: &'static str = "log_sync.v1.pnl.PnlService";
284 }
285}