1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct CatalogParameter {
4 #[prost(string, tag = "1")]
5 pub name: ::prost::alloc::string::String,
6 #[prost(string, tag = "2")]
7 pub r#type: ::prost::alloc::string::String,
8 #[prost(string, tag = "3")]
9 pub description: ::prost::alloc::string::String,
10 #[prost(bool, tag = "4")]
11 pub required: bool,
12 #[prost(message, optional, tag = "5")]
13 pub default: ::core::option::Option<::prost_types::Value>,
14}
15#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
16pub struct OperationAnnotations {
17 #[prost(bool, optional, tag = "1")]
18 pub read_only_hint: ::core::option::Option<bool>,
19 #[prost(bool, optional, tag = "2")]
20 pub idempotent_hint: ::core::option::Option<bool>,
21 #[prost(bool, optional, tag = "3")]
22 pub destructive_hint: ::core::option::Option<bool>,
23 #[prost(bool, optional, tag = "4")]
24 pub open_world_hint: ::core::option::Option<bool>,
25}
26#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct CatalogOperation {
28 #[prost(string, tag = "1")]
29 pub id: ::prost::alloc::string::String,
30 #[prost(string, tag = "2")]
31 pub method: ::prost::alloc::string::String,
32 #[prost(string, tag = "3")]
33 pub title: ::prost::alloc::string::String,
34 #[prost(string, tag = "4")]
35 pub description: ::prost::alloc::string::String,
36 #[prost(string, tag = "5")]
37 pub input_schema: ::prost::alloc::string::String,
38 #[prost(string, tag = "6")]
39 pub output_schema: ::prost::alloc::string::String,
40 #[prost(message, optional, tag = "7")]
41 pub annotations: ::core::option::Option<OperationAnnotations>,
42 #[prost(message, repeated, tag = "8")]
43 pub parameters: ::prost::alloc::vec::Vec<CatalogParameter>,
44 #[prost(string, repeated, tag = "9")]
45 pub required_scopes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
46 #[prost(string, repeated, tag = "10")]
47 pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
48 #[prost(bool, tag = "11")]
49 pub read_only: bool,
50 #[prost(bool, optional, tag = "12")]
51 pub visible: ::core::option::Option<bool>,
52 #[prost(string, tag = "13")]
53 pub transport: ::prost::alloc::string::String,
54 #[prost(string, repeated, tag = "14")]
55 pub allowed_roles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
56}
57#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct Catalog {
59 #[prost(string, tag = "1")]
60 pub name: ::prost::alloc::string::String,
61 #[prost(string, tag = "2")]
62 pub display_name: ::prost::alloc::string::String,
63 #[prost(string, tag = "3")]
64 pub description: ::prost::alloc::string::String,
65 #[prost(string, tag = "4")]
66 pub icon_svg: ::prost::alloc::string::String,
67 #[prost(message, repeated, tag = "5")]
68 pub operations: ::prost::alloc::vec::Vec<CatalogOperation>,
69}
70#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
71pub struct ConnectionParamDef {
72 #[prost(bool, tag = "1")]
73 pub required: bool,
74 #[prost(string, tag = "2")]
75 pub description: ::prost::alloc::string::String,
76 #[prost(string, tag = "3")]
77 pub default_value: ::prost::alloc::string::String,
78 #[prost(string, tag = "4")]
79 pub from: ::prost::alloc::string::String,
80 #[prost(string, tag = "5")]
81 pub field: ::prost::alloc::string::String,
82}
83#[derive(Clone, PartialEq, ::prost::Message)]
84pub struct ProviderMetadata {
85 #[prost(string, tag = "1")]
86 pub name: ::prost::alloc::string::String,
87 #[prost(string, tag = "2")]
88 pub display_name: ::prost::alloc::string::String,
89 #[prost(string, tag = "3")]
90 pub description: ::prost::alloc::string::String,
91 #[prost(enumeration = "ConnectionMode", tag = "4")]
92 pub connection_mode: i32,
93 #[prost(string, repeated, tag = "5")]
94 pub auth_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
95 #[prost(btree_map = "string, message", tag = "6")]
96 pub connection_params:
97 ::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ConnectionParamDef>,
98 #[prost(message, optional, tag = "7")]
99 pub static_catalog: ::core::option::Option<Catalog>,
100 #[prost(bool, tag = "8")]
101 pub supports_session_catalog: bool,
102 #[prost(bool, tag = "9")]
103 pub supports_post_connect: bool,
104 #[prost(int32, tag = "11")]
105 pub min_protocol_version: i32,
106 #[prost(int32, tag = "12")]
107 pub max_protocol_version: i32,
108}
109#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
110pub struct OperationResult {
111 #[prost(int32, tag = "1")]
112 pub status: i32,
113 #[prost(string, tag = "2")]
114 pub body: ::prost::alloc::string::String,
115}
116#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
117pub struct IntegrationToken {
118 #[prost(string, tag = "1")]
119 pub id: ::prost::alloc::string::String,
120 #[prost(string, tag = "2")]
121 pub user_id: ::prost::alloc::string::String,
122 #[prost(string, tag = "3")]
123 pub integration: ::prost::alloc::string::String,
124 #[prost(string, tag = "4")]
125 pub instance: ::prost::alloc::string::String,
126 #[prost(string, tag = "5")]
127 pub access_token: ::prost::alloc::string::String,
128 #[prost(string, tag = "6")]
129 pub refresh_token: ::prost::alloc::string::String,
130 #[prost(string, tag = "7")]
131 pub scopes: ::prost::alloc::string::String,
132 #[prost(message, optional, tag = "8")]
133 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
134 #[prost(message, optional, tag = "9")]
135 pub last_refreshed_at: ::core::option::Option<::prost_types::Timestamp>,
136 #[prost(int32, tag = "10")]
137 pub refresh_error_count: i32,
138 #[prost(string, tag = "11")]
139 pub metadata_json: ::prost::alloc::string::String,
140 #[prost(message, optional, tag = "12")]
141 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
142 #[prost(message, optional, tag = "13")]
143 pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
144}
145#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
146pub struct SubjectContext {
147 #[prost(string, tag = "1")]
148 pub id: ::prost::alloc::string::String,
149 #[prost(string, tag = "2")]
150 pub kind: ::prost::alloc::string::String,
151 #[prost(string, tag = "3")]
152 pub display_name: ::prost::alloc::string::String,
153 #[prost(string, tag = "4")]
154 pub auth_source: ::prost::alloc::string::String,
155}
156#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
157pub struct CredentialContext {
158 #[prost(string, tag = "1")]
159 pub mode: ::prost::alloc::string::String,
160 #[prost(string, tag = "2")]
161 pub subject_id: ::prost::alloc::string::String,
162 #[prost(string, tag = "3")]
163 pub connection: ::prost::alloc::string::String,
164 #[prost(string, tag = "4")]
165 pub instance: ::prost::alloc::string::String,
166}
167#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
168pub struct AccessContext {
169 #[prost(string, tag = "1")]
170 pub policy: ::prost::alloc::string::String,
171 #[prost(string, tag = "2")]
172 pub role: ::prost::alloc::string::String,
173}
174#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
175pub struct RequestContext {
176 #[prost(message, optional, tag = "1")]
177 pub subject: ::core::option::Option<SubjectContext>,
178 #[prost(message, optional, tag = "2")]
179 pub credential: ::core::option::Option<CredentialContext>,
180 #[prost(message, optional, tag = "3")]
181 pub access: ::core::option::Option<AccessContext>,
182}
183#[derive(Clone, PartialEq, ::prost::Message)]
184pub struct ExecuteRequest {
185 #[prost(string, tag = "1")]
186 pub operation: ::prost::alloc::string::String,
187 #[prost(message, optional, tag = "2")]
188 pub params: ::core::option::Option<::prost_types::Struct>,
189 #[prost(string, tag = "3")]
190 pub token: ::prost::alloc::string::String,
191 #[prost(btree_map = "string, string", tag = "4")]
192 pub connection_params: ::prost::alloc::collections::BTreeMap<
193 ::prost::alloc::string::String,
194 ::prost::alloc::string::String,
195 >,
196 #[prost(string, tag = "5")]
197 pub invocation_id: ::prost::alloc::string::String,
198 #[prost(message, optional, tag = "6")]
199 pub context: ::core::option::Option<RequestContext>,
200}
201#[derive(Clone, PartialEq, ::prost::Message)]
202pub struct GetSessionCatalogRequest {
203 #[prost(string, tag = "1")]
204 pub token: ::prost::alloc::string::String,
205 #[prost(btree_map = "string, string", tag = "2")]
206 pub connection_params: ::prost::alloc::collections::BTreeMap<
207 ::prost::alloc::string::String,
208 ::prost::alloc::string::String,
209 >,
210 #[prost(string, tag = "3")]
211 pub invocation_id: ::prost::alloc::string::String,
212 #[prost(message, optional, tag = "4")]
213 pub context: ::core::option::Option<RequestContext>,
214}
215#[derive(Clone, PartialEq, ::prost::Message)]
216pub struct GetSessionCatalogResponse {
217 #[prost(message, optional, tag = "1")]
218 pub catalog: ::core::option::Option<Catalog>,
219}
220#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
221pub struct PostConnectRequest {
222 #[prost(message, optional, tag = "1")]
223 pub token: ::core::option::Option<IntegrationToken>,
224}
225#[derive(Clone, PartialEq, ::prost::Message)]
226pub struct PostConnectResponse {
227 #[prost(btree_map = "string, string", tag = "1")]
228 pub metadata: ::prost::alloc::collections::BTreeMap<
229 ::prost::alloc::string::String,
230 ::prost::alloc::string::String,
231 >,
232}
233#[derive(Clone, PartialEq, ::prost::Message)]
234pub struct StartProviderRequest {
235 #[prost(string, tag = "1")]
236 pub name: ::prost::alloc::string::String,
237 #[prost(message, optional, tag = "2")]
238 pub config: ::core::option::Option<::prost_types::Struct>,
239 #[prost(int32, tag = "4")]
240 pub protocol_version: i32,
241}
242#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
243pub struct StartProviderResponse {
244 #[prost(int32, tag = "1")]
245 pub protocol_version: i32,
246}
247#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
248#[repr(i32)]
249pub enum ConnectionMode {
250 Unspecified = 0,
251 None = 1,
252 User = 2,
253 Identity = 3,
254 Either = 4,
255}
256impl ConnectionMode {
257 pub fn as_str_name(&self) -> &'static str {
262 match self {
263 Self::Unspecified => "CONNECTION_MODE_UNSPECIFIED",
264 Self::None => "CONNECTION_MODE_NONE",
265 Self::User => "CONNECTION_MODE_USER",
266 Self::Identity => "CONNECTION_MODE_IDENTITY",
267 Self::Either => "CONNECTION_MODE_EITHER",
268 }
269 }
270 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
272 match value {
273 "CONNECTION_MODE_UNSPECIFIED" => Some(Self::Unspecified),
274 "CONNECTION_MODE_NONE" => Some(Self::None),
275 "CONNECTION_MODE_USER" => Some(Self::User),
276 "CONNECTION_MODE_IDENTITY" => Some(Self::Identity),
277 "CONNECTION_MODE_EITHER" => Some(Self::Either),
278 _ => None,
279 }
280 }
281}
282pub mod integration_provider_client {
284 #![allow(
285 unused_variables,
286 dead_code,
287 missing_docs,
288 clippy::wildcard_imports,
289 clippy::let_unit_value
290 )]
291 use tonic::codegen::http::Uri;
292 use tonic::codegen::*;
293 #[derive(Debug, Clone)]
294 pub struct IntegrationProviderClient<T> {
295 inner: tonic::client::Grpc<T>,
296 }
297 impl IntegrationProviderClient<tonic::transport::Channel> {
298 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
300 where
301 D: TryInto<tonic::transport::Endpoint>,
302 D::Error: Into<StdError>,
303 {
304 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
305 Ok(Self::new(conn))
306 }
307 }
308 impl<T> IntegrationProviderClient<T>
309 where
310 T: tonic::client::GrpcService<tonic::body::Body>,
311 T::Error: Into<StdError>,
312 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
313 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
314 {
315 pub fn new(inner: T) -> Self {
316 let inner = tonic::client::Grpc::new(inner);
317 Self { inner }
318 }
319 pub fn with_origin(inner: T, origin: Uri) -> Self {
320 let inner = tonic::client::Grpc::with_origin(inner, origin);
321 Self { inner }
322 }
323 pub fn with_interceptor<F>(
324 inner: T,
325 interceptor: F,
326 ) -> IntegrationProviderClient<InterceptedService<T, F>>
327 where
328 F: tonic::service::Interceptor,
329 T::ResponseBody: Default,
330 T: tonic::codegen::Service<
331 http::Request<tonic::body::Body>,
332 Response = http::Response<
333 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
334 >,
335 >,
336 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
337 Into<StdError> + std::marker::Send + std::marker::Sync,
338 {
339 IntegrationProviderClient::new(InterceptedService::new(inner, interceptor))
340 }
341 #[must_use]
346 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
347 self.inner = self.inner.send_compressed(encoding);
348 self
349 }
350 #[must_use]
352 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
353 self.inner = self.inner.accept_compressed(encoding);
354 self
355 }
356 #[must_use]
360 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
361 self.inner = self.inner.max_decoding_message_size(limit);
362 self
363 }
364 #[must_use]
368 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
369 self.inner = self.inner.max_encoding_message_size(limit);
370 self
371 }
372 pub async fn get_metadata(
373 &mut self,
374 request: impl tonic::IntoRequest<()>,
375 ) -> std::result::Result<tonic::Response<super::ProviderMetadata>, tonic::Status> {
376 self.inner.ready().await.map_err(|e| {
377 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
378 })?;
379 let codec = tonic_prost::ProstCodec::default();
380 let path = http::uri::PathAndQuery::from_static(
381 "/gestalt.provider.v1.IntegrationProvider/GetMetadata",
382 );
383 let mut req = request.into_request();
384 req.extensions_mut().insert(GrpcMethod::new(
385 "gestalt.provider.v1.IntegrationProvider",
386 "GetMetadata",
387 ));
388 self.inner.unary(req, path, codec).await
389 }
390 pub async fn start_provider(
391 &mut self,
392 request: impl tonic::IntoRequest<super::StartProviderRequest>,
393 ) -> std::result::Result<tonic::Response<super::StartProviderResponse>, tonic::Status>
394 {
395 self.inner.ready().await.map_err(|e| {
396 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
397 })?;
398 let codec = tonic_prost::ProstCodec::default();
399 let path = http::uri::PathAndQuery::from_static(
400 "/gestalt.provider.v1.IntegrationProvider/StartProvider",
401 );
402 let mut req = request.into_request();
403 req.extensions_mut().insert(GrpcMethod::new(
404 "gestalt.provider.v1.IntegrationProvider",
405 "StartProvider",
406 ));
407 self.inner.unary(req, path, codec).await
408 }
409 pub async fn execute(
410 &mut self,
411 request: impl tonic::IntoRequest<super::ExecuteRequest>,
412 ) -> std::result::Result<tonic::Response<super::OperationResult>, tonic::Status> {
413 self.inner.ready().await.map_err(|e| {
414 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
415 })?;
416 let codec = tonic_prost::ProstCodec::default();
417 let path = http::uri::PathAndQuery::from_static(
418 "/gestalt.provider.v1.IntegrationProvider/Execute",
419 );
420 let mut req = request.into_request();
421 req.extensions_mut().insert(GrpcMethod::new(
422 "gestalt.provider.v1.IntegrationProvider",
423 "Execute",
424 ));
425 self.inner.unary(req, path, codec).await
426 }
427 pub async fn get_session_catalog(
428 &mut self,
429 request: impl tonic::IntoRequest<super::GetSessionCatalogRequest>,
430 ) -> std::result::Result<tonic::Response<super::GetSessionCatalogResponse>, tonic::Status>
431 {
432 self.inner.ready().await.map_err(|e| {
433 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
434 })?;
435 let codec = tonic_prost::ProstCodec::default();
436 let path = http::uri::PathAndQuery::from_static(
437 "/gestalt.provider.v1.IntegrationProvider/GetSessionCatalog",
438 );
439 let mut req = request.into_request();
440 req.extensions_mut().insert(GrpcMethod::new(
441 "gestalt.provider.v1.IntegrationProvider",
442 "GetSessionCatalog",
443 ));
444 self.inner.unary(req, path, codec).await
445 }
446 pub async fn post_connect(
447 &mut self,
448 request: impl tonic::IntoRequest<super::PostConnectRequest>,
449 ) -> std::result::Result<tonic::Response<super::PostConnectResponse>, tonic::Status>
450 {
451 self.inner.ready().await.map_err(|e| {
452 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
453 })?;
454 let codec = tonic_prost::ProstCodec::default();
455 let path = http::uri::PathAndQuery::from_static(
456 "/gestalt.provider.v1.IntegrationProvider/PostConnect",
457 );
458 let mut req = request.into_request();
459 req.extensions_mut().insert(GrpcMethod::new(
460 "gestalt.provider.v1.IntegrationProvider",
461 "PostConnect",
462 ));
463 self.inner.unary(req, path, codec).await
464 }
465 }
466}
467pub mod integration_provider_server {
469 #![allow(
470 unused_variables,
471 dead_code,
472 missing_docs,
473 clippy::wildcard_imports,
474 clippy::let_unit_value
475 )]
476 use tonic::codegen::*;
477 #[async_trait]
479 pub trait IntegrationProvider: std::marker::Send + std::marker::Sync + 'static {
480 async fn get_metadata(
481 &self,
482 request: tonic::Request<()>,
483 ) -> std::result::Result<tonic::Response<super::ProviderMetadata>, tonic::Status>;
484 async fn start_provider(
485 &self,
486 request: tonic::Request<super::StartProviderRequest>,
487 ) -> std::result::Result<tonic::Response<super::StartProviderResponse>, tonic::Status>;
488 async fn execute(
489 &self,
490 request: tonic::Request<super::ExecuteRequest>,
491 ) -> std::result::Result<tonic::Response<super::OperationResult>, tonic::Status>;
492 async fn get_session_catalog(
493 &self,
494 request: tonic::Request<super::GetSessionCatalogRequest>,
495 ) -> std::result::Result<tonic::Response<super::GetSessionCatalogResponse>, tonic::Status>;
496 async fn post_connect(
497 &self,
498 request: tonic::Request<super::PostConnectRequest>,
499 ) -> std::result::Result<tonic::Response<super::PostConnectResponse>, tonic::Status>;
500 }
501 #[derive(Debug)]
502 pub struct IntegrationProviderServer<T> {
503 inner: Arc<T>,
504 accept_compression_encodings: EnabledCompressionEncodings,
505 send_compression_encodings: EnabledCompressionEncodings,
506 max_decoding_message_size: Option<usize>,
507 max_encoding_message_size: Option<usize>,
508 }
509 impl<T> IntegrationProviderServer<T> {
510 pub fn new(inner: T) -> Self {
511 Self::from_arc(Arc::new(inner))
512 }
513 pub fn from_arc(inner: Arc<T>) -> Self {
514 Self {
515 inner,
516 accept_compression_encodings: Default::default(),
517 send_compression_encodings: Default::default(),
518 max_decoding_message_size: None,
519 max_encoding_message_size: None,
520 }
521 }
522 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
523 where
524 F: tonic::service::Interceptor,
525 {
526 InterceptedService::new(Self::new(inner), interceptor)
527 }
528 #[must_use]
530 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
531 self.accept_compression_encodings.enable(encoding);
532 self
533 }
534 #[must_use]
536 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
537 self.send_compression_encodings.enable(encoding);
538 self
539 }
540 #[must_use]
544 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
545 self.max_decoding_message_size = Some(limit);
546 self
547 }
548 #[must_use]
552 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
553 self.max_encoding_message_size = Some(limit);
554 self
555 }
556 }
557 impl<T, B> tonic::codegen::Service<http::Request<B>> for IntegrationProviderServer<T>
558 where
559 T: IntegrationProvider,
560 B: Body + std::marker::Send + 'static,
561 B::Error: Into<StdError> + std::marker::Send + 'static,
562 {
563 type Response = http::Response<tonic::body::Body>;
564 type Error = std::convert::Infallible;
565 type Future = BoxFuture<Self::Response, Self::Error>;
566 fn poll_ready(
567 &mut self,
568 _cx: &mut Context<'_>,
569 ) -> Poll<std::result::Result<(), Self::Error>> {
570 Poll::Ready(Ok(()))
571 }
572 fn call(&mut self, req: http::Request<B>) -> Self::Future {
573 match req.uri().path() {
574 "/gestalt.provider.v1.IntegrationProvider/GetMetadata" => {
575 #[allow(non_camel_case_types)]
576 struct GetMetadataSvc<T: IntegrationProvider>(pub Arc<T>);
577 impl<T: IntegrationProvider> tonic::server::UnaryService<()> for GetMetadataSvc<T> {
578 type Response = super::ProviderMetadata;
579 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
580 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
581 let inner = Arc::clone(&self.0);
582 let fut = async move {
583 <T as IntegrationProvider>::get_metadata(&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 = GetMetadataSvc(inner);
595 let codec = tonic_prost::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.unary(method, req).await;
606 Ok(res)
607 };
608 Box::pin(fut)
609 }
610 "/gestalt.provider.v1.IntegrationProvider/StartProvider" => {
611 #[allow(non_camel_case_types)]
612 struct StartProviderSvc<T: IntegrationProvider>(pub Arc<T>);
613 impl<T: IntegrationProvider>
614 tonic::server::UnaryService<super::StartProviderRequest>
615 for StartProviderSvc<T>
616 {
617 type Response = super::StartProviderResponse;
618 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
619 fn call(
620 &mut self,
621 request: tonic::Request<super::StartProviderRequest>,
622 ) -> Self::Future {
623 let inner = Arc::clone(&self.0);
624 let fut = async move {
625 <T as IntegrationProvider>::start_provider(&inner, request).await
626 };
627 Box::pin(fut)
628 }
629 }
630 let accept_compression_encodings = self.accept_compression_encodings;
631 let send_compression_encodings = self.send_compression_encodings;
632 let max_decoding_message_size = self.max_decoding_message_size;
633 let max_encoding_message_size = self.max_encoding_message_size;
634 let inner = self.inner.clone();
635 let fut = async move {
636 let method = StartProviderSvc(inner);
637 let codec = tonic_prost::ProstCodec::default();
638 let mut grpc = tonic::server::Grpc::new(codec)
639 .apply_compression_config(
640 accept_compression_encodings,
641 send_compression_encodings,
642 )
643 .apply_max_message_size_config(
644 max_decoding_message_size,
645 max_encoding_message_size,
646 );
647 let res = grpc.unary(method, req).await;
648 Ok(res)
649 };
650 Box::pin(fut)
651 }
652 "/gestalt.provider.v1.IntegrationProvider/Execute" => {
653 #[allow(non_camel_case_types)]
654 struct ExecuteSvc<T: IntegrationProvider>(pub Arc<T>);
655 impl<T: IntegrationProvider> tonic::server::UnaryService<super::ExecuteRequest> for ExecuteSvc<T> {
656 type Response = super::OperationResult;
657 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
658 fn call(
659 &mut self,
660 request: tonic::Request<super::ExecuteRequest>,
661 ) -> Self::Future {
662 let inner = Arc::clone(&self.0);
663 let fut = async move {
664 <T as IntegrationProvider>::execute(&inner, request).await
665 };
666 Box::pin(fut)
667 }
668 }
669 let accept_compression_encodings = self.accept_compression_encodings;
670 let send_compression_encodings = self.send_compression_encodings;
671 let max_decoding_message_size = self.max_decoding_message_size;
672 let max_encoding_message_size = self.max_encoding_message_size;
673 let inner = self.inner.clone();
674 let fut = async move {
675 let method = ExecuteSvc(inner);
676 let codec = tonic_prost::ProstCodec::default();
677 let mut grpc = tonic::server::Grpc::new(codec)
678 .apply_compression_config(
679 accept_compression_encodings,
680 send_compression_encodings,
681 )
682 .apply_max_message_size_config(
683 max_decoding_message_size,
684 max_encoding_message_size,
685 );
686 let res = grpc.unary(method, req).await;
687 Ok(res)
688 };
689 Box::pin(fut)
690 }
691 "/gestalt.provider.v1.IntegrationProvider/GetSessionCatalog" => {
692 #[allow(non_camel_case_types)]
693 struct GetSessionCatalogSvc<T: IntegrationProvider>(pub Arc<T>);
694 impl<T: IntegrationProvider>
695 tonic::server::UnaryService<super::GetSessionCatalogRequest>
696 for GetSessionCatalogSvc<T>
697 {
698 type Response = super::GetSessionCatalogResponse;
699 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
700 fn call(
701 &mut self,
702 request: tonic::Request<super::GetSessionCatalogRequest>,
703 ) -> Self::Future {
704 let inner = Arc::clone(&self.0);
705 let fut = async move {
706 <T as IntegrationProvider>::get_session_catalog(&inner, request)
707 .await
708 };
709 Box::pin(fut)
710 }
711 }
712 let accept_compression_encodings = self.accept_compression_encodings;
713 let send_compression_encodings = self.send_compression_encodings;
714 let max_decoding_message_size = self.max_decoding_message_size;
715 let max_encoding_message_size = self.max_encoding_message_size;
716 let inner = self.inner.clone();
717 let fut = async move {
718 let method = GetSessionCatalogSvc(inner);
719 let codec = tonic_prost::ProstCodec::default();
720 let mut grpc = tonic::server::Grpc::new(codec)
721 .apply_compression_config(
722 accept_compression_encodings,
723 send_compression_encodings,
724 )
725 .apply_max_message_size_config(
726 max_decoding_message_size,
727 max_encoding_message_size,
728 );
729 let res = grpc.unary(method, req).await;
730 Ok(res)
731 };
732 Box::pin(fut)
733 }
734 "/gestalt.provider.v1.IntegrationProvider/PostConnect" => {
735 #[allow(non_camel_case_types)]
736 struct PostConnectSvc<T: IntegrationProvider>(pub Arc<T>);
737 impl<T: IntegrationProvider>
738 tonic::server::UnaryService<super::PostConnectRequest>
739 for PostConnectSvc<T>
740 {
741 type Response = super::PostConnectResponse;
742 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
743 fn call(
744 &mut self,
745 request: tonic::Request<super::PostConnectRequest>,
746 ) -> Self::Future {
747 let inner = Arc::clone(&self.0);
748 let fut = async move {
749 <T as IntegrationProvider>::post_connect(&inner, request).await
750 };
751 Box::pin(fut)
752 }
753 }
754 let accept_compression_encodings = self.accept_compression_encodings;
755 let send_compression_encodings = self.send_compression_encodings;
756 let max_decoding_message_size = self.max_decoding_message_size;
757 let max_encoding_message_size = self.max_encoding_message_size;
758 let inner = self.inner.clone();
759 let fut = async move {
760 let method = PostConnectSvc(inner);
761 let codec = tonic_prost::ProstCodec::default();
762 let mut grpc = tonic::server::Grpc::new(codec)
763 .apply_compression_config(
764 accept_compression_encodings,
765 send_compression_encodings,
766 )
767 .apply_max_message_size_config(
768 max_decoding_message_size,
769 max_encoding_message_size,
770 );
771 let res = grpc.unary(method, req).await;
772 Ok(res)
773 };
774 Box::pin(fut)
775 }
776 _ => Box::pin(async move {
777 let mut response = http::Response::new(tonic::body::Body::default());
778 let headers = response.headers_mut();
779 headers.insert(
780 tonic::Status::GRPC_STATUS,
781 (tonic::Code::Unimplemented as i32).into(),
782 );
783 headers.insert(
784 http::header::CONTENT_TYPE,
785 tonic::metadata::GRPC_CONTENT_TYPE,
786 );
787 Ok(response)
788 }),
789 }
790 }
791 }
792 impl<T> Clone for IntegrationProviderServer<T> {
793 fn clone(&self) -> Self {
794 let inner = self.inner.clone();
795 Self {
796 inner,
797 accept_compression_encodings: self.accept_compression_encodings,
798 send_compression_encodings: self.send_compression_encodings,
799 max_decoding_message_size: self.max_decoding_message_size,
800 max_encoding_message_size: self.max_encoding_message_size,
801 }
802 }
803 }
804 pub const SERVICE_NAME: &str = "gestalt.provider.v1.IntegrationProvider";
806 impl<T> tonic::server::NamedService for IntegrationProviderServer<T> {
807 const NAME: &'static str = SERVICE_NAME;
808 }
809}
810#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
811pub struct ProviderIdentity {
812 #[prost(enumeration = "ProviderKind", tag = "1")]
813 pub kind: i32,
814 #[prost(string, tag = "2")]
815 pub name: ::prost::alloc::string::String,
816 #[prost(string, tag = "3")]
817 pub display_name: ::prost::alloc::string::String,
818 #[prost(string, tag = "4")]
819 pub description: ::prost::alloc::string::String,
820 #[prost(string, tag = "5")]
821 pub version: ::prost::alloc::string::String,
822 #[prost(string, repeated, tag = "6")]
823 pub warnings: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
824 #[prost(int32, tag = "10")]
825 pub min_protocol_version: i32,
826 #[prost(int32, tag = "11")]
827 pub max_protocol_version: i32,
828}
829#[derive(Clone, PartialEq, ::prost::Message)]
830pub struct ConfigureProviderRequest {
831 #[prost(string, tag = "1")]
832 pub name: ::prost::alloc::string::String,
833 #[prost(message, optional, tag = "2")]
834 pub config: ::core::option::Option<::prost_types::Struct>,
835 #[prost(int32, tag = "3")]
836 pub protocol_version: i32,
837}
838#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
839pub struct ConfigureProviderResponse {
840 #[prost(int32, tag = "1")]
841 pub protocol_version: i32,
842}
843#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
844pub struct HealthCheckResponse {
845 #[prost(bool, tag = "1")]
846 pub ready: bool,
847 #[prost(string, tag = "2")]
848 pub message: ::prost::alloc::string::String,
849}
850#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
851#[repr(i32)]
852pub enum ProviderKind {
853 Unspecified = 0,
854 Integration = 1,
855 Auth = 2,
856 Indexeddb = 3,
857 Secrets = 4,
858 Telemetry = 5,
859 Cache = 6,
860 S3 = 7,
861}
862impl ProviderKind {
863 pub fn as_str_name(&self) -> &'static str {
868 match self {
869 Self::Unspecified => "PROVIDER_KIND_UNSPECIFIED",
870 Self::Integration => "PROVIDER_KIND_INTEGRATION",
871 Self::Auth => "PROVIDER_KIND_AUTH",
872 Self::Indexeddb => "PROVIDER_KIND_INDEXEDDB",
873 Self::Secrets => "PROVIDER_KIND_SECRETS",
874 Self::Telemetry => "PROVIDER_KIND_TELEMETRY",
875 Self::Cache => "PROVIDER_KIND_CACHE",
876 Self::S3 => "PROVIDER_KIND_S3",
877 }
878 }
879 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
881 match value {
882 "PROVIDER_KIND_UNSPECIFIED" => Some(Self::Unspecified),
883 "PROVIDER_KIND_INTEGRATION" => Some(Self::Integration),
884 "PROVIDER_KIND_AUTH" => Some(Self::Auth),
885 "PROVIDER_KIND_INDEXEDDB" => Some(Self::Indexeddb),
886 "PROVIDER_KIND_SECRETS" => Some(Self::Secrets),
887 "PROVIDER_KIND_TELEMETRY" => Some(Self::Telemetry),
888 "PROVIDER_KIND_CACHE" => Some(Self::Cache),
889 "PROVIDER_KIND_S3" => Some(Self::S3),
890 _ => None,
891 }
892 }
893}
894pub mod provider_lifecycle_client {
896 #![allow(
897 unused_variables,
898 dead_code,
899 missing_docs,
900 clippy::wildcard_imports,
901 clippy::let_unit_value
902 )]
903 use tonic::codegen::http::Uri;
904 use tonic::codegen::*;
905 #[derive(Debug, Clone)]
906 pub struct ProviderLifecycleClient<T> {
907 inner: tonic::client::Grpc<T>,
908 }
909 impl ProviderLifecycleClient<tonic::transport::Channel> {
910 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
912 where
913 D: TryInto<tonic::transport::Endpoint>,
914 D::Error: Into<StdError>,
915 {
916 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
917 Ok(Self::new(conn))
918 }
919 }
920 impl<T> ProviderLifecycleClient<T>
921 where
922 T: tonic::client::GrpcService<tonic::body::Body>,
923 T::Error: Into<StdError>,
924 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
925 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
926 {
927 pub fn new(inner: T) -> Self {
928 let inner = tonic::client::Grpc::new(inner);
929 Self { inner }
930 }
931 pub fn with_origin(inner: T, origin: Uri) -> Self {
932 let inner = tonic::client::Grpc::with_origin(inner, origin);
933 Self { inner }
934 }
935 pub fn with_interceptor<F>(
936 inner: T,
937 interceptor: F,
938 ) -> ProviderLifecycleClient<InterceptedService<T, F>>
939 where
940 F: tonic::service::Interceptor,
941 T::ResponseBody: Default,
942 T: tonic::codegen::Service<
943 http::Request<tonic::body::Body>,
944 Response = http::Response<
945 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
946 >,
947 >,
948 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
949 Into<StdError> + std::marker::Send + std::marker::Sync,
950 {
951 ProviderLifecycleClient::new(InterceptedService::new(inner, interceptor))
952 }
953 #[must_use]
958 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
959 self.inner = self.inner.send_compressed(encoding);
960 self
961 }
962 #[must_use]
964 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
965 self.inner = self.inner.accept_compressed(encoding);
966 self
967 }
968 #[must_use]
972 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
973 self.inner = self.inner.max_decoding_message_size(limit);
974 self
975 }
976 #[must_use]
980 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
981 self.inner = self.inner.max_encoding_message_size(limit);
982 self
983 }
984 pub async fn get_provider_identity(
985 &mut self,
986 request: impl tonic::IntoRequest<()>,
987 ) -> std::result::Result<tonic::Response<super::ProviderIdentity>, tonic::Status> {
988 self.inner.ready().await.map_err(|e| {
989 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
990 })?;
991 let codec = tonic_prost::ProstCodec::default();
992 let path = http::uri::PathAndQuery::from_static(
993 "/gestalt.provider.v1.ProviderLifecycle/GetProviderIdentity",
994 );
995 let mut req = request.into_request();
996 req.extensions_mut().insert(GrpcMethod::new(
997 "gestalt.provider.v1.ProviderLifecycle",
998 "GetProviderIdentity",
999 ));
1000 self.inner.unary(req, path, codec).await
1001 }
1002 pub async fn configure_provider(
1003 &mut self,
1004 request: impl tonic::IntoRequest<super::ConfigureProviderRequest>,
1005 ) -> std::result::Result<tonic::Response<super::ConfigureProviderResponse>, tonic::Status>
1006 {
1007 self.inner.ready().await.map_err(|e| {
1008 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1009 })?;
1010 let codec = tonic_prost::ProstCodec::default();
1011 let path = http::uri::PathAndQuery::from_static(
1012 "/gestalt.provider.v1.ProviderLifecycle/ConfigureProvider",
1013 );
1014 let mut req = request.into_request();
1015 req.extensions_mut().insert(GrpcMethod::new(
1016 "gestalt.provider.v1.ProviderLifecycle",
1017 "ConfigureProvider",
1018 ));
1019 self.inner.unary(req, path, codec).await
1020 }
1021 pub async fn health_check(
1022 &mut self,
1023 request: impl tonic::IntoRequest<()>,
1024 ) -> std::result::Result<tonic::Response<super::HealthCheckResponse>, tonic::Status>
1025 {
1026 self.inner.ready().await.map_err(|e| {
1027 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1028 })?;
1029 let codec = tonic_prost::ProstCodec::default();
1030 let path = http::uri::PathAndQuery::from_static(
1031 "/gestalt.provider.v1.ProviderLifecycle/HealthCheck",
1032 );
1033 let mut req = request.into_request();
1034 req.extensions_mut().insert(GrpcMethod::new(
1035 "gestalt.provider.v1.ProviderLifecycle",
1036 "HealthCheck",
1037 ));
1038 self.inner.unary(req, path, codec).await
1039 }
1040 }
1041}
1042pub mod provider_lifecycle_server {
1044 #![allow(
1045 unused_variables,
1046 dead_code,
1047 missing_docs,
1048 clippy::wildcard_imports,
1049 clippy::let_unit_value
1050 )]
1051 use tonic::codegen::*;
1052 #[async_trait]
1054 pub trait ProviderLifecycle: std::marker::Send + std::marker::Sync + 'static {
1055 async fn get_provider_identity(
1056 &self,
1057 request: tonic::Request<()>,
1058 ) -> std::result::Result<tonic::Response<super::ProviderIdentity>, tonic::Status>;
1059 async fn configure_provider(
1060 &self,
1061 request: tonic::Request<super::ConfigureProviderRequest>,
1062 ) -> std::result::Result<tonic::Response<super::ConfigureProviderResponse>, tonic::Status>;
1063 async fn health_check(
1064 &self,
1065 request: tonic::Request<()>,
1066 ) -> std::result::Result<tonic::Response<super::HealthCheckResponse>, tonic::Status>;
1067 }
1068 #[derive(Debug)]
1069 pub struct ProviderLifecycleServer<T> {
1070 inner: Arc<T>,
1071 accept_compression_encodings: EnabledCompressionEncodings,
1072 send_compression_encodings: EnabledCompressionEncodings,
1073 max_decoding_message_size: Option<usize>,
1074 max_encoding_message_size: Option<usize>,
1075 }
1076 impl<T> ProviderLifecycleServer<T> {
1077 pub fn new(inner: T) -> Self {
1078 Self::from_arc(Arc::new(inner))
1079 }
1080 pub fn from_arc(inner: Arc<T>) -> Self {
1081 Self {
1082 inner,
1083 accept_compression_encodings: Default::default(),
1084 send_compression_encodings: Default::default(),
1085 max_decoding_message_size: None,
1086 max_encoding_message_size: None,
1087 }
1088 }
1089 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
1090 where
1091 F: tonic::service::Interceptor,
1092 {
1093 InterceptedService::new(Self::new(inner), interceptor)
1094 }
1095 #[must_use]
1097 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1098 self.accept_compression_encodings.enable(encoding);
1099 self
1100 }
1101 #[must_use]
1103 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1104 self.send_compression_encodings.enable(encoding);
1105 self
1106 }
1107 #[must_use]
1111 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1112 self.max_decoding_message_size = Some(limit);
1113 self
1114 }
1115 #[must_use]
1119 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1120 self.max_encoding_message_size = Some(limit);
1121 self
1122 }
1123 }
1124 impl<T, B> tonic::codegen::Service<http::Request<B>> for ProviderLifecycleServer<T>
1125 where
1126 T: ProviderLifecycle,
1127 B: Body + std::marker::Send + 'static,
1128 B::Error: Into<StdError> + std::marker::Send + 'static,
1129 {
1130 type Response = http::Response<tonic::body::Body>;
1131 type Error = std::convert::Infallible;
1132 type Future = BoxFuture<Self::Response, Self::Error>;
1133 fn poll_ready(
1134 &mut self,
1135 _cx: &mut Context<'_>,
1136 ) -> Poll<std::result::Result<(), Self::Error>> {
1137 Poll::Ready(Ok(()))
1138 }
1139 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1140 match req.uri().path() {
1141 "/gestalt.provider.v1.ProviderLifecycle/GetProviderIdentity" => {
1142 #[allow(non_camel_case_types)]
1143 struct GetProviderIdentitySvc<T: ProviderLifecycle>(pub Arc<T>);
1144 impl<T: ProviderLifecycle> tonic::server::UnaryService<()> for GetProviderIdentitySvc<T> {
1145 type Response = super::ProviderIdentity;
1146 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1147 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1148 let inner = Arc::clone(&self.0);
1149 let fut = async move {
1150 <T as ProviderLifecycle>::get_provider_identity(&inner, request)
1151 .await
1152 };
1153 Box::pin(fut)
1154 }
1155 }
1156 let accept_compression_encodings = self.accept_compression_encodings;
1157 let send_compression_encodings = self.send_compression_encodings;
1158 let max_decoding_message_size = self.max_decoding_message_size;
1159 let max_encoding_message_size = self.max_encoding_message_size;
1160 let inner = self.inner.clone();
1161 let fut = async move {
1162 let method = GetProviderIdentitySvc(inner);
1163 let codec = tonic_prost::ProstCodec::default();
1164 let mut grpc = tonic::server::Grpc::new(codec)
1165 .apply_compression_config(
1166 accept_compression_encodings,
1167 send_compression_encodings,
1168 )
1169 .apply_max_message_size_config(
1170 max_decoding_message_size,
1171 max_encoding_message_size,
1172 );
1173 let res = grpc.unary(method, req).await;
1174 Ok(res)
1175 };
1176 Box::pin(fut)
1177 }
1178 "/gestalt.provider.v1.ProviderLifecycle/ConfigureProvider" => {
1179 #[allow(non_camel_case_types)]
1180 struct ConfigureProviderSvc<T: ProviderLifecycle>(pub Arc<T>);
1181 impl<T: ProviderLifecycle>
1182 tonic::server::UnaryService<super::ConfigureProviderRequest>
1183 for ConfigureProviderSvc<T>
1184 {
1185 type Response = super::ConfigureProviderResponse;
1186 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1187 fn call(
1188 &mut self,
1189 request: tonic::Request<super::ConfigureProviderRequest>,
1190 ) -> Self::Future {
1191 let inner = Arc::clone(&self.0);
1192 let fut = async move {
1193 <T as ProviderLifecycle>::configure_provider(&inner, request).await
1194 };
1195 Box::pin(fut)
1196 }
1197 }
1198 let accept_compression_encodings = self.accept_compression_encodings;
1199 let send_compression_encodings = self.send_compression_encodings;
1200 let max_decoding_message_size = self.max_decoding_message_size;
1201 let max_encoding_message_size = self.max_encoding_message_size;
1202 let inner = self.inner.clone();
1203 let fut = async move {
1204 let method = ConfigureProviderSvc(inner);
1205 let codec = tonic_prost::ProstCodec::default();
1206 let mut grpc = tonic::server::Grpc::new(codec)
1207 .apply_compression_config(
1208 accept_compression_encodings,
1209 send_compression_encodings,
1210 )
1211 .apply_max_message_size_config(
1212 max_decoding_message_size,
1213 max_encoding_message_size,
1214 );
1215 let res = grpc.unary(method, req).await;
1216 Ok(res)
1217 };
1218 Box::pin(fut)
1219 }
1220 "/gestalt.provider.v1.ProviderLifecycle/HealthCheck" => {
1221 #[allow(non_camel_case_types)]
1222 struct HealthCheckSvc<T: ProviderLifecycle>(pub Arc<T>);
1223 impl<T: ProviderLifecycle> tonic::server::UnaryService<()> for HealthCheckSvc<T> {
1224 type Response = super::HealthCheckResponse;
1225 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1226 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1227 let inner = Arc::clone(&self.0);
1228 let fut = async move {
1229 <T as ProviderLifecycle>::health_check(&inner, request).await
1230 };
1231 Box::pin(fut)
1232 }
1233 }
1234 let accept_compression_encodings = self.accept_compression_encodings;
1235 let send_compression_encodings = self.send_compression_encodings;
1236 let max_decoding_message_size = self.max_decoding_message_size;
1237 let max_encoding_message_size = self.max_encoding_message_size;
1238 let inner = self.inner.clone();
1239 let fut = async move {
1240 let method = HealthCheckSvc(inner);
1241 let codec = tonic_prost::ProstCodec::default();
1242 let mut grpc = tonic::server::Grpc::new(codec)
1243 .apply_compression_config(
1244 accept_compression_encodings,
1245 send_compression_encodings,
1246 )
1247 .apply_max_message_size_config(
1248 max_decoding_message_size,
1249 max_encoding_message_size,
1250 );
1251 let res = grpc.unary(method, req).await;
1252 Ok(res)
1253 };
1254 Box::pin(fut)
1255 }
1256 _ => Box::pin(async move {
1257 let mut response = http::Response::new(tonic::body::Body::default());
1258 let headers = response.headers_mut();
1259 headers.insert(
1260 tonic::Status::GRPC_STATUS,
1261 (tonic::Code::Unimplemented as i32).into(),
1262 );
1263 headers.insert(
1264 http::header::CONTENT_TYPE,
1265 tonic::metadata::GRPC_CONTENT_TYPE,
1266 );
1267 Ok(response)
1268 }),
1269 }
1270 }
1271 }
1272 impl<T> Clone for ProviderLifecycleServer<T> {
1273 fn clone(&self) -> Self {
1274 let inner = self.inner.clone();
1275 Self {
1276 inner,
1277 accept_compression_encodings: self.accept_compression_encodings,
1278 send_compression_encodings: self.send_compression_encodings,
1279 max_decoding_message_size: self.max_decoding_message_size,
1280 max_encoding_message_size: self.max_encoding_message_size,
1281 }
1282 }
1283 }
1284 pub const SERVICE_NAME: &str = "gestalt.provider.v1.ProviderLifecycle";
1286 impl<T> tonic::server::NamedService for ProviderLifecycleServer<T> {
1287 const NAME: &'static str = SERVICE_NAME;
1288 }
1289}
1290#[derive(Clone, PartialEq, ::prost::Message)]
1291pub struct AuthenticatedUser {
1292 #[prost(string, tag = "1")]
1293 pub subject: ::prost::alloc::string::String,
1294 #[prost(string, tag = "2")]
1295 pub email: ::prost::alloc::string::String,
1296 #[prost(bool, tag = "3")]
1297 pub email_verified: bool,
1298 #[prost(string, tag = "4")]
1299 pub display_name: ::prost::alloc::string::String,
1300 #[prost(string, tag = "5")]
1301 pub avatar_url: ::prost::alloc::string::String,
1302 #[prost(btree_map = "string, string", tag = "6")]
1303 pub claims: ::prost::alloc::collections::BTreeMap<
1304 ::prost::alloc::string::String,
1305 ::prost::alloc::string::String,
1306 >,
1307}
1308#[derive(Clone, PartialEq, ::prost::Message)]
1309pub struct BeginLoginRequest {
1310 #[prost(string, tag = "1")]
1311 pub callback_url: ::prost::alloc::string::String,
1312 #[prost(string, tag = "2")]
1313 pub host_state: ::prost::alloc::string::String,
1314 #[prost(string, repeated, tag = "3")]
1315 pub scopes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1316 #[prost(btree_map = "string, string", tag = "4")]
1317 pub options: ::prost::alloc::collections::BTreeMap<
1318 ::prost::alloc::string::String,
1319 ::prost::alloc::string::String,
1320 >,
1321}
1322#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1323pub struct BeginLoginResponse {
1324 #[prost(string, tag = "1")]
1325 pub authorization_url: ::prost::alloc::string::String,
1326 #[prost(bytes = "vec", tag = "2")]
1327 pub provider_state: ::prost::alloc::vec::Vec<u8>,
1328}
1329#[derive(Clone, PartialEq, ::prost::Message)]
1330pub struct CompleteLoginRequest {
1331 #[prost(btree_map = "string, string", tag = "1")]
1332 pub query: ::prost::alloc::collections::BTreeMap<
1333 ::prost::alloc::string::String,
1334 ::prost::alloc::string::String,
1335 >,
1336 #[prost(bytes = "vec", tag = "2")]
1337 pub provider_state: ::prost::alloc::vec::Vec<u8>,
1338 #[prost(string, tag = "3")]
1339 pub callback_url: ::prost::alloc::string::String,
1340}
1341#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1342pub struct ValidateExternalTokenRequest {
1343 #[prost(string, tag = "1")]
1344 pub token: ::prost::alloc::string::String,
1345}
1346#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1347pub struct AuthSessionSettings {
1348 #[prost(int64, tag = "1")]
1349 pub session_ttl_seconds: i64,
1350}
1351pub mod auth_provider_client {
1353 #![allow(
1354 unused_variables,
1355 dead_code,
1356 missing_docs,
1357 clippy::wildcard_imports,
1358 clippy::let_unit_value
1359 )]
1360 use tonic::codegen::http::Uri;
1361 use tonic::codegen::*;
1362 #[derive(Debug, Clone)]
1363 pub struct AuthProviderClient<T> {
1364 inner: tonic::client::Grpc<T>,
1365 }
1366 impl AuthProviderClient<tonic::transport::Channel> {
1367 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1369 where
1370 D: TryInto<tonic::transport::Endpoint>,
1371 D::Error: Into<StdError>,
1372 {
1373 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1374 Ok(Self::new(conn))
1375 }
1376 }
1377 impl<T> AuthProviderClient<T>
1378 where
1379 T: tonic::client::GrpcService<tonic::body::Body>,
1380 T::Error: Into<StdError>,
1381 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1382 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1383 {
1384 pub fn new(inner: T) -> Self {
1385 let inner = tonic::client::Grpc::new(inner);
1386 Self { inner }
1387 }
1388 pub fn with_origin(inner: T, origin: Uri) -> Self {
1389 let inner = tonic::client::Grpc::with_origin(inner, origin);
1390 Self { inner }
1391 }
1392 pub fn with_interceptor<F>(
1393 inner: T,
1394 interceptor: F,
1395 ) -> AuthProviderClient<InterceptedService<T, F>>
1396 where
1397 F: tonic::service::Interceptor,
1398 T::ResponseBody: Default,
1399 T: tonic::codegen::Service<
1400 http::Request<tonic::body::Body>,
1401 Response = http::Response<
1402 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1403 >,
1404 >,
1405 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
1406 Into<StdError> + std::marker::Send + std::marker::Sync,
1407 {
1408 AuthProviderClient::new(InterceptedService::new(inner, interceptor))
1409 }
1410 #[must_use]
1415 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1416 self.inner = self.inner.send_compressed(encoding);
1417 self
1418 }
1419 #[must_use]
1421 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1422 self.inner = self.inner.accept_compressed(encoding);
1423 self
1424 }
1425 #[must_use]
1429 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1430 self.inner = self.inner.max_decoding_message_size(limit);
1431 self
1432 }
1433 #[must_use]
1437 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1438 self.inner = self.inner.max_encoding_message_size(limit);
1439 self
1440 }
1441 pub async fn begin_login(
1442 &mut self,
1443 request: impl tonic::IntoRequest<super::BeginLoginRequest>,
1444 ) -> std::result::Result<tonic::Response<super::BeginLoginResponse>, tonic::Status>
1445 {
1446 self.inner.ready().await.map_err(|e| {
1447 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1448 })?;
1449 let codec = tonic_prost::ProstCodec::default();
1450 let path = http::uri::PathAndQuery::from_static(
1451 "/gestalt.provider.v1.AuthProvider/BeginLogin",
1452 );
1453 let mut req = request.into_request();
1454 req.extensions_mut().insert(GrpcMethod::new(
1455 "gestalt.provider.v1.AuthProvider",
1456 "BeginLogin",
1457 ));
1458 self.inner.unary(req, path, codec).await
1459 }
1460 pub async fn complete_login(
1461 &mut self,
1462 request: impl tonic::IntoRequest<super::CompleteLoginRequest>,
1463 ) -> std::result::Result<tonic::Response<super::AuthenticatedUser>, tonic::Status> {
1464 self.inner.ready().await.map_err(|e| {
1465 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1466 })?;
1467 let codec = tonic_prost::ProstCodec::default();
1468 let path = http::uri::PathAndQuery::from_static(
1469 "/gestalt.provider.v1.AuthProvider/CompleteLogin",
1470 );
1471 let mut req = request.into_request();
1472 req.extensions_mut().insert(GrpcMethod::new(
1473 "gestalt.provider.v1.AuthProvider",
1474 "CompleteLogin",
1475 ));
1476 self.inner.unary(req, path, codec).await
1477 }
1478 pub async fn validate_external_token(
1479 &mut self,
1480 request: impl tonic::IntoRequest<super::ValidateExternalTokenRequest>,
1481 ) -> std::result::Result<tonic::Response<super::AuthenticatedUser>, tonic::Status> {
1482 self.inner.ready().await.map_err(|e| {
1483 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1484 })?;
1485 let codec = tonic_prost::ProstCodec::default();
1486 let path = http::uri::PathAndQuery::from_static(
1487 "/gestalt.provider.v1.AuthProvider/ValidateExternalToken",
1488 );
1489 let mut req = request.into_request();
1490 req.extensions_mut().insert(GrpcMethod::new(
1491 "gestalt.provider.v1.AuthProvider",
1492 "ValidateExternalToken",
1493 ));
1494 self.inner.unary(req, path, codec).await
1495 }
1496 pub async fn get_session_settings(
1497 &mut self,
1498 request: impl tonic::IntoRequest<()>,
1499 ) -> std::result::Result<tonic::Response<super::AuthSessionSettings>, tonic::Status>
1500 {
1501 self.inner.ready().await.map_err(|e| {
1502 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1503 })?;
1504 let codec = tonic_prost::ProstCodec::default();
1505 let path = http::uri::PathAndQuery::from_static(
1506 "/gestalt.provider.v1.AuthProvider/GetSessionSettings",
1507 );
1508 let mut req = request.into_request();
1509 req.extensions_mut().insert(GrpcMethod::new(
1510 "gestalt.provider.v1.AuthProvider",
1511 "GetSessionSettings",
1512 ));
1513 self.inner.unary(req, path, codec).await
1514 }
1515 }
1516}
1517pub mod auth_provider_server {
1519 #![allow(
1520 unused_variables,
1521 dead_code,
1522 missing_docs,
1523 clippy::wildcard_imports,
1524 clippy::let_unit_value
1525 )]
1526 use tonic::codegen::*;
1527 #[async_trait]
1529 pub trait AuthProvider: std::marker::Send + std::marker::Sync + 'static {
1530 async fn begin_login(
1531 &self,
1532 request: tonic::Request<super::BeginLoginRequest>,
1533 ) -> std::result::Result<tonic::Response<super::BeginLoginResponse>, tonic::Status>;
1534 async fn complete_login(
1535 &self,
1536 request: tonic::Request<super::CompleteLoginRequest>,
1537 ) -> std::result::Result<tonic::Response<super::AuthenticatedUser>, tonic::Status>;
1538 async fn validate_external_token(
1539 &self,
1540 request: tonic::Request<super::ValidateExternalTokenRequest>,
1541 ) -> std::result::Result<tonic::Response<super::AuthenticatedUser>, tonic::Status>;
1542 async fn get_session_settings(
1543 &self,
1544 request: tonic::Request<()>,
1545 ) -> std::result::Result<tonic::Response<super::AuthSessionSettings>, tonic::Status>;
1546 }
1547 #[derive(Debug)]
1548 pub struct AuthProviderServer<T> {
1549 inner: Arc<T>,
1550 accept_compression_encodings: EnabledCompressionEncodings,
1551 send_compression_encodings: EnabledCompressionEncodings,
1552 max_decoding_message_size: Option<usize>,
1553 max_encoding_message_size: Option<usize>,
1554 }
1555 impl<T> AuthProviderServer<T> {
1556 pub fn new(inner: T) -> Self {
1557 Self::from_arc(Arc::new(inner))
1558 }
1559 pub fn from_arc(inner: Arc<T>) -> Self {
1560 Self {
1561 inner,
1562 accept_compression_encodings: Default::default(),
1563 send_compression_encodings: Default::default(),
1564 max_decoding_message_size: None,
1565 max_encoding_message_size: None,
1566 }
1567 }
1568 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
1569 where
1570 F: tonic::service::Interceptor,
1571 {
1572 InterceptedService::new(Self::new(inner), interceptor)
1573 }
1574 #[must_use]
1576 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1577 self.accept_compression_encodings.enable(encoding);
1578 self
1579 }
1580 #[must_use]
1582 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1583 self.send_compression_encodings.enable(encoding);
1584 self
1585 }
1586 #[must_use]
1590 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1591 self.max_decoding_message_size = Some(limit);
1592 self
1593 }
1594 #[must_use]
1598 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1599 self.max_encoding_message_size = Some(limit);
1600 self
1601 }
1602 }
1603 impl<T, B> tonic::codegen::Service<http::Request<B>> for AuthProviderServer<T>
1604 where
1605 T: AuthProvider,
1606 B: Body + std::marker::Send + 'static,
1607 B::Error: Into<StdError> + std::marker::Send + 'static,
1608 {
1609 type Response = http::Response<tonic::body::Body>;
1610 type Error = std::convert::Infallible;
1611 type Future = BoxFuture<Self::Response, Self::Error>;
1612 fn poll_ready(
1613 &mut self,
1614 _cx: &mut Context<'_>,
1615 ) -> Poll<std::result::Result<(), Self::Error>> {
1616 Poll::Ready(Ok(()))
1617 }
1618 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1619 match req.uri().path() {
1620 "/gestalt.provider.v1.AuthProvider/BeginLogin" => {
1621 #[allow(non_camel_case_types)]
1622 struct BeginLoginSvc<T: AuthProvider>(pub Arc<T>);
1623 impl<T: AuthProvider> tonic::server::UnaryService<super::BeginLoginRequest> for BeginLoginSvc<T> {
1624 type Response = super::BeginLoginResponse;
1625 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1626 fn call(
1627 &mut self,
1628 request: tonic::Request<super::BeginLoginRequest>,
1629 ) -> Self::Future {
1630 let inner = Arc::clone(&self.0);
1631 let fut = async move {
1632 <T as AuthProvider>::begin_login(&inner, request).await
1633 };
1634 Box::pin(fut)
1635 }
1636 }
1637 let accept_compression_encodings = self.accept_compression_encodings;
1638 let send_compression_encodings = self.send_compression_encodings;
1639 let max_decoding_message_size = self.max_decoding_message_size;
1640 let max_encoding_message_size = self.max_encoding_message_size;
1641 let inner = self.inner.clone();
1642 let fut = async move {
1643 let method = BeginLoginSvc(inner);
1644 let codec = tonic_prost::ProstCodec::default();
1645 let mut grpc = tonic::server::Grpc::new(codec)
1646 .apply_compression_config(
1647 accept_compression_encodings,
1648 send_compression_encodings,
1649 )
1650 .apply_max_message_size_config(
1651 max_decoding_message_size,
1652 max_encoding_message_size,
1653 );
1654 let res = grpc.unary(method, req).await;
1655 Ok(res)
1656 };
1657 Box::pin(fut)
1658 }
1659 "/gestalt.provider.v1.AuthProvider/CompleteLogin" => {
1660 #[allow(non_camel_case_types)]
1661 struct CompleteLoginSvc<T: AuthProvider>(pub Arc<T>);
1662 impl<T: AuthProvider> tonic::server::UnaryService<super::CompleteLoginRequest>
1663 for CompleteLoginSvc<T>
1664 {
1665 type Response = super::AuthenticatedUser;
1666 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1667 fn call(
1668 &mut self,
1669 request: tonic::Request<super::CompleteLoginRequest>,
1670 ) -> Self::Future {
1671 let inner = Arc::clone(&self.0);
1672 let fut = async move {
1673 <T as AuthProvider>::complete_login(&inner, request).await
1674 };
1675 Box::pin(fut)
1676 }
1677 }
1678 let accept_compression_encodings = self.accept_compression_encodings;
1679 let send_compression_encodings = self.send_compression_encodings;
1680 let max_decoding_message_size = self.max_decoding_message_size;
1681 let max_encoding_message_size = self.max_encoding_message_size;
1682 let inner = self.inner.clone();
1683 let fut = async move {
1684 let method = CompleteLoginSvc(inner);
1685 let codec = tonic_prost::ProstCodec::default();
1686 let mut grpc = tonic::server::Grpc::new(codec)
1687 .apply_compression_config(
1688 accept_compression_encodings,
1689 send_compression_encodings,
1690 )
1691 .apply_max_message_size_config(
1692 max_decoding_message_size,
1693 max_encoding_message_size,
1694 );
1695 let res = grpc.unary(method, req).await;
1696 Ok(res)
1697 };
1698 Box::pin(fut)
1699 }
1700 "/gestalt.provider.v1.AuthProvider/ValidateExternalToken" => {
1701 #[allow(non_camel_case_types)]
1702 struct ValidateExternalTokenSvc<T: AuthProvider>(pub Arc<T>);
1703 impl<T: AuthProvider>
1704 tonic::server::UnaryService<super::ValidateExternalTokenRequest>
1705 for ValidateExternalTokenSvc<T>
1706 {
1707 type Response = super::AuthenticatedUser;
1708 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1709 fn call(
1710 &mut self,
1711 request: tonic::Request<super::ValidateExternalTokenRequest>,
1712 ) -> Self::Future {
1713 let inner = Arc::clone(&self.0);
1714 let fut = async move {
1715 <T as AuthProvider>::validate_external_token(&inner, request).await
1716 };
1717 Box::pin(fut)
1718 }
1719 }
1720 let accept_compression_encodings = self.accept_compression_encodings;
1721 let send_compression_encodings = self.send_compression_encodings;
1722 let max_decoding_message_size = self.max_decoding_message_size;
1723 let max_encoding_message_size = self.max_encoding_message_size;
1724 let inner = self.inner.clone();
1725 let fut = async move {
1726 let method = ValidateExternalTokenSvc(inner);
1727 let codec = tonic_prost::ProstCodec::default();
1728 let mut grpc = tonic::server::Grpc::new(codec)
1729 .apply_compression_config(
1730 accept_compression_encodings,
1731 send_compression_encodings,
1732 )
1733 .apply_max_message_size_config(
1734 max_decoding_message_size,
1735 max_encoding_message_size,
1736 );
1737 let res = grpc.unary(method, req).await;
1738 Ok(res)
1739 };
1740 Box::pin(fut)
1741 }
1742 "/gestalt.provider.v1.AuthProvider/GetSessionSettings" => {
1743 #[allow(non_camel_case_types)]
1744 struct GetSessionSettingsSvc<T: AuthProvider>(pub Arc<T>);
1745 impl<T: AuthProvider> tonic::server::UnaryService<()> for GetSessionSettingsSvc<T> {
1746 type Response = super::AuthSessionSettings;
1747 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
1748 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1749 let inner = Arc::clone(&self.0);
1750 let fut = async move {
1751 <T as AuthProvider>::get_session_settings(&inner, request).await
1752 };
1753 Box::pin(fut)
1754 }
1755 }
1756 let accept_compression_encodings = self.accept_compression_encodings;
1757 let send_compression_encodings = self.send_compression_encodings;
1758 let max_decoding_message_size = self.max_decoding_message_size;
1759 let max_encoding_message_size = self.max_encoding_message_size;
1760 let inner = self.inner.clone();
1761 let fut = async move {
1762 let method = GetSessionSettingsSvc(inner);
1763 let codec = tonic_prost::ProstCodec::default();
1764 let mut grpc = tonic::server::Grpc::new(codec)
1765 .apply_compression_config(
1766 accept_compression_encodings,
1767 send_compression_encodings,
1768 )
1769 .apply_max_message_size_config(
1770 max_decoding_message_size,
1771 max_encoding_message_size,
1772 );
1773 let res = grpc.unary(method, req).await;
1774 Ok(res)
1775 };
1776 Box::pin(fut)
1777 }
1778 _ => Box::pin(async move {
1779 let mut response = http::Response::new(tonic::body::Body::default());
1780 let headers = response.headers_mut();
1781 headers.insert(
1782 tonic::Status::GRPC_STATUS,
1783 (tonic::Code::Unimplemented as i32).into(),
1784 );
1785 headers.insert(
1786 http::header::CONTENT_TYPE,
1787 tonic::metadata::GRPC_CONTENT_TYPE,
1788 );
1789 Ok(response)
1790 }),
1791 }
1792 }
1793 }
1794 impl<T> Clone for AuthProviderServer<T> {
1795 fn clone(&self) -> Self {
1796 let inner = self.inner.clone();
1797 Self {
1798 inner,
1799 accept_compression_encodings: self.accept_compression_encodings,
1800 send_compression_encodings: self.send_compression_encodings,
1801 max_decoding_message_size: self.max_decoding_message_size,
1802 max_encoding_message_size: self.max_encoding_message_size,
1803 }
1804 }
1805 }
1806 pub const SERVICE_NAME: &str = "gestalt.provider.v1.AuthProvider";
1808 impl<T> tonic::server::NamedService for AuthProviderServer<T> {
1809 const NAME: &'static str = SERVICE_NAME;
1810 }
1811}
1812#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1813pub struct CacheSetEntry {
1814 #[prost(string, tag = "1")]
1815 pub key: ::prost::alloc::string::String,
1816 #[prost(bytes = "vec", tag = "2")]
1817 pub value: ::prost::alloc::vec::Vec<u8>,
1818}
1819#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1820pub struct CacheResult {
1821 #[prost(string, tag = "1")]
1822 pub key: ::prost::alloc::string::String,
1823 #[prost(bool, tag = "2")]
1824 pub found: bool,
1825 #[prost(bytes = "vec", tag = "3")]
1826 pub value: ::prost::alloc::vec::Vec<u8>,
1827}
1828#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1829pub struct CacheGetRequest {
1830 #[prost(string, tag = "1")]
1831 pub key: ::prost::alloc::string::String,
1832}
1833#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1834pub struct CacheGetResponse {
1835 #[prost(bool, tag = "1")]
1836 pub found: bool,
1837 #[prost(bytes = "vec", tag = "2")]
1838 pub value: ::prost::alloc::vec::Vec<u8>,
1839}
1840#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1841pub struct CacheGetManyRequest {
1842 #[prost(string, repeated, tag = "1")]
1843 pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1844}
1845#[derive(Clone, PartialEq, ::prost::Message)]
1846pub struct CacheGetManyResponse {
1847 #[prost(message, repeated, tag = "1")]
1848 pub entries: ::prost::alloc::vec::Vec<CacheResult>,
1849}
1850#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1851pub struct CacheSetRequest {
1852 #[prost(string, tag = "1")]
1853 pub key: ::prost::alloc::string::String,
1854 #[prost(bytes = "vec", tag = "2")]
1855 pub value: ::prost::alloc::vec::Vec<u8>,
1856 #[prost(message, optional, tag = "3")]
1857 pub ttl: ::core::option::Option<::prost_types::Duration>,
1858}
1859#[derive(Clone, PartialEq, ::prost::Message)]
1860pub struct CacheSetManyRequest {
1861 #[prost(message, repeated, tag = "1")]
1862 pub entries: ::prost::alloc::vec::Vec<CacheSetEntry>,
1863 #[prost(message, optional, tag = "2")]
1864 pub ttl: ::core::option::Option<::prost_types::Duration>,
1865}
1866#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1867pub struct CacheDeleteRequest {
1868 #[prost(string, tag = "1")]
1869 pub key: ::prost::alloc::string::String,
1870}
1871#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1872pub struct CacheDeleteResponse {
1873 #[prost(bool, tag = "1")]
1874 pub deleted: bool,
1875}
1876#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1877pub struct CacheDeleteManyRequest {
1878 #[prost(string, repeated, tag = "1")]
1879 pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1880}
1881#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1882pub struct CacheDeleteManyResponse {
1883 #[prost(int64, tag = "1")]
1884 pub deleted: i64,
1885}
1886#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1887pub struct CacheTouchRequest {
1888 #[prost(string, tag = "1")]
1889 pub key: ::prost::alloc::string::String,
1890 #[prost(message, optional, tag = "2")]
1891 pub ttl: ::core::option::Option<::prost_types::Duration>,
1892}
1893#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1894pub struct CacheTouchResponse {
1895 #[prost(bool, tag = "1")]
1896 pub touched: bool,
1897}
1898pub mod cache_client {
1900 #![allow(
1901 unused_variables,
1902 dead_code,
1903 missing_docs,
1904 clippy::wildcard_imports,
1905 clippy::let_unit_value
1906 )]
1907 use tonic::codegen::http::Uri;
1908 use tonic::codegen::*;
1909 #[derive(Debug, Clone)]
1910 pub struct CacheClient<T> {
1911 inner: tonic::client::Grpc<T>,
1912 }
1913 impl CacheClient<tonic::transport::Channel> {
1914 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1916 where
1917 D: TryInto<tonic::transport::Endpoint>,
1918 D::Error: Into<StdError>,
1919 {
1920 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1921 Ok(Self::new(conn))
1922 }
1923 }
1924 impl<T> CacheClient<T>
1925 where
1926 T: tonic::client::GrpcService<tonic::body::Body>,
1927 T::Error: Into<StdError>,
1928 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1929 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1930 {
1931 pub fn new(inner: T) -> Self {
1932 let inner = tonic::client::Grpc::new(inner);
1933 Self { inner }
1934 }
1935 pub fn with_origin(inner: T, origin: Uri) -> Self {
1936 let inner = tonic::client::Grpc::with_origin(inner, origin);
1937 Self { inner }
1938 }
1939 pub fn with_interceptor<F>(
1940 inner: T,
1941 interceptor: F,
1942 ) -> CacheClient<InterceptedService<T, F>>
1943 where
1944 F: tonic::service::Interceptor,
1945 T::ResponseBody: Default,
1946 T: tonic::codegen::Service<
1947 http::Request<tonic::body::Body>,
1948 Response = http::Response<
1949 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1950 >,
1951 >,
1952 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
1953 Into<StdError> + std::marker::Send + std::marker::Sync,
1954 {
1955 CacheClient::new(InterceptedService::new(inner, interceptor))
1956 }
1957 #[must_use]
1962 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1963 self.inner = self.inner.send_compressed(encoding);
1964 self
1965 }
1966 #[must_use]
1968 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1969 self.inner = self.inner.accept_compressed(encoding);
1970 self
1971 }
1972 #[must_use]
1976 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1977 self.inner = self.inner.max_decoding_message_size(limit);
1978 self
1979 }
1980 #[must_use]
1984 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1985 self.inner = self.inner.max_encoding_message_size(limit);
1986 self
1987 }
1988 pub async fn get(
1989 &mut self,
1990 request: impl tonic::IntoRequest<super::CacheGetRequest>,
1991 ) -> std::result::Result<tonic::Response<super::CacheGetResponse>, tonic::Status> {
1992 self.inner.ready().await.map_err(|e| {
1993 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
1994 })?;
1995 let codec = tonic_prost::ProstCodec::default();
1996 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/Get");
1997 let mut req = request.into_request();
1998 req.extensions_mut()
1999 .insert(GrpcMethod::new("gestalt.provider.v1.Cache", "Get"));
2000 self.inner.unary(req, path, codec).await
2001 }
2002 pub async fn get_many(
2003 &mut self,
2004 request: impl tonic::IntoRequest<super::CacheGetManyRequest>,
2005 ) -> std::result::Result<tonic::Response<super::CacheGetManyResponse>, tonic::Status>
2006 {
2007 self.inner.ready().await.map_err(|e| {
2008 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2009 })?;
2010 let codec = tonic_prost::ProstCodec::default();
2011 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/GetMany");
2012 let mut req = request.into_request();
2013 req.extensions_mut()
2014 .insert(GrpcMethod::new("gestalt.provider.v1.Cache", "GetMany"));
2015 self.inner.unary(req, path, codec).await
2016 }
2017 pub async fn set(
2018 &mut self,
2019 request: impl tonic::IntoRequest<super::CacheSetRequest>,
2020 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
2021 self.inner.ready().await.map_err(|e| {
2022 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2023 })?;
2024 let codec = tonic_prost::ProstCodec::default();
2025 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/Set");
2026 let mut req = request.into_request();
2027 req.extensions_mut()
2028 .insert(GrpcMethod::new("gestalt.provider.v1.Cache", "Set"));
2029 self.inner.unary(req, path, codec).await
2030 }
2031 pub async fn set_many(
2032 &mut self,
2033 request: impl tonic::IntoRequest<super::CacheSetManyRequest>,
2034 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
2035 self.inner.ready().await.map_err(|e| {
2036 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2037 })?;
2038 let codec = tonic_prost::ProstCodec::default();
2039 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/SetMany");
2040 let mut req = request.into_request();
2041 req.extensions_mut()
2042 .insert(GrpcMethod::new("gestalt.provider.v1.Cache", "SetMany"));
2043 self.inner.unary(req, path, codec).await
2044 }
2045 pub async fn delete(
2046 &mut self,
2047 request: impl tonic::IntoRequest<super::CacheDeleteRequest>,
2048 ) -> std::result::Result<tonic::Response<super::CacheDeleteResponse>, tonic::Status>
2049 {
2050 self.inner.ready().await.map_err(|e| {
2051 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2052 })?;
2053 let codec = tonic_prost::ProstCodec::default();
2054 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/Delete");
2055 let mut req = request.into_request();
2056 req.extensions_mut()
2057 .insert(GrpcMethod::new("gestalt.provider.v1.Cache", "Delete"));
2058 self.inner.unary(req, path, codec).await
2059 }
2060 pub async fn delete_many(
2061 &mut self,
2062 request: impl tonic::IntoRequest<super::CacheDeleteManyRequest>,
2063 ) -> std::result::Result<tonic::Response<super::CacheDeleteManyResponse>, tonic::Status>
2064 {
2065 self.inner.ready().await.map_err(|e| {
2066 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2067 })?;
2068 let codec = tonic_prost::ProstCodec::default();
2069 let path =
2070 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/DeleteMany");
2071 let mut req = request.into_request();
2072 req.extensions_mut()
2073 .insert(GrpcMethod::new("gestalt.provider.v1.Cache", "DeleteMany"));
2074 self.inner.unary(req, path, codec).await
2075 }
2076 pub async fn touch(
2077 &mut self,
2078 request: impl tonic::IntoRequest<super::CacheTouchRequest>,
2079 ) -> std::result::Result<tonic::Response<super::CacheTouchResponse>, tonic::Status>
2080 {
2081 self.inner.ready().await.map_err(|e| {
2082 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2083 })?;
2084 let codec = tonic_prost::ProstCodec::default();
2085 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/Touch");
2086 let mut req = request.into_request();
2087 req.extensions_mut()
2088 .insert(GrpcMethod::new("gestalt.provider.v1.Cache", "Touch"));
2089 self.inner.unary(req, path, codec).await
2090 }
2091 }
2092}
2093pub mod cache_server {
2095 #![allow(
2096 unused_variables,
2097 dead_code,
2098 missing_docs,
2099 clippy::wildcard_imports,
2100 clippy::let_unit_value
2101 )]
2102 use tonic::codegen::*;
2103 #[async_trait]
2105 pub trait Cache: std::marker::Send + std::marker::Sync + 'static {
2106 async fn get(
2107 &self,
2108 request: tonic::Request<super::CacheGetRequest>,
2109 ) -> std::result::Result<tonic::Response<super::CacheGetResponse>, tonic::Status>;
2110 async fn get_many(
2111 &self,
2112 request: tonic::Request<super::CacheGetManyRequest>,
2113 ) -> std::result::Result<tonic::Response<super::CacheGetManyResponse>, tonic::Status>;
2114 async fn set(
2115 &self,
2116 request: tonic::Request<super::CacheSetRequest>,
2117 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
2118 async fn set_many(
2119 &self,
2120 request: tonic::Request<super::CacheSetManyRequest>,
2121 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
2122 async fn delete(
2123 &self,
2124 request: tonic::Request<super::CacheDeleteRequest>,
2125 ) -> std::result::Result<tonic::Response<super::CacheDeleteResponse>, tonic::Status>;
2126 async fn delete_many(
2127 &self,
2128 request: tonic::Request<super::CacheDeleteManyRequest>,
2129 ) -> std::result::Result<tonic::Response<super::CacheDeleteManyResponse>, tonic::Status>;
2130 async fn touch(
2131 &self,
2132 request: tonic::Request<super::CacheTouchRequest>,
2133 ) -> std::result::Result<tonic::Response<super::CacheTouchResponse>, tonic::Status>;
2134 }
2135 #[derive(Debug)]
2136 pub struct CacheServer<T> {
2137 inner: Arc<T>,
2138 accept_compression_encodings: EnabledCompressionEncodings,
2139 send_compression_encodings: EnabledCompressionEncodings,
2140 max_decoding_message_size: Option<usize>,
2141 max_encoding_message_size: Option<usize>,
2142 }
2143 impl<T> CacheServer<T> {
2144 pub fn new(inner: T) -> Self {
2145 Self::from_arc(Arc::new(inner))
2146 }
2147 pub fn from_arc(inner: Arc<T>) -> Self {
2148 Self {
2149 inner,
2150 accept_compression_encodings: Default::default(),
2151 send_compression_encodings: Default::default(),
2152 max_decoding_message_size: None,
2153 max_encoding_message_size: None,
2154 }
2155 }
2156 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
2157 where
2158 F: tonic::service::Interceptor,
2159 {
2160 InterceptedService::new(Self::new(inner), interceptor)
2161 }
2162 #[must_use]
2164 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2165 self.accept_compression_encodings.enable(encoding);
2166 self
2167 }
2168 #[must_use]
2170 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2171 self.send_compression_encodings.enable(encoding);
2172 self
2173 }
2174 #[must_use]
2178 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2179 self.max_decoding_message_size = Some(limit);
2180 self
2181 }
2182 #[must_use]
2186 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2187 self.max_encoding_message_size = Some(limit);
2188 self
2189 }
2190 }
2191 impl<T, B> tonic::codegen::Service<http::Request<B>> for CacheServer<T>
2192 where
2193 T: Cache,
2194 B: Body + std::marker::Send + 'static,
2195 B::Error: Into<StdError> + std::marker::Send + 'static,
2196 {
2197 type Response = http::Response<tonic::body::Body>;
2198 type Error = std::convert::Infallible;
2199 type Future = BoxFuture<Self::Response, Self::Error>;
2200 fn poll_ready(
2201 &mut self,
2202 _cx: &mut Context<'_>,
2203 ) -> Poll<std::result::Result<(), Self::Error>> {
2204 Poll::Ready(Ok(()))
2205 }
2206 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2207 match req.uri().path() {
2208 "/gestalt.provider.v1.Cache/Get" => {
2209 #[allow(non_camel_case_types)]
2210 struct GetSvc<T: Cache>(pub Arc<T>);
2211 impl<T: Cache> tonic::server::UnaryService<super::CacheGetRequest> for GetSvc<T> {
2212 type Response = super::CacheGetResponse;
2213 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2214 fn call(
2215 &mut self,
2216 request: tonic::Request<super::CacheGetRequest>,
2217 ) -> Self::Future {
2218 let inner = Arc::clone(&self.0);
2219 let fut = async move { <T as Cache>::get(&inner, request).await };
2220 Box::pin(fut)
2221 }
2222 }
2223 let accept_compression_encodings = self.accept_compression_encodings;
2224 let send_compression_encodings = self.send_compression_encodings;
2225 let max_decoding_message_size = self.max_decoding_message_size;
2226 let max_encoding_message_size = self.max_encoding_message_size;
2227 let inner = self.inner.clone();
2228 let fut = async move {
2229 let method = GetSvc(inner);
2230 let codec = tonic_prost::ProstCodec::default();
2231 let mut grpc = tonic::server::Grpc::new(codec)
2232 .apply_compression_config(
2233 accept_compression_encodings,
2234 send_compression_encodings,
2235 )
2236 .apply_max_message_size_config(
2237 max_decoding_message_size,
2238 max_encoding_message_size,
2239 );
2240 let res = grpc.unary(method, req).await;
2241 Ok(res)
2242 };
2243 Box::pin(fut)
2244 }
2245 "/gestalt.provider.v1.Cache/GetMany" => {
2246 #[allow(non_camel_case_types)]
2247 struct GetManySvc<T: Cache>(pub Arc<T>);
2248 impl<T: Cache> tonic::server::UnaryService<super::CacheGetManyRequest> for GetManySvc<T> {
2249 type Response = super::CacheGetManyResponse;
2250 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2251 fn call(
2252 &mut self,
2253 request: tonic::Request<super::CacheGetManyRequest>,
2254 ) -> Self::Future {
2255 let inner = Arc::clone(&self.0);
2256 let fut = async move { <T as Cache>::get_many(&inner, request).await };
2257 Box::pin(fut)
2258 }
2259 }
2260 let accept_compression_encodings = self.accept_compression_encodings;
2261 let send_compression_encodings = self.send_compression_encodings;
2262 let max_decoding_message_size = self.max_decoding_message_size;
2263 let max_encoding_message_size = self.max_encoding_message_size;
2264 let inner = self.inner.clone();
2265 let fut = async move {
2266 let method = GetManySvc(inner);
2267 let codec = tonic_prost::ProstCodec::default();
2268 let mut grpc = tonic::server::Grpc::new(codec)
2269 .apply_compression_config(
2270 accept_compression_encodings,
2271 send_compression_encodings,
2272 )
2273 .apply_max_message_size_config(
2274 max_decoding_message_size,
2275 max_encoding_message_size,
2276 );
2277 let res = grpc.unary(method, req).await;
2278 Ok(res)
2279 };
2280 Box::pin(fut)
2281 }
2282 "/gestalt.provider.v1.Cache/Set" => {
2283 #[allow(non_camel_case_types)]
2284 struct SetSvc<T: Cache>(pub Arc<T>);
2285 impl<T: Cache> tonic::server::UnaryService<super::CacheSetRequest> for SetSvc<T> {
2286 type Response = ();
2287 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2288 fn call(
2289 &mut self,
2290 request: tonic::Request<super::CacheSetRequest>,
2291 ) -> Self::Future {
2292 let inner = Arc::clone(&self.0);
2293 let fut = async move { <T as Cache>::set(&inner, request).await };
2294 Box::pin(fut)
2295 }
2296 }
2297 let accept_compression_encodings = self.accept_compression_encodings;
2298 let send_compression_encodings = self.send_compression_encodings;
2299 let max_decoding_message_size = self.max_decoding_message_size;
2300 let max_encoding_message_size = self.max_encoding_message_size;
2301 let inner = self.inner.clone();
2302 let fut = async move {
2303 let method = SetSvc(inner);
2304 let codec = tonic_prost::ProstCodec::default();
2305 let mut grpc = tonic::server::Grpc::new(codec)
2306 .apply_compression_config(
2307 accept_compression_encodings,
2308 send_compression_encodings,
2309 )
2310 .apply_max_message_size_config(
2311 max_decoding_message_size,
2312 max_encoding_message_size,
2313 );
2314 let res = grpc.unary(method, req).await;
2315 Ok(res)
2316 };
2317 Box::pin(fut)
2318 }
2319 "/gestalt.provider.v1.Cache/SetMany" => {
2320 #[allow(non_camel_case_types)]
2321 struct SetManySvc<T: Cache>(pub Arc<T>);
2322 impl<T: Cache> tonic::server::UnaryService<super::CacheSetManyRequest> for SetManySvc<T> {
2323 type Response = ();
2324 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2325 fn call(
2326 &mut self,
2327 request: tonic::Request<super::CacheSetManyRequest>,
2328 ) -> Self::Future {
2329 let inner = Arc::clone(&self.0);
2330 let fut = async move { <T as Cache>::set_many(&inner, request).await };
2331 Box::pin(fut)
2332 }
2333 }
2334 let accept_compression_encodings = self.accept_compression_encodings;
2335 let send_compression_encodings = self.send_compression_encodings;
2336 let max_decoding_message_size = self.max_decoding_message_size;
2337 let max_encoding_message_size = self.max_encoding_message_size;
2338 let inner = self.inner.clone();
2339 let fut = async move {
2340 let method = SetManySvc(inner);
2341 let codec = tonic_prost::ProstCodec::default();
2342 let mut grpc = tonic::server::Grpc::new(codec)
2343 .apply_compression_config(
2344 accept_compression_encodings,
2345 send_compression_encodings,
2346 )
2347 .apply_max_message_size_config(
2348 max_decoding_message_size,
2349 max_encoding_message_size,
2350 );
2351 let res = grpc.unary(method, req).await;
2352 Ok(res)
2353 };
2354 Box::pin(fut)
2355 }
2356 "/gestalt.provider.v1.Cache/Delete" => {
2357 #[allow(non_camel_case_types)]
2358 struct DeleteSvc<T: Cache>(pub Arc<T>);
2359 impl<T: Cache> tonic::server::UnaryService<super::CacheDeleteRequest> for DeleteSvc<T> {
2360 type Response = super::CacheDeleteResponse;
2361 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2362 fn call(
2363 &mut self,
2364 request: tonic::Request<super::CacheDeleteRequest>,
2365 ) -> Self::Future {
2366 let inner = Arc::clone(&self.0);
2367 let fut = async move { <T as Cache>::delete(&inner, request).await };
2368 Box::pin(fut)
2369 }
2370 }
2371 let accept_compression_encodings = self.accept_compression_encodings;
2372 let send_compression_encodings = self.send_compression_encodings;
2373 let max_decoding_message_size = self.max_decoding_message_size;
2374 let max_encoding_message_size = self.max_encoding_message_size;
2375 let inner = self.inner.clone();
2376 let fut = async move {
2377 let method = DeleteSvc(inner);
2378 let codec = tonic_prost::ProstCodec::default();
2379 let mut grpc = tonic::server::Grpc::new(codec)
2380 .apply_compression_config(
2381 accept_compression_encodings,
2382 send_compression_encodings,
2383 )
2384 .apply_max_message_size_config(
2385 max_decoding_message_size,
2386 max_encoding_message_size,
2387 );
2388 let res = grpc.unary(method, req).await;
2389 Ok(res)
2390 };
2391 Box::pin(fut)
2392 }
2393 "/gestalt.provider.v1.Cache/DeleteMany" => {
2394 #[allow(non_camel_case_types)]
2395 struct DeleteManySvc<T: Cache>(pub Arc<T>);
2396 impl<T: Cache> tonic::server::UnaryService<super::CacheDeleteManyRequest> for DeleteManySvc<T> {
2397 type Response = super::CacheDeleteManyResponse;
2398 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2399 fn call(
2400 &mut self,
2401 request: tonic::Request<super::CacheDeleteManyRequest>,
2402 ) -> Self::Future {
2403 let inner = Arc::clone(&self.0);
2404 let fut =
2405 async move { <T as Cache>::delete_many(&inner, request).await };
2406 Box::pin(fut)
2407 }
2408 }
2409 let accept_compression_encodings = self.accept_compression_encodings;
2410 let send_compression_encodings = self.send_compression_encodings;
2411 let max_decoding_message_size = self.max_decoding_message_size;
2412 let max_encoding_message_size = self.max_encoding_message_size;
2413 let inner = self.inner.clone();
2414 let fut = async move {
2415 let method = DeleteManySvc(inner);
2416 let codec = tonic_prost::ProstCodec::default();
2417 let mut grpc = tonic::server::Grpc::new(codec)
2418 .apply_compression_config(
2419 accept_compression_encodings,
2420 send_compression_encodings,
2421 )
2422 .apply_max_message_size_config(
2423 max_decoding_message_size,
2424 max_encoding_message_size,
2425 );
2426 let res = grpc.unary(method, req).await;
2427 Ok(res)
2428 };
2429 Box::pin(fut)
2430 }
2431 "/gestalt.provider.v1.Cache/Touch" => {
2432 #[allow(non_camel_case_types)]
2433 struct TouchSvc<T: Cache>(pub Arc<T>);
2434 impl<T: Cache> tonic::server::UnaryService<super::CacheTouchRequest> for TouchSvc<T> {
2435 type Response = super::CacheTouchResponse;
2436 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2437 fn call(
2438 &mut self,
2439 request: tonic::Request<super::CacheTouchRequest>,
2440 ) -> Self::Future {
2441 let inner = Arc::clone(&self.0);
2442 let fut = async move { <T as Cache>::touch(&inner, request).await };
2443 Box::pin(fut)
2444 }
2445 }
2446 let accept_compression_encodings = self.accept_compression_encodings;
2447 let send_compression_encodings = self.send_compression_encodings;
2448 let max_decoding_message_size = self.max_decoding_message_size;
2449 let max_encoding_message_size = self.max_encoding_message_size;
2450 let inner = self.inner.clone();
2451 let fut = async move {
2452 let method = TouchSvc(inner);
2453 let codec = tonic_prost::ProstCodec::default();
2454 let mut grpc = tonic::server::Grpc::new(codec)
2455 .apply_compression_config(
2456 accept_compression_encodings,
2457 send_compression_encodings,
2458 )
2459 .apply_max_message_size_config(
2460 max_decoding_message_size,
2461 max_encoding_message_size,
2462 );
2463 let res = grpc.unary(method, req).await;
2464 Ok(res)
2465 };
2466 Box::pin(fut)
2467 }
2468 _ => Box::pin(async move {
2469 let mut response = http::Response::new(tonic::body::Body::default());
2470 let headers = response.headers_mut();
2471 headers.insert(
2472 tonic::Status::GRPC_STATUS,
2473 (tonic::Code::Unimplemented as i32).into(),
2474 );
2475 headers.insert(
2476 http::header::CONTENT_TYPE,
2477 tonic::metadata::GRPC_CONTENT_TYPE,
2478 );
2479 Ok(response)
2480 }),
2481 }
2482 }
2483 }
2484 impl<T> Clone for CacheServer<T> {
2485 fn clone(&self) -> Self {
2486 let inner = self.inner.clone();
2487 Self {
2488 inner,
2489 accept_compression_encodings: self.accept_compression_encodings,
2490 send_compression_encodings: self.send_compression_encodings,
2491 max_decoding_message_size: self.max_decoding_message_size,
2492 max_encoding_message_size: self.max_encoding_message_size,
2493 }
2494 }
2495 }
2496 pub const SERVICE_NAME: &str = "gestalt.provider.v1.Cache";
2498 impl<T> tonic::server::NamedService for CacheServer<T> {
2499 const NAME: &'static str = SERVICE_NAME;
2500 }
2501}
2502#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2503pub struct GetSecretRequest {
2504 #[prost(string, tag = "1")]
2505 pub name: ::prost::alloc::string::String,
2506}
2507#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2508pub struct GetSecretResponse {
2509 #[prost(string, tag = "1")]
2510 pub value: ::prost::alloc::string::String,
2511}
2512pub mod secrets_provider_client {
2514 #![allow(
2515 unused_variables,
2516 dead_code,
2517 missing_docs,
2518 clippy::wildcard_imports,
2519 clippy::let_unit_value
2520 )]
2521 use tonic::codegen::http::Uri;
2522 use tonic::codegen::*;
2523 #[derive(Debug, Clone)]
2524 pub struct SecretsProviderClient<T> {
2525 inner: tonic::client::Grpc<T>,
2526 }
2527 impl SecretsProviderClient<tonic::transport::Channel> {
2528 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2530 where
2531 D: TryInto<tonic::transport::Endpoint>,
2532 D::Error: Into<StdError>,
2533 {
2534 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2535 Ok(Self::new(conn))
2536 }
2537 }
2538 impl<T> SecretsProviderClient<T>
2539 where
2540 T: tonic::client::GrpcService<tonic::body::Body>,
2541 T::Error: Into<StdError>,
2542 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2543 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2544 {
2545 pub fn new(inner: T) -> Self {
2546 let inner = tonic::client::Grpc::new(inner);
2547 Self { inner }
2548 }
2549 pub fn with_origin(inner: T, origin: Uri) -> Self {
2550 let inner = tonic::client::Grpc::with_origin(inner, origin);
2551 Self { inner }
2552 }
2553 pub fn with_interceptor<F>(
2554 inner: T,
2555 interceptor: F,
2556 ) -> SecretsProviderClient<InterceptedService<T, F>>
2557 where
2558 F: tonic::service::Interceptor,
2559 T::ResponseBody: Default,
2560 T: tonic::codegen::Service<
2561 http::Request<tonic::body::Body>,
2562 Response = http::Response<
2563 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2564 >,
2565 >,
2566 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
2567 Into<StdError> + std::marker::Send + std::marker::Sync,
2568 {
2569 SecretsProviderClient::new(InterceptedService::new(inner, interceptor))
2570 }
2571 #[must_use]
2576 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2577 self.inner = self.inner.send_compressed(encoding);
2578 self
2579 }
2580 #[must_use]
2582 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2583 self.inner = self.inner.accept_compressed(encoding);
2584 self
2585 }
2586 #[must_use]
2590 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2591 self.inner = self.inner.max_decoding_message_size(limit);
2592 self
2593 }
2594 #[must_use]
2598 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2599 self.inner = self.inner.max_encoding_message_size(limit);
2600 self
2601 }
2602 pub async fn get_secret(
2603 &mut self,
2604 request: impl tonic::IntoRequest<super::GetSecretRequest>,
2605 ) -> std::result::Result<tonic::Response<super::GetSecretResponse>, tonic::Status> {
2606 self.inner.ready().await.map_err(|e| {
2607 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
2608 })?;
2609 let codec = tonic_prost::ProstCodec::default();
2610 let path = http::uri::PathAndQuery::from_static(
2611 "/gestalt.provider.v1.SecretsProvider/GetSecret",
2612 );
2613 let mut req = request.into_request();
2614 req.extensions_mut().insert(GrpcMethod::new(
2615 "gestalt.provider.v1.SecretsProvider",
2616 "GetSecret",
2617 ));
2618 self.inner.unary(req, path, codec).await
2619 }
2620 }
2621}
2622pub mod secrets_provider_server {
2624 #![allow(
2625 unused_variables,
2626 dead_code,
2627 missing_docs,
2628 clippy::wildcard_imports,
2629 clippy::let_unit_value
2630 )]
2631 use tonic::codegen::*;
2632 #[async_trait]
2634 pub trait SecretsProvider: std::marker::Send + std::marker::Sync + 'static {
2635 async fn get_secret(
2636 &self,
2637 request: tonic::Request<super::GetSecretRequest>,
2638 ) -> std::result::Result<tonic::Response<super::GetSecretResponse>, tonic::Status>;
2639 }
2640 #[derive(Debug)]
2641 pub struct SecretsProviderServer<T> {
2642 inner: Arc<T>,
2643 accept_compression_encodings: EnabledCompressionEncodings,
2644 send_compression_encodings: EnabledCompressionEncodings,
2645 max_decoding_message_size: Option<usize>,
2646 max_encoding_message_size: Option<usize>,
2647 }
2648 impl<T> SecretsProviderServer<T> {
2649 pub fn new(inner: T) -> Self {
2650 Self::from_arc(Arc::new(inner))
2651 }
2652 pub fn from_arc(inner: Arc<T>) -> Self {
2653 Self {
2654 inner,
2655 accept_compression_encodings: Default::default(),
2656 send_compression_encodings: Default::default(),
2657 max_decoding_message_size: None,
2658 max_encoding_message_size: None,
2659 }
2660 }
2661 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
2662 where
2663 F: tonic::service::Interceptor,
2664 {
2665 InterceptedService::new(Self::new(inner), interceptor)
2666 }
2667 #[must_use]
2669 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2670 self.accept_compression_encodings.enable(encoding);
2671 self
2672 }
2673 #[must_use]
2675 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2676 self.send_compression_encodings.enable(encoding);
2677 self
2678 }
2679 #[must_use]
2683 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2684 self.max_decoding_message_size = Some(limit);
2685 self
2686 }
2687 #[must_use]
2691 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2692 self.max_encoding_message_size = Some(limit);
2693 self
2694 }
2695 }
2696 impl<T, B> tonic::codegen::Service<http::Request<B>> for SecretsProviderServer<T>
2697 where
2698 T: SecretsProvider,
2699 B: Body + std::marker::Send + 'static,
2700 B::Error: Into<StdError> + std::marker::Send + 'static,
2701 {
2702 type Response = http::Response<tonic::body::Body>;
2703 type Error = std::convert::Infallible;
2704 type Future = BoxFuture<Self::Response, Self::Error>;
2705 fn poll_ready(
2706 &mut self,
2707 _cx: &mut Context<'_>,
2708 ) -> Poll<std::result::Result<(), Self::Error>> {
2709 Poll::Ready(Ok(()))
2710 }
2711 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2712 match req.uri().path() {
2713 "/gestalt.provider.v1.SecretsProvider/GetSecret" => {
2714 #[allow(non_camel_case_types)]
2715 struct GetSecretSvc<T: SecretsProvider>(pub Arc<T>);
2716 impl<T: SecretsProvider> tonic::server::UnaryService<super::GetSecretRequest> for GetSecretSvc<T> {
2717 type Response = super::GetSecretResponse;
2718 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
2719 fn call(
2720 &mut self,
2721 request: tonic::Request<super::GetSecretRequest>,
2722 ) -> Self::Future {
2723 let inner = Arc::clone(&self.0);
2724 let fut = async move {
2725 <T as SecretsProvider>::get_secret(&inner, request).await
2726 };
2727 Box::pin(fut)
2728 }
2729 }
2730 let accept_compression_encodings = self.accept_compression_encodings;
2731 let send_compression_encodings = self.send_compression_encodings;
2732 let max_decoding_message_size = self.max_decoding_message_size;
2733 let max_encoding_message_size = self.max_encoding_message_size;
2734 let inner = self.inner.clone();
2735 let fut = async move {
2736 let method = GetSecretSvc(inner);
2737 let codec = tonic_prost::ProstCodec::default();
2738 let mut grpc = tonic::server::Grpc::new(codec)
2739 .apply_compression_config(
2740 accept_compression_encodings,
2741 send_compression_encodings,
2742 )
2743 .apply_max_message_size_config(
2744 max_decoding_message_size,
2745 max_encoding_message_size,
2746 );
2747 let res = grpc.unary(method, req).await;
2748 Ok(res)
2749 };
2750 Box::pin(fut)
2751 }
2752 _ => Box::pin(async move {
2753 let mut response = http::Response::new(tonic::body::Body::default());
2754 let headers = response.headers_mut();
2755 headers.insert(
2756 tonic::Status::GRPC_STATUS,
2757 (tonic::Code::Unimplemented as i32).into(),
2758 );
2759 headers.insert(
2760 http::header::CONTENT_TYPE,
2761 tonic::metadata::GRPC_CONTENT_TYPE,
2762 );
2763 Ok(response)
2764 }),
2765 }
2766 }
2767 }
2768 impl<T> Clone for SecretsProviderServer<T> {
2769 fn clone(&self) -> Self {
2770 let inner = self.inner.clone();
2771 Self {
2772 inner,
2773 accept_compression_encodings: self.accept_compression_encodings,
2774 send_compression_encodings: self.send_compression_encodings,
2775 max_decoding_message_size: self.max_decoding_message_size,
2776 max_encoding_message_size: self.max_encoding_message_size,
2777 }
2778 }
2779 }
2780 pub const SERVICE_NAME: &str = "gestalt.provider.v1.SecretsProvider";
2782 impl<T> tonic::server::NamedService for SecretsProviderServer<T> {
2783 const NAME: &'static str = SERVICE_NAME;
2784 }
2785}
2786#[derive(Clone, PartialEq, ::prost::Message)]
2787pub struct TypedValue {
2788 #[prost(oneof = "typed_value::Kind", tags = "1, 2, 3, 4, 5, 6, 7, 8")]
2789 pub kind: ::core::option::Option<typed_value::Kind>,
2790}
2791pub mod typed_value {
2793 #[derive(Clone, PartialEq, ::prost::Oneof)]
2794 pub enum Kind {
2795 #[prost(enumeration = "::prost_types::NullValue", tag = "1")]
2796 NullValue(i32),
2797 #[prost(string, tag = "2")]
2798 StringValue(::prost::alloc::string::String),
2799 #[prost(int64, tag = "3")]
2800 IntValue(i64),
2801 #[prost(double, tag = "4")]
2802 FloatValue(f64),
2803 #[prost(bool, tag = "5")]
2804 BoolValue(bool),
2805 #[prost(message, tag = "6")]
2806 TimeValue(::prost_types::Timestamp),
2807 #[prost(bytes, tag = "7")]
2808 BytesValue(::prost::alloc::vec::Vec<u8>),
2809 #[prost(message, tag = "8")]
2810 JsonValue(::prost_types::Value),
2811 }
2812}
2813#[derive(Clone, PartialEq, ::prost::Message)]
2814pub struct Record {
2815 #[prost(btree_map = "string, message", tag = "1")]
2816 pub fields: ::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, TypedValue>,
2817}
2818#[derive(Clone, PartialEq, ::prost::Message)]
2819pub struct ObjectStoreSchema {
2820 #[prost(message, repeated, tag = "1")]
2821 pub indexes: ::prost::alloc::vec::Vec<IndexSchema>,
2822 #[prost(message, repeated, tag = "2")]
2823 pub columns: ::prost::alloc::vec::Vec<ColumnDef>,
2824}
2825#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2826pub struct IndexSchema {
2827 #[prost(string, tag = "1")]
2828 pub name: ::prost::alloc::string::String,
2829 #[prost(string, repeated, tag = "2")]
2830 pub key_path: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2831 #[prost(bool, tag = "3")]
2832 pub unique: bool,
2833}
2834#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2835pub struct ColumnDef {
2836 #[prost(string, tag = "1")]
2837 pub name: ::prost::alloc::string::String,
2838 #[prost(int32, tag = "2")]
2839 pub r#type: i32,
2840 #[prost(bool, tag = "3")]
2841 pub primary_key: bool,
2842 #[prost(bool, tag = "4")]
2843 pub not_null: bool,
2844 #[prost(bool, tag = "5")]
2845 pub unique: bool,
2846}
2847#[derive(Clone, PartialEq, ::prost::Message)]
2848pub struct KeyRange {
2849 #[prost(message, optional, tag = "1")]
2850 pub lower: ::core::option::Option<TypedValue>,
2851 #[prost(message, optional, tag = "2")]
2852 pub upper: ::core::option::Option<TypedValue>,
2853 #[prost(bool, tag = "3")]
2854 pub lower_open: bool,
2855 #[prost(bool, tag = "4")]
2856 pub upper_open: bool,
2857}
2858#[derive(Clone, PartialEq, ::prost::Message)]
2859pub struct RecordRequest {
2860 #[prost(string, tag = "1")]
2861 pub store: ::prost::alloc::string::String,
2862 #[prost(message, optional, tag = "2")]
2863 pub record: ::core::option::Option<Record>,
2864}
2865#[derive(Clone, PartialEq, ::prost::Message)]
2866pub struct RecordResponse {
2867 #[prost(message, optional, tag = "1")]
2868 pub record: ::core::option::Option<Record>,
2869}
2870#[derive(Clone, PartialEq, ::prost::Message)]
2871pub struct RecordsResponse {
2872 #[prost(message, repeated, tag = "1")]
2873 pub records: ::prost::alloc::vec::Vec<Record>,
2874}
2875#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2876pub struct KeysResponse {
2877 #[prost(string, repeated, tag = "1")]
2878 pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2879}
2880#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2881pub struct ObjectStoreRequest {
2882 #[prost(string, tag = "1")]
2883 pub store: ::prost::alloc::string::String,
2884 #[prost(string, tag = "2")]
2885 pub id: ::prost::alloc::string::String,
2886}
2887#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2888pub struct ObjectStoreNameRequest {
2889 #[prost(string, tag = "1")]
2890 pub store: ::prost::alloc::string::String,
2891}
2892#[derive(Clone, PartialEq, ::prost::Message)]
2893pub struct ObjectStoreRangeRequest {
2894 #[prost(string, tag = "1")]
2895 pub store: ::prost::alloc::string::String,
2896 #[prost(message, optional, tag = "2")]
2897 pub range: ::core::option::Option<KeyRange>,
2898}
2899#[derive(Clone, PartialEq, ::prost::Message)]
2900pub struct CreateObjectStoreRequest {
2901 #[prost(string, tag = "1")]
2902 pub name: ::prost::alloc::string::String,
2903 #[prost(message, optional, tag = "2")]
2904 pub schema: ::core::option::Option<ObjectStoreSchema>,
2905}
2906#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2907pub struct DeleteObjectStoreRequest {
2908 #[prost(string, tag = "1")]
2909 pub name: ::prost::alloc::string::String,
2910}
2911#[derive(Clone, PartialEq, ::prost::Message)]
2912pub struct IndexQueryRequest {
2913 #[prost(string, tag = "1")]
2914 pub store: ::prost::alloc::string::String,
2915 #[prost(string, tag = "2")]
2916 pub index: ::prost::alloc::string::String,
2917 #[prost(message, repeated, tag = "3")]
2918 pub values: ::prost::alloc::vec::Vec<TypedValue>,
2919 #[prost(message, optional, tag = "4")]
2920 pub range: ::core::option::Option<KeyRange>,
2921}
2922#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
2923pub struct CountResponse {
2924 #[prost(int64, tag = "1")]
2925 pub count: i64,
2926}
2927#[derive(Clone, PartialEq, ::prost::Message)]
2928pub struct OpenCursorRequest {
2929 #[prost(string, tag = "1")]
2930 pub store: ::prost::alloc::string::String,
2931 #[prost(message, optional, tag = "2")]
2932 pub range: ::core::option::Option<KeyRange>,
2933 #[prost(enumeration = "CursorDirection", tag = "3")]
2934 pub direction: i32,
2935 #[prost(bool, tag = "4")]
2936 pub keys_only: bool,
2937 #[prost(string, tag = "5")]
2938 pub index: ::prost::alloc::string::String,
2939 #[prost(message, repeated, tag = "6")]
2940 pub values: ::prost::alloc::vec::Vec<TypedValue>,
2941}
2942#[derive(Clone, PartialEq, ::prost::Message)]
2945pub struct KeyValue {
2946 #[prost(oneof = "key_value::Kind", tags = "1, 2")]
2947 pub kind: ::core::option::Option<key_value::Kind>,
2948}
2949pub mod key_value {
2951 #[derive(Clone, PartialEq, ::prost::Oneof)]
2952 pub enum Kind {
2953 #[prost(message, tag = "1")]
2954 Scalar(super::TypedValue),
2955 #[prost(message, tag = "2")]
2956 Array(super::KeyValueArray),
2957 }
2958}
2959#[derive(Clone, PartialEq, ::prost::Message)]
2960pub struct KeyValueArray {
2961 #[prost(message, repeated, tag = "1")]
2962 pub elements: ::prost::alloc::vec::Vec<KeyValue>,
2963}
2964#[derive(Clone, PartialEq, ::prost::Message)]
2965pub struct CursorKeyTarget {
2966 #[prost(message, repeated, tag = "1")]
2967 pub key: ::prost::alloc::vec::Vec<KeyValue>,
2968}
2969#[derive(Clone, PartialEq, ::prost::Message)]
2970pub struct CursorCommand {
2971 #[prost(oneof = "cursor_command::Command", tags = "1, 2, 3, 4, 5, 6")]
2972 pub command: ::core::option::Option<cursor_command::Command>,
2973}
2974pub mod cursor_command {
2976 #[derive(Clone, PartialEq, ::prost::Oneof)]
2977 pub enum Command {
2978 #[prost(bool, tag = "1")]
2979 Next(bool),
2980 #[prost(message, tag = "2")]
2981 ContinueToKey(super::CursorKeyTarget),
2982 #[prost(int32, tag = "3")]
2983 Advance(i32),
2984 #[prost(message, tag = "4")]
2985 Update(super::Record),
2986 #[prost(bool, tag = "5")]
2987 Delete(bool),
2988 #[prost(bool, tag = "6")]
2989 Close(bool),
2990 }
2991}
2992#[derive(Clone, PartialEq, ::prost::Message)]
2993pub struct CursorClientMessage {
2994 #[prost(oneof = "cursor_client_message::Msg", tags = "1, 2")]
2995 pub msg: ::core::option::Option<cursor_client_message::Msg>,
2996}
2997pub mod cursor_client_message {
2999 #[derive(Clone, PartialEq, ::prost::Oneof)]
3000 pub enum Msg {
3001 #[prost(message, tag = "1")]
3002 Open(super::OpenCursorRequest),
3003 #[prost(message, tag = "2")]
3004 Command(super::CursorCommand),
3005 }
3006}
3007#[derive(Clone, PartialEq, ::prost::Message)]
3008pub struct CursorEntry {
3009 #[prost(message, repeated, tag = "1")]
3013 pub key: ::prost::alloc::vec::Vec<KeyValue>,
3014 #[prost(string, tag = "2")]
3015 pub primary_key: ::prost::alloc::string::String,
3016 #[prost(message, optional, tag = "3")]
3017 pub record: ::core::option::Option<Record>,
3018}
3019#[derive(Clone, PartialEq, ::prost::Message)]
3020pub struct CursorResponse {
3021 #[prost(oneof = "cursor_response::Result", tags = "1, 2")]
3022 pub result: ::core::option::Option<cursor_response::Result>,
3023}
3024pub mod cursor_response {
3026 #[derive(Clone, PartialEq, ::prost::Oneof)]
3027 pub enum Result {
3028 #[prost(message, tag = "1")]
3029 Entry(super::CursorEntry),
3030 #[prost(bool, tag = "2")]
3031 Done(bool),
3032 }
3033}
3034#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3035pub struct DeleteResponse {
3036 #[prost(int64, tag = "1")]
3037 pub deleted: i64,
3038}
3039#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3040pub struct KeyResponse {
3041 #[prost(string, tag = "1")]
3042 pub key: ::prost::alloc::string::String,
3043}
3044#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
3045#[repr(i32)]
3046pub enum CursorDirection {
3047 CursorNext = 0,
3048 CursorNextUnique = 1,
3049 CursorPrev = 2,
3050 CursorPrevUnique = 3,
3051}
3052impl CursorDirection {
3053 pub fn as_str_name(&self) -> &'static str {
3058 match self {
3059 Self::CursorNext => "CURSOR_NEXT",
3060 Self::CursorNextUnique => "CURSOR_NEXT_UNIQUE",
3061 Self::CursorPrev => "CURSOR_PREV",
3062 Self::CursorPrevUnique => "CURSOR_PREV_UNIQUE",
3063 }
3064 }
3065 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3067 match value {
3068 "CURSOR_NEXT" => Some(Self::CursorNext),
3069 "CURSOR_NEXT_UNIQUE" => Some(Self::CursorNextUnique),
3070 "CURSOR_PREV" => Some(Self::CursorPrev),
3071 "CURSOR_PREV_UNIQUE" => Some(Self::CursorPrevUnique),
3072 _ => None,
3073 }
3074 }
3075}
3076pub mod indexed_db_client {
3078 #![allow(
3079 unused_variables,
3080 dead_code,
3081 missing_docs,
3082 clippy::wildcard_imports,
3083 clippy::let_unit_value
3084 )]
3085 use tonic::codegen::http::Uri;
3086 use tonic::codegen::*;
3087 #[derive(Debug, Clone)]
3088 pub struct IndexedDbClient<T> {
3089 inner: tonic::client::Grpc<T>,
3090 }
3091 impl IndexedDbClient<tonic::transport::Channel> {
3092 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
3094 where
3095 D: TryInto<tonic::transport::Endpoint>,
3096 D::Error: Into<StdError>,
3097 {
3098 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
3099 Ok(Self::new(conn))
3100 }
3101 }
3102 impl<T> IndexedDbClient<T>
3103 where
3104 T: tonic::client::GrpcService<tonic::body::Body>,
3105 T::Error: Into<StdError>,
3106 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
3107 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
3108 {
3109 pub fn new(inner: T) -> Self {
3110 let inner = tonic::client::Grpc::new(inner);
3111 Self { inner }
3112 }
3113 pub fn with_origin(inner: T, origin: Uri) -> Self {
3114 let inner = tonic::client::Grpc::with_origin(inner, origin);
3115 Self { inner }
3116 }
3117 pub fn with_interceptor<F>(
3118 inner: T,
3119 interceptor: F,
3120 ) -> IndexedDbClient<InterceptedService<T, F>>
3121 where
3122 F: tonic::service::Interceptor,
3123 T::ResponseBody: Default,
3124 T: tonic::codegen::Service<
3125 http::Request<tonic::body::Body>,
3126 Response = http::Response<
3127 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
3128 >,
3129 >,
3130 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
3131 Into<StdError> + std::marker::Send + std::marker::Sync,
3132 {
3133 IndexedDbClient::new(InterceptedService::new(inner, interceptor))
3134 }
3135 #[must_use]
3140 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3141 self.inner = self.inner.send_compressed(encoding);
3142 self
3143 }
3144 #[must_use]
3146 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3147 self.inner = self.inner.accept_compressed(encoding);
3148 self
3149 }
3150 #[must_use]
3154 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3155 self.inner = self.inner.max_decoding_message_size(limit);
3156 self
3157 }
3158 #[must_use]
3162 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3163 self.inner = self.inner.max_encoding_message_size(limit);
3164 self
3165 }
3166 pub async fn create_object_store(
3168 &mut self,
3169 request: impl tonic::IntoRequest<super::CreateObjectStoreRequest>,
3170 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
3171 self.inner.ready().await.map_err(|e| {
3172 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3173 })?;
3174 let codec = tonic_prost::ProstCodec::default();
3175 let path = http::uri::PathAndQuery::from_static(
3176 "/gestalt.provider.v1.IndexedDB/CreateObjectStore",
3177 );
3178 let mut req = request.into_request();
3179 req.extensions_mut().insert(GrpcMethod::new(
3180 "gestalt.provider.v1.IndexedDB",
3181 "CreateObjectStore",
3182 ));
3183 self.inner.unary(req, path, codec).await
3184 }
3185 pub async fn delete_object_store(
3186 &mut self,
3187 request: impl tonic::IntoRequest<super::DeleteObjectStoreRequest>,
3188 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
3189 self.inner.ready().await.map_err(|e| {
3190 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3191 })?;
3192 let codec = tonic_prost::ProstCodec::default();
3193 let path = http::uri::PathAndQuery::from_static(
3194 "/gestalt.provider.v1.IndexedDB/DeleteObjectStore",
3195 );
3196 let mut req = request.into_request();
3197 req.extensions_mut().insert(GrpcMethod::new(
3198 "gestalt.provider.v1.IndexedDB",
3199 "DeleteObjectStore",
3200 ));
3201 self.inner.unary(req, path, codec).await
3202 }
3203 pub async fn get(
3205 &mut self,
3206 request: impl tonic::IntoRequest<super::ObjectStoreRequest>,
3207 ) -> std::result::Result<tonic::Response<super::RecordResponse>, tonic::Status> {
3208 self.inner.ready().await.map_err(|e| {
3209 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3210 })?;
3211 let codec = tonic_prost::ProstCodec::default();
3212 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Get");
3213 let mut req = request.into_request();
3214 req.extensions_mut()
3215 .insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Get"));
3216 self.inner.unary(req, path, codec).await
3217 }
3218 pub async fn get_key(
3219 &mut self,
3220 request: impl tonic::IntoRequest<super::ObjectStoreRequest>,
3221 ) -> std::result::Result<tonic::Response<super::KeyResponse>, tonic::Status> {
3222 self.inner.ready().await.map_err(|e| {
3223 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3224 })?;
3225 let codec = tonic_prost::ProstCodec::default();
3226 let path =
3227 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/GetKey");
3228 let mut req = request.into_request();
3229 req.extensions_mut()
3230 .insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "GetKey"));
3231 self.inner.unary(req, path, codec).await
3232 }
3233 pub async fn add(
3234 &mut self,
3235 request: impl tonic::IntoRequest<super::RecordRequest>,
3236 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
3237 self.inner.ready().await.map_err(|e| {
3238 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3239 })?;
3240 let codec = tonic_prost::ProstCodec::default();
3241 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Add");
3242 let mut req = request.into_request();
3243 req.extensions_mut()
3244 .insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Add"));
3245 self.inner.unary(req, path, codec).await
3246 }
3247 pub async fn put(
3248 &mut self,
3249 request: impl tonic::IntoRequest<super::RecordRequest>,
3250 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
3251 self.inner.ready().await.map_err(|e| {
3252 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3253 })?;
3254 let codec = tonic_prost::ProstCodec::default();
3255 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Put");
3256 let mut req = request.into_request();
3257 req.extensions_mut()
3258 .insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Put"));
3259 self.inner.unary(req, path, codec).await
3260 }
3261 pub async fn delete(
3262 &mut self,
3263 request: impl tonic::IntoRequest<super::ObjectStoreRequest>,
3264 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
3265 self.inner.ready().await.map_err(|e| {
3266 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3267 })?;
3268 let codec = tonic_prost::ProstCodec::default();
3269 let path =
3270 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Delete");
3271 let mut req = request.into_request();
3272 req.extensions_mut()
3273 .insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Delete"));
3274 self.inner.unary(req, path, codec).await
3275 }
3276 pub async fn clear(
3278 &mut self,
3279 request: impl tonic::IntoRequest<super::ObjectStoreNameRequest>,
3280 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
3281 self.inner.ready().await.map_err(|e| {
3282 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3283 })?;
3284 let codec = tonic_prost::ProstCodec::default();
3285 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Clear");
3286 let mut req = request.into_request();
3287 req.extensions_mut()
3288 .insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Clear"));
3289 self.inner.unary(req, path, codec).await
3290 }
3291 pub async fn get_all(
3292 &mut self,
3293 request: impl tonic::IntoRequest<super::ObjectStoreRangeRequest>,
3294 ) -> std::result::Result<tonic::Response<super::RecordsResponse>, tonic::Status> {
3295 self.inner.ready().await.map_err(|e| {
3296 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3297 })?;
3298 let codec = tonic_prost::ProstCodec::default();
3299 let path =
3300 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/GetAll");
3301 let mut req = request.into_request();
3302 req.extensions_mut()
3303 .insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "GetAll"));
3304 self.inner.unary(req, path, codec).await
3305 }
3306 pub async fn get_all_keys(
3307 &mut self,
3308 request: impl tonic::IntoRequest<super::ObjectStoreRangeRequest>,
3309 ) -> std::result::Result<tonic::Response<super::KeysResponse>, tonic::Status> {
3310 self.inner.ready().await.map_err(|e| {
3311 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3312 })?;
3313 let codec = tonic_prost::ProstCodec::default();
3314 let path =
3315 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/GetAllKeys");
3316 let mut req = request.into_request();
3317 req.extensions_mut().insert(GrpcMethod::new(
3318 "gestalt.provider.v1.IndexedDB",
3319 "GetAllKeys",
3320 ));
3321 self.inner.unary(req, path, codec).await
3322 }
3323 pub async fn count(
3324 &mut self,
3325 request: impl tonic::IntoRequest<super::ObjectStoreRangeRequest>,
3326 ) -> std::result::Result<tonic::Response<super::CountResponse>, tonic::Status> {
3327 self.inner.ready().await.map_err(|e| {
3328 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3329 })?;
3330 let codec = tonic_prost::ProstCodec::default();
3331 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Count");
3332 let mut req = request.into_request();
3333 req.extensions_mut()
3334 .insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Count"));
3335 self.inner.unary(req, path, codec).await
3336 }
3337 pub async fn delete_range(
3338 &mut self,
3339 request: impl tonic::IntoRequest<super::ObjectStoreRangeRequest>,
3340 ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
3341 self.inner.ready().await.map_err(|e| {
3342 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3343 })?;
3344 let codec = tonic_prost::ProstCodec::default();
3345 let path =
3346 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/DeleteRange");
3347 let mut req = request.into_request();
3348 req.extensions_mut().insert(GrpcMethod::new(
3349 "gestalt.provider.v1.IndexedDB",
3350 "DeleteRange",
3351 ));
3352 self.inner.unary(req, path, codec).await
3353 }
3354 pub async fn index_get(
3356 &mut self,
3357 request: impl tonic::IntoRequest<super::IndexQueryRequest>,
3358 ) -> std::result::Result<tonic::Response<super::RecordResponse>, tonic::Status> {
3359 self.inner.ready().await.map_err(|e| {
3360 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3361 })?;
3362 let codec = tonic_prost::ProstCodec::default();
3363 let path =
3364 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexGet");
3365 let mut req = request.into_request();
3366 req.extensions_mut()
3367 .insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "IndexGet"));
3368 self.inner.unary(req, path, codec).await
3369 }
3370 pub async fn index_get_key(
3371 &mut self,
3372 request: impl tonic::IntoRequest<super::IndexQueryRequest>,
3373 ) -> std::result::Result<tonic::Response<super::KeyResponse>, tonic::Status> {
3374 self.inner.ready().await.map_err(|e| {
3375 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3376 })?;
3377 let codec = tonic_prost::ProstCodec::default();
3378 let path =
3379 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexGetKey");
3380 let mut req = request.into_request();
3381 req.extensions_mut().insert(GrpcMethod::new(
3382 "gestalt.provider.v1.IndexedDB",
3383 "IndexGetKey",
3384 ));
3385 self.inner.unary(req, path, codec).await
3386 }
3387 pub async fn index_get_all(
3388 &mut self,
3389 request: impl tonic::IntoRequest<super::IndexQueryRequest>,
3390 ) -> std::result::Result<tonic::Response<super::RecordsResponse>, tonic::Status> {
3391 self.inner.ready().await.map_err(|e| {
3392 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3393 })?;
3394 let codec = tonic_prost::ProstCodec::default();
3395 let path =
3396 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexGetAll");
3397 let mut req = request.into_request();
3398 req.extensions_mut().insert(GrpcMethod::new(
3399 "gestalt.provider.v1.IndexedDB",
3400 "IndexGetAll",
3401 ));
3402 self.inner.unary(req, path, codec).await
3403 }
3404 pub async fn index_get_all_keys(
3405 &mut self,
3406 request: impl tonic::IntoRequest<super::IndexQueryRequest>,
3407 ) -> std::result::Result<tonic::Response<super::KeysResponse>, tonic::Status> {
3408 self.inner.ready().await.map_err(|e| {
3409 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3410 })?;
3411 let codec = tonic_prost::ProstCodec::default();
3412 let path = http::uri::PathAndQuery::from_static(
3413 "/gestalt.provider.v1.IndexedDB/IndexGetAllKeys",
3414 );
3415 let mut req = request.into_request();
3416 req.extensions_mut().insert(GrpcMethod::new(
3417 "gestalt.provider.v1.IndexedDB",
3418 "IndexGetAllKeys",
3419 ));
3420 self.inner.unary(req, path, codec).await
3421 }
3422 pub async fn index_count(
3423 &mut self,
3424 request: impl tonic::IntoRequest<super::IndexQueryRequest>,
3425 ) -> std::result::Result<tonic::Response<super::CountResponse>, tonic::Status> {
3426 self.inner.ready().await.map_err(|e| {
3427 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3428 })?;
3429 let codec = tonic_prost::ProstCodec::default();
3430 let path =
3431 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexCount");
3432 let mut req = request.into_request();
3433 req.extensions_mut().insert(GrpcMethod::new(
3434 "gestalt.provider.v1.IndexedDB",
3435 "IndexCount",
3436 ));
3437 self.inner.unary(req, path, codec).await
3438 }
3439 pub async fn index_delete(
3440 &mut self,
3441 request: impl tonic::IntoRequest<super::IndexQueryRequest>,
3442 ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
3443 self.inner.ready().await.map_err(|e| {
3444 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3445 })?;
3446 let codec = tonic_prost::ProstCodec::default();
3447 let path =
3448 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexDelete");
3449 let mut req = request.into_request();
3450 req.extensions_mut().insert(GrpcMethod::new(
3451 "gestalt.provider.v1.IndexedDB",
3452 "IndexDelete",
3453 ));
3454 self.inner.unary(req, path, codec).await
3455 }
3456 pub async fn open_cursor(
3458 &mut self,
3459 request: impl tonic::IntoStreamingRequest<Message = super::CursorClientMessage>,
3460 ) -> std::result::Result<
3461 tonic::Response<tonic::codec::Streaming<super::CursorResponse>>,
3462 tonic::Status,
3463 > {
3464 self.inner.ready().await.map_err(|e| {
3465 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
3466 })?;
3467 let codec = tonic_prost::ProstCodec::default();
3468 let path =
3469 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/OpenCursor");
3470 let mut req = request.into_streaming_request();
3471 req.extensions_mut().insert(GrpcMethod::new(
3472 "gestalt.provider.v1.IndexedDB",
3473 "OpenCursor",
3474 ));
3475 self.inner.streaming(req, path, codec).await
3476 }
3477 }
3478}
3479pub mod indexed_db_server {
3481 #![allow(
3482 unused_variables,
3483 dead_code,
3484 missing_docs,
3485 clippy::wildcard_imports,
3486 clippy::let_unit_value
3487 )]
3488 use tonic::codegen::*;
3489 #[async_trait]
3491 pub trait IndexedDb: std::marker::Send + std::marker::Sync + 'static {
3492 async fn create_object_store(
3494 &self,
3495 request: tonic::Request<super::CreateObjectStoreRequest>,
3496 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
3497 async fn delete_object_store(
3498 &self,
3499 request: tonic::Request<super::DeleteObjectStoreRequest>,
3500 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
3501 async fn get(
3503 &self,
3504 request: tonic::Request<super::ObjectStoreRequest>,
3505 ) -> std::result::Result<tonic::Response<super::RecordResponse>, tonic::Status>;
3506 async fn get_key(
3507 &self,
3508 request: tonic::Request<super::ObjectStoreRequest>,
3509 ) -> std::result::Result<tonic::Response<super::KeyResponse>, tonic::Status>;
3510 async fn add(
3511 &self,
3512 request: tonic::Request<super::RecordRequest>,
3513 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
3514 async fn put(
3515 &self,
3516 request: tonic::Request<super::RecordRequest>,
3517 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
3518 async fn delete(
3519 &self,
3520 request: tonic::Request<super::ObjectStoreRequest>,
3521 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
3522 async fn clear(
3524 &self,
3525 request: tonic::Request<super::ObjectStoreNameRequest>,
3526 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
3527 async fn get_all(
3528 &self,
3529 request: tonic::Request<super::ObjectStoreRangeRequest>,
3530 ) -> std::result::Result<tonic::Response<super::RecordsResponse>, tonic::Status>;
3531 async fn get_all_keys(
3532 &self,
3533 request: tonic::Request<super::ObjectStoreRangeRequest>,
3534 ) -> std::result::Result<tonic::Response<super::KeysResponse>, tonic::Status>;
3535 async fn count(
3536 &self,
3537 request: tonic::Request<super::ObjectStoreRangeRequest>,
3538 ) -> std::result::Result<tonic::Response<super::CountResponse>, tonic::Status>;
3539 async fn delete_range(
3540 &self,
3541 request: tonic::Request<super::ObjectStoreRangeRequest>,
3542 ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status>;
3543 async fn index_get(
3545 &self,
3546 request: tonic::Request<super::IndexQueryRequest>,
3547 ) -> std::result::Result<tonic::Response<super::RecordResponse>, tonic::Status>;
3548 async fn index_get_key(
3549 &self,
3550 request: tonic::Request<super::IndexQueryRequest>,
3551 ) -> std::result::Result<tonic::Response<super::KeyResponse>, tonic::Status>;
3552 async fn index_get_all(
3553 &self,
3554 request: tonic::Request<super::IndexQueryRequest>,
3555 ) -> std::result::Result<tonic::Response<super::RecordsResponse>, tonic::Status>;
3556 async fn index_get_all_keys(
3557 &self,
3558 request: tonic::Request<super::IndexQueryRequest>,
3559 ) -> std::result::Result<tonic::Response<super::KeysResponse>, tonic::Status>;
3560 async fn index_count(
3561 &self,
3562 request: tonic::Request<super::IndexQueryRequest>,
3563 ) -> std::result::Result<tonic::Response<super::CountResponse>, tonic::Status>;
3564 async fn index_delete(
3565 &self,
3566 request: tonic::Request<super::IndexQueryRequest>,
3567 ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status>;
3568 type OpenCursorStream: tonic::codegen::tokio_stream::Stream<
3570 Item = std::result::Result<super::CursorResponse, tonic::Status>,
3571 > + std::marker::Send
3572 + 'static;
3573 async fn open_cursor(
3575 &self,
3576 request: tonic::Request<tonic::Streaming<super::CursorClientMessage>>,
3577 ) -> std::result::Result<tonic::Response<Self::OpenCursorStream>, tonic::Status>;
3578 }
3579 #[derive(Debug)]
3580 pub struct IndexedDbServer<T> {
3581 inner: Arc<T>,
3582 accept_compression_encodings: EnabledCompressionEncodings,
3583 send_compression_encodings: EnabledCompressionEncodings,
3584 max_decoding_message_size: Option<usize>,
3585 max_encoding_message_size: Option<usize>,
3586 }
3587 impl<T> IndexedDbServer<T> {
3588 pub fn new(inner: T) -> Self {
3589 Self::from_arc(Arc::new(inner))
3590 }
3591 pub fn from_arc(inner: Arc<T>) -> Self {
3592 Self {
3593 inner,
3594 accept_compression_encodings: Default::default(),
3595 send_compression_encodings: Default::default(),
3596 max_decoding_message_size: None,
3597 max_encoding_message_size: None,
3598 }
3599 }
3600 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
3601 where
3602 F: tonic::service::Interceptor,
3603 {
3604 InterceptedService::new(Self::new(inner), interceptor)
3605 }
3606 #[must_use]
3608 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3609 self.accept_compression_encodings.enable(encoding);
3610 self
3611 }
3612 #[must_use]
3614 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3615 self.send_compression_encodings.enable(encoding);
3616 self
3617 }
3618 #[must_use]
3622 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3623 self.max_decoding_message_size = Some(limit);
3624 self
3625 }
3626 #[must_use]
3630 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3631 self.max_encoding_message_size = Some(limit);
3632 self
3633 }
3634 }
3635 impl<T, B> tonic::codegen::Service<http::Request<B>> for IndexedDbServer<T>
3636 where
3637 T: IndexedDb,
3638 B: Body + std::marker::Send + 'static,
3639 B::Error: Into<StdError> + std::marker::Send + 'static,
3640 {
3641 type Response = http::Response<tonic::body::Body>;
3642 type Error = std::convert::Infallible;
3643 type Future = BoxFuture<Self::Response, Self::Error>;
3644 fn poll_ready(
3645 &mut self,
3646 _cx: &mut Context<'_>,
3647 ) -> Poll<std::result::Result<(), Self::Error>> {
3648 Poll::Ready(Ok(()))
3649 }
3650 fn call(&mut self, req: http::Request<B>) -> Self::Future {
3651 match req.uri().path() {
3652 "/gestalt.provider.v1.IndexedDB/CreateObjectStore" => {
3653 #[allow(non_camel_case_types)]
3654 struct CreateObjectStoreSvc<T: IndexedDb>(pub Arc<T>);
3655 impl<T: IndexedDb> tonic::server::UnaryService<super::CreateObjectStoreRequest>
3656 for CreateObjectStoreSvc<T>
3657 {
3658 type Response = ();
3659 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3660 fn call(
3661 &mut self,
3662 request: tonic::Request<super::CreateObjectStoreRequest>,
3663 ) -> Self::Future {
3664 let inner = Arc::clone(&self.0);
3665 let fut = async move {
3666 <T as IndexedDb>::create_object_store(&inner, request).await
3667 };
3668 Box::pin(fut)
3669 }
3670 }
3671 let accept_compression_encodings = self.accept_compression_encodings;
3672 let send_compression_encodings = self.send_compression_encodings;
3673 let max_decoding_message_size = self.max_decoding_message_size;
3674 let max_encoding_message_size = self.max_encoding_message_size;
3675 let inner = self.inner.clone();
3676 let fut = async move {
3677 let method = CreateObjectStoreSvc(inner);
3678 let codec = tonic_prost::ProstCodec::default();
3679 let mut grpc = tonic::server::Grpc::new(codec)
3680 .apply_compression_config(
3681 accept_compression_encodings,
3682 send_compression_encodings,
3683 )
3684 .apply_max_message_size_config(
3685 max_decoding_message_size,
3686 max_encoding_message_size,
3687 );
3688 let res = grpc.unary(method, req).await;
3689 Ok(res)
3690 };
3691 Box::pin(fut)
3692 }
3693 "/gestalt.provider.v1.IndexedDB/DeleteObjectStore" => {
3694 #[allow(non_camel_case_types)]
3695 struct DeleteObjectStoreSvc<T: IndexedDb>(pub Arc<T>);
3696 impl<T: IndexedDb> tonic::server::UnaryService<super::DeleteObjectStoreRequest>
3697 for DeleteObjectStoreSvc<T>
3698 {
3699 type Response = ();
3700 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3701 fn call(
3702 &mut self,
3703 request: tonic::Request<super::DeleteObjectStoreRequest>,
3704 ) -> Self::Future {
3705 let inner = Arc::clone(&self.0);
3706 let fut = async move {
3707 <T as IndexedDb>::delete_object_store(&inner, request).await
3708 };
3709 Box::pin(fut)
3710 }
3711 }
3712 let accept_compression_encodings = self.accept_compression_encodings;
3713 let send_compression_encodings = self.send_compression_encodings;
3714 let max_decoding_message_size = self.max_decoding_message_size;
3715 let max_encoding_message_size = self.max_encoding_message_size;
3716 let inner = self.inner.clone();
3717 let fut = async move {
3718 let method = DeleteObjectStoreSvc(inner);
3719 let codec = tonic_prost::ProstCodec::default();
3720 let mut grpc = tonic::server::Grpc::new(codec)
3721 .apply_compression_config(
3722 accept_compression_encodings,
3723 send_compression_encodings,
3724 )
3725 .apply_max_message_size_config(
3726 max_decoding_message_size,
3727 max_encoding_message_size,
3728 );
3729 let res = grpc.unary(method, req).await;
3730 Ok(res)
3731 };
3732 Box::pin(fut)
3733 }
3734 "/gestalt.provider.v1.IndexedDB/Get" => {
3735 #[allow(non_camel_case_types)]
3736 struct GetSvc<T: IndexedDb>(pub Arc<T>);
3737 impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRequest> for GetSvc<T> {
3738 type Response = super::RecordResponse;
3739 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3740 fn call(
3741 &mut self,
3742 request: tonic::Request<super::ObjectStoreRequest>,
3743 ) -> Self::Future {
3744 let inner = Arc::clone(&self.0);
3745 let fut = async move { <T as IndexedDb>::get(&inner, request).await };
3746 Box::pin(fut)
3747 }
3748 }
3749 let accept_compression_encodings = self.accept_compression_encodings;
3750 let send_compression_encodings = self.send_compression_encodings;
3751 let max_decoding_message_size = self.max_decoding_message_size;
3752 let max_encoding_message_size = self.max_encoding_message_size;
3753 let inner = self.inner.clone();
3754 let fut = async move {
3755 let method = GetSvc(inner);
3756 let codec = tonic_prost::ProstCodec::default();
3757 let mut grpc = tonic::server::Grpc::new(codec)
3758 .apply_compression_config(
3759 accept_compression_encodings,
3760 send_compression_encodings,
3761 )
3762 .apply_max_message_size_config(
3763 max_decoding_message_size,
3764 max_encoding_message_size,
3765 );
3766 let res = grpc.unary(method, req).await;
3767 Ok(res)
3768 };
3769 Box::pin(fut)
3770 }
3771 "/gestalt.provider.v1.IndexedDB/GetKey" => {
3772 #[allow(non_camel_case_types)]
3773 struct GetKeySvc<T: IndexedDb>(pub Arc<T>);
3774 impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRequest> for GetKeySvc<T> {
3775 type Response = super::KeyResponse;
3776 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3777 fn call(
3778 &mut self,
3779 request: tonic::Request<super::ObjectStoreRequest>,
3780 ) -> Self::Future {
3781 let inner = Arc::clone(&self.0);
3782 let fut =
3783 async move { <T as IndexedDb>::get_key(&inner, request).await };
3784 Box::pin(fut)
3785 }
3786 }
3787 let accept_compression_encodings = self.accept_compression_encodings;
3788 let send_compression_encodings = self.send_compression_encodings;
3789 let max_decoding_message_size = self.max_decoding_message_size;
3790 let max_encoding_message_size = self.max_encoding_message_size;
3791 let inner = self.inner.clone();
3792 let fut = async move {
3793 let method = GetKeySvc(inner);
3794 let codec = tonic_prost::ProstCodec::default();
3795 let mut grpc = tonic::server::Grpc::new(codec)
3796 .apply_compression_config(
3797 accept_compression_encodings,
3798 send_compression_encodings,
3799 )
3800 .apply_max_message_size_config(
3801 max_decoding_message_size,
3802 max_encoding_message_size,
3803 );
3804 let res = grpc.unary(method, req).await;
3805 Ok(res)
3806 };
3807 Box::pin(fut)
3808 }
3809 "/gestalt.provider.v1.IndexedDB/Add" => {
3810 #[allow(non_camel_case_types)]
3811 struct AddSvc<T: IndexedDb>(pub Arc<T>);
3812 impl<T: IndexedDb> tonic::server::UnaryService<super::RecordRequest> for AddSvc<T> {
3813 type Response = ();
3814 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3815 fn call(
3816 &mut self,
3817 request: tonic::Request<super::RecordRequest>,
3818 ) -> Self::Future {
3819 let inner = Arc::clone(&self.0);
3820 let fut = async move { <T as IndexedDb>::add(&inner, request).await };
3821 Box::pin(fut)
3822 }
3823 }
3824 let accept_compression_encodings = self.accept_compression_encodings;
3825 let send_compression_encodings = self.send_compression_encodings;
3826 let max_decoding_message_size = self.max_decoding_message_size;
3827 let max_encoding_message_size = self.max_encoding_message_size;
3828 let inner = self.inner.clone();
3829 let fut = async move {
3830 let method = AddSvc(inner);
3831 let codec = tonic_prost::ProstCodec::default();
3832 let mut grpc = tonic::server::Grpc::new(codec)
3833 .apply_compression_config(
3834 accept_compression_encodings,
3835 send_compression_encodings,
3836 )
3837 .apply_max_message_size_config(
3838 max_decoding_message_size,
3839 max_encoding_message_size,
3840 );
3841 let res = grpc.unary(method, req).await;
3842 Ok(res)
3843 };
3844 Box::pin(fut)
3845 }
3846 "/gestalt.provider.v1.IndexedDB/Put" => {
3847 #[allow(non_camel_case_types)]
3848 struct PutSvc<T: IndexedDb>(pub Arc<T>);
3849 impl<T: IndexedDb> tonic::server::UnaryService<super::RecordRequest> for PutSvc<T> {
3850 type Response = ();
3851 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3852 fn call(
3853 &mut self,
3854 request: tonic::Request<super::RecordRequest>,
3855 ) -> Self::Future {
3856 let inner = Arc::clone(&self.0);
3857 let fut = async move { <T as IndexedDb>::put(&inner, request).await };
3858 Box::pin(fut)
3859 }
3860 }
3861 let accept_compression_encodings = self.accept_compression_encodings;
3862 let send_compression_encodings = self.send_compression_encodings;
3863 let max_decoding_message_size = self.max_decoding_message_size;
3864 let max_encoding_message_size = self.max_encoding_message_size;
3865 let inner = self.inner.clone();
3866 let fut = async move {
3867 let method = PutSvc(inner);
3868 let codec = tonic_prost::ProstCodec::default();
3869 let mut grpc = tonic::server::Grpc::new(codec)
3870 .apply_compression_config(
3871 accept_compression_encodings,
3872 send_compression_encodings,
3873 )
3874 .apply_max_message_size_config(
3875 max_decoding_message_size,
3876 max_encoding_message_size,
3877 );
3878 let res = grpc.unary(method, req).await;
3879 Ok(res)
3880 };
3881 Box::pin(fut)
3882 }
3883 "/gestalt.provider.v1.IndexedDB/Delete" => {
3884 #[allow(non_camel_case_types)]
3885 struct DeleteSvc<T: IndexedDb>(pub Arc<T>);
3886 impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRequest> for DeleteSvc<T> {
3887 type Response = ();
3888 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3889 fn call(
3890 &mut self,
3891 request: tonic::Request<super::ObjectStoreRequest>,
3892 ) -> Self::Future {
3893 let inner = Arc::clone(&self.0);
3894 let fut =
3895 async move { <T as IndexedDb>::delete(&inner, request).await };
3896 Box::pin(fut)
3897 }
3898 }
3899 let accept_compression_encodings = self.accept_compression_encodings;
3900 let send_compression_encodings = self.send_compression_encodings;
3901 let max_decoding_message_size = self.max_decoding_message_size;
3902 let max_encoding_message_size = self.max_encoding_message_size;
3903 let inner = self.inner.clone();
3904 let fut = async move {
3905 let method = DeleteSvc(inner);
3906 let codec = tonic_prost::ProstCodec::default();
3907 let mut grpc = tonic::server::Grpc::new(codec)
3908 .apply_compression_config(
3909 accept_compression_encodings,
3910 send_compression_encodings,
3911 )
3912 .apply_max_message_size_config(
3913 max_decoding_message_size,
3914 max_encoding_message_size,
3915 );
3916 let res = grpc.unary(method, req).await;
3917 Ok(res)
3918 };
3919 Box::pin(fut)
3920 }
3921 "/gestalt.provider.v1.IndexedDB/Clear" => {
3922 #[allow(non_camel_case_types)]
3923 struct ClearSvc<T: IndexedDb>(pub Arc<T>);
3924 impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreNameRequest> for ClearSvc<T> {
3925 type Response = ();
3926 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3927 fn call(
3928 &mut self,
3929 request: tonic::Request<super::ObjectStoreNameRequest>,
3930 ) -> Self::Future {
3931 let inner = Arc::clone(&self.0);
3932 let fut = async move { <T as IndexedDb>::clear(&inner, request).await };
3933 Box::pin(fut)
3934 }
3935 }
3936 let accept_compression_encodings = self.accept_compression_encodings;
3937 let send_compression_encodings = self.send_compression_encodings;
3938 let max_decoding_message_size = self.max_decoding_message_size;
3939 let max_encoding_message_size = self.max_encoding_message_size;
3940 let inner = self.inner.clone();
3941 let fut = async move {
3942 let method = ClearSvc(inner);
3943 let codec = tonic_prost::ProstCodec::default();
3944 let mut grpc = tonic::server::Grpc::new(codec)
3945 .apply_compression_config(
3946 accept_compression_encodings,
3947 send_compression_encodings,
3948 )
3949 .apply_max_message_size_config(
3950 max_decoding_message_size,
3951 max_encoding_message_size,
3952 );
3953 let res = grpc.unary(method, req).await;
3954 Ok(res)
3955 };
3956 Box::pin(fut)
3957 }
3958 "/gestalt.provider.v1.IndexedDB/GetAll" => {
3959 #[allow(non_camel_case_types)]
3960 struct GetAllSvc<T: IndexedDb>(pub Arc<T>);
3961 impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRangeRequest> for GetAllSvc<T> {
3962 type Response = super::RecordsResponse;
3963 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
3964 fn call(
3965 &mut self,
3966 request: tonic::Request<super::ObjectStoreRangeRequest>,
3967 ) -> Self::Future {
3968 let inner = Arc::clone(&self.0);
3969 let fut =
3970 async move { <T as IndexedDb>::get_all(&inner, request).await };
3971 Box::pin(fut)
3972 }
3973 }
3974 let accept_compression_encodings = self.accept_compression_encodings;
3975 let send_compression_encodings = self.send_compression_encodings;
3976 let max_decoding_message_size = self.max_decoding_message_size;
3977 let max_encoding_message_size = self.max_encoding_message_size;
3978 let inner = self.inner.clone();
3979 let fut = async move {
3980 let method = GetAllSvc(inner);
3981 let codec = tonic_prost::ProstCodec::default();
3982 let mut grpc = tonic::server::Grpc::new(codec)
3983 .apply_compression_config(
3984 accept_compression_encodings,
3985 send_compression_encodings,
3986 )
3987 .apply_max_message_size_config(
3988 max_decoding_message_size,
3989 max_encoding_message_size,
3990 );
3991 let res = grpc.unary(method, req).await;
3992 Ok(res)
3993 };
3994 Box::pin(fut)
3995 }
3996 "/gestalt.provider.v1.IndexedDB/GetAllKeys" => {
3997 #[allow(non_camel_case_types)]
3998 struct GetAllKeysSvc<T: IndexedDb>(pub Arc<T>);
3999 impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRangeRequest>
4000 for GetAllKeysSvc<T>
4001 {
4002 type Response = super::KeysResponse;
4003 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4004 fn call(
4005 &mut self,
4006 request: tonic::Request<super::ObjectStoreRangeRequest>,
4007 ) -> Self::Future {
4008 let inner = Arc::clone(&self.0);
4009 let fut = async move {
4010 <T as IndexedDb>::get_all_keys(&inner, request).await
4011 };
4012 Box::pin(fut)
4013 }
4014 }
4015 let accept_compression_encodings = self.accept_compression_encodings;
4016 let send_compression_encodings = self.send_compression_encodings;
4017 let max_decoding_message_size = self.max_decoding_message_size;
4018 let max_encoding_message_size = self.max_encoding_message_size;
4019 let inner = self.inner.clone();
4020 let fut = async move {
4021 let method = GetAllKeysSvc(inner);
4022 let codec = tonic_prost::ProstCodec::default();
4023 let mut grpc = tonic::server::Grpc::new(codec)
4024 .apply_compression_config(
4025 accept_compression_encodings,
4026 send_compression_encodings,
4027 )
4028 .apply_max_message_size_config(
4029 max_decoding_message_size,
4030 max_encoding_message_size,
4031 );
4032 let res = grpc.unary(method, req).await;
4033 Ok(res)
4034 };
4035 Box::pin(fut)
4036 }
4037 "/gestalt.provider.v1.IndexedDB/Count" => {
4038 #[allow(non_camel_case_types)]
4039 struct CountSvc<T: IndexedDb>(pub Arc<T>);
4040 impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRangeRequest> for CountSvc<T> {
4041 type Response = super::CountResponse;
4042 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4043 fn call(
4044 &mut self,
4045 request: tonic::Request<super::ObjectStoreRangeRequest>,
4046 ) -> Self::Future {
4047 let inner = Arc::clone(&self.0);
4048 let fut = async move { <T as IndexedDb>::count(&inner, request).await };
4049 Box::pin(fut)
4050 }
4051 }
4052 let accept_compression_encodings = self.accept_compression_encodings;
4053 let send_compression_encodings = self.send_compression_encodings;
4054 let max_decoding_message_size = self.max_decoding_message_size;
4055 let max_encoding_message_size = self.max_encoding_message_size;
4056 let inner = self.inner.clone();
4057 let fut = async move {
4058 let method = CountSvc(inner);
4059 let codec = tonic_prost::ProstCodec::default();
4060 let mut grpc = tonic::server::Grpc::new(codec)
4061 .apply_compression_config(
4062 accept_compression_encodings,
4063 send_compression_encodings,
4064 )
4065 .apply_max_message_size_config(
4066 max_decoding_message_size,
4067 max_encoding_message_size,
4068 );
4069 let res = grpc.unary(method, req).await;
4070 Ok(res)
4071 };
4072 Box::pin(fut)
4073 }
4074 "/gestalt.provider.v1.IndexedDB/DeleteRange" => {
4075 #[allow(non_camel_case_types)]
4076 struct DeleteRangeSvc<T: IndexedDb>(pub Arc<T>);
4077 impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRangeRequest>
4078 for DeleteRangeSvc<T>
4079 {
4080 type Response = super::DeleteResponse;
4081 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4082 fn call(
4083 &mut self,
4084 request: tonic::Request<super::ObjectStoreRangeRequest>,
4085 ) -> Self::Future {
4086 let inner = Arc::clone(&self.0);
4087 let fut = async move {
4088 <T as IndexedDb>::delete_range(&inner, request).await
4089 };
4090 Box::pin(fut)
4091 }
4092 }
4093 let accept_compression_encodings = self.accept_compression_encodings;
4094 let send_compression_encodings = self.send_compression_encodings;
4095 let max_decoding_message_size = self.max_decoding_message_size;
4096 let max_encoding_message_size = self.max_encoding_message_size;
4097 let inner = self.inner.clone();
4098 let fut = async move {
4099 let method = DeleteRangeSvc(inner);
4100 let codec = tonic_prost::ProstCodec::default();
4101 let mut grpc = tonic::server::Grpc::new(codec)
4102 .apply_compression_config(
4103 accept_compression_encodings,
4104 send_compression_encodings,
4105 )
4106 .apply_max_message_size_config(
4107 max_decoding_message_size,
4108 max_encoding_message_size,
4109 );
4110 let res = grpc.unary(method, req).await;
4111 Ok(res)
4112 };
4113 Box::pin(fut)
4114 }
4115 "/gestalt.provider.v1.IndexedDB/IndexGet" => {
4116 #[allow(non_camel_case_types)]
4117 struct IndexGetSvc<T: IndexedDb>(pub Arc<T>);
4118 impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexGetSvc<T> {
4119 type Response = super::RecordResponse;
4120 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4121 fn call(
4122 &mut self,
4123 request: tonic::Request<super::IndexQueryRequest>,
4124 ) -> Self::Future {
4125 let inner = Arc::clone(&self.0);
4126 let fut =
4127 async move { <T as IndexedDb>::index_get(&inner, request).await };
4128 Box::pin(fut)
4129 }
4130 }
4131 let accept_compression_encodings = self.accept_compression_encodings;
4132 let send_compression_encodings = self.send_compression_encodings;
4133 let max_decoding_message_size = self.max_decoding_message_size;
4134 let max_encoding_message_size = self.max_encoding_message_size;
4135 let inner = self.inner.clone();
4136 let fut = async move {
4137 let method = IndexGetSvc(inner);
4138 let codec = tonic_prost::ProstCodec::default();
4139 let mut grpc = tonic::server::Grpc::new(codec)
4140 .apply_compression_config(
4141 accept_compression_encodings,
4142 send_compression_encodings,
4143 )
4144 .apply_max_message_size_config(
4145 max_decoding_message_size,
4146 max_encoding_message_size,
4147 );
4148 let res = grpc.unary(method, req).await;
4149 Ok(res)
4150 };
4151 Box::pin(fut)
4152 }
4153 "/gestalt.provider.v1.IndexedDB/IndexGetKey" => {
4154 #[allow(non_camel_case_types)]
4155 struct IndexGetKeySvc<T: IndexedDb>(pub Arc<T>);
4156 impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexGetKeySvc<T> {
4157 type Response = super::KeyResponse;
4158 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4159 fn call(
4160 &mut self,
4161 request: tonic::Request<super::IndexQueryRequest>,
4162 ) -> Self::Future {
4163 let inner = Arc::clone(&self.0);
4164 let fut = async move {
4165 <T as IndexedDb>::index_get_key(&inner, request).await
4166 };
4167 Box::pin(fut)
4168 }
4169 }
4170 let accept_compression_encodings = self.accept_compression_encodings;
4171 let send_compression_encodings = self.send_compression_encodings;
4172 let max_decoding_message_size = self.max_decoding_message_size;
4173 let max_encoding_message_size = self.max_encoding_message_size;
4174 let inner = self.inner.clone();
4175 let fut = async move {
4176 let method = IndexGetKeySvc(inner);
4177 let codec = tonic_prost::ProstCodec::default();
4178 let mut grpc = tonic::server::Grpc::new(codec)
4179 .apply_compression_config(
4180 accept_compression_encodings,
4181 send_compression_encodings,
4182 )
4183 .apply_max_message_size_config(
4184 max_decoding_message_size,
4185 max_encoding_message_size,
4186 );
4187 let res = grpc.unary(method, req).await;
4188 Ok(res)
4189 };
4190 Box::pin(fut)
4191 }
4192 "/gestalt.provider.v1.IndexedDB/IndexGetAll" => {
4193 #[allow(non_camel_case_types)]
4194 struct IndexGetAllSvc<T: IndexedDb>(pub Arc<T>);
4195 impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexGetAllSvc<T> {
4196 type Response = super::RecordsResponse;
4197 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4198 fn call(
4199 &mut self,
4200 request: tonic::Request<super::IndexQueryRequest>,
4201 ) -> Self::Future {
4202 let inner = Arc::clone(&self.0);
4203 let fut = async move {
4204 <T as IndexedDb>::index_get_all(&inner, request).await
4205 };
4206 Box::pin(fut)
4207 }
4208 }
4209 let accept_compression_encodings = self.accept_compression_encodings;
4210 let send_compression_encodings = self.send_compression_encodings;
4211 let max_decoding_message_size = self.max_decoding_message_size;
4212 let max_encoding_message_size = self.max_encoding_message_size;
4213 let inner = self.inner.clone();
4214 let fut = async move {
4215 let method = IndexGetAllSvc(inner);
4216 let codec = tonic_prost::ProstCodec::default();
4217 let mut grpc = tonic::server::Grpc::new(codec)
4218 .apply_compression_config(
4219 accept_compression_encodings,
4220 send_compression_encodings,
4221 )
4222 .apply_max_message_size_config(
4223 max_decoding_message_size,
4224 max_encoding_message_size,
4225 );
4226 let res = grpc.unary(method, req).await;
4227 Ok(res)
4228 };
4229 Box::pin(fut)
4230 }
4231 "/gestalt.provider.v1.IndexedDB/IndexGetAllKeys" => {
4232 #[allow(non_camel_case_types)]
4233 struct IndexGetAllKeysSvc<T: IndexedDb>(pub Arc<T>);
4234 impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexGetAllKeysSvc<T> {
4235 type Response = super::KeysResponse;
4236 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4237 fn call(
4238 &mut self,
4239 request: tonic::Request<super::IndexQueryRequest>,
4240 ) -> Self::Future {
4241 let inner = Arc::clone(&self.0);
4242 let fut = async move {
4243 <T as IndexedDb>::index_get_all_keys(&inner, request).await
4244 };
4245 Box::pin(fut)
4246 }
4247 }
4248 let accept_compression_encodings = self.accept_compression_encodings;
4249 let send_compression_encodings = self.send_compression_encodings;
4250 let max_decoding_message_size = self.max_decoding_message_size;
4251 let max_encoding_message_size = self.max_encoding_message_size;
4252 let inner = self.inner.clone();
4253 let fut = async move {
4254 let method = IndexGetAllKeysSvc(inner);
4255 let codec = tonic_prost::ProstCodec::default();
4256 let mut grpc = tonic::server::Grpc::new(codec)
4257 .apply_compression_config(
4258 accept_compression_encodings,
4259 send_compression_encodings,
4260 )
4261 .apply_max_message_size_config(
4262 max_decoding_message_size,
4263 max_encoding_message_size,
4264 );
4265 let res = grpc.unary(method, req).await;
4266 Ok(res)
4267 };
4268 Box::pin(fut)
4269 }
4270 "/gestalt.provider.v1.IndexedDB/IndexCount" => {
4271 #[allow(non_camel_case_types)]
4272 struct IndexCountSvc<T: IndexedDb>(pub Arc<T>);
4273 impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexCountSvc<T> {
4274 type Response = super::CountResponse;
4275 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4276 fn call(
4277 &mut self,
4278 request: tonic::Request<super::IndexQueryRequest>,
4279 ) -> Self::Future {
4280 let inner = Arc::clone(&self.0);
4281 let fut =
4282 async move { <T as IndexedDb>::index_count(&inner, request).await };
4283 Box::pin(fut)
4284 }
4285 }
4286 let accept_compression_encodings = self.accept_compression_encodings;
4287 let send_compression_encodings = self.send_compression_encodings;
4288 let max_decoding_message_size = self.max_decoding_message_size;
4289 let max_encoding_message_size = self.max_encoding_message_size;
4290 let inner = self.inner.clone();
4291 let fut = async move {
4292 let method = IndexCountSvc(inner);
4293 let codec = tonic_prost::ProstCodec::default();
4294 let mut grpc = tonic::server::Grpc::new(codec)
4295 .apply_compression_config(
4296 accept_compression_encodings,
4297 send_compression_encodings,
4298 )
4299 .apply_max_message_size_config(
4300 max_decoding_message_size,
4301 max_encoding_message_size,
4302 );
4303 let res = grpc.unary(method, req).await;
4304 Ok(res)
4305 };
4306 Box::pin(fut)
4307 }
4308 "/gestalt.provider.v1.IndexedDB/IndexDelete" => {
4309 #[allow(non_camel_case_types)]
4310 struct IndexDeleteSvc<T: IndexedDb>(pub Arc<T>);
4311 impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexDeleteSvc<T> {
4312 type Response = super::DeleteResponse;
4313 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4314 fn call(
4315 &mut self,
4316 request: tonic::Request<super::IndexQueryRequest>,
4317 ) -> Self::Future {
4318 let inner = Arc::clone(&self.0);
4319 let fut = async move {
4320 <T as IndexedDb>::index_delete(&inner, request).await
4321 };
4322 Box::pin(fut)
4323 }
4324 }
4325 let accept_compression_encodings = self.accept_compression_encodings;
4326 let send_compression_encodings = self.send_compression_encodings;
4327 let max_decoding_message_size = self.max_decoding_message_size;
4328 let max_encoding_message_size = self.max_encoding_message_size;
4329 let inner = self.inner.clone();
4330 let fut = async move {
4331 let method = IndexDeleteSvc(inner);
4332 let codec = tonic_prost::ProstCodec::default();
4333 let mut grpc = tonic::server::Grpc::new(codec)
4334 .apply_compression_config(
4335 accept_compression_encodings,
4336 send_compression_encodings,
4337 )
4338 .apply_max_message_size_config(
4339 max_decoding_message_size,
4340 max_encoding_message_size,
4341 );
4342 let res = grpc.unary(method, req).await;
4343 Ok(res)
4344 };
4345 Box::pin(fut)
4346 }
4347 "/gestalt.provider.v1.IndexedDB/OpenCursor" => {
4348 #[allow(non_camel_case_types)]
4349 struct OpenCursorSvc<T: IndexedDb>(pub Arc<T>);
4350 impl<T: IndexedDb> tonic::server::StreamingService<super::CursorClientMessage>
4351 for OpenCursorSvc<T>
4352 {
4353 type Response = super::CursorResponse;
4354 type ResponseStream = T::OpenCursorStream;
4355 type Future =
4356 BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
4357 fn call(
4358 &mut self,
4359 request: tonic::Request<tonic::Streaming<super::CursorClientMessage>>,
4360 ) -> Self::Future {
4361 let inner = Arc::clone(&self.0);
4362 let fut =
4363 async move { <T as IndexedDb>::open_cursor(&inner, request).await };
4364 Box::pin(fut)
4365 }
4366 }
4367 let accept_compression_encodings = self.accept_compression_encodings;
4368 let send_compression_encodings = self.send_compression_encodings;
4369 let max_decoding_message_size = self.max_decoding_message_size;
4370 let max_encoding_message_size = self.max_encoding_message_size;
4371 let inner = self.inner.clone();
4372 let fut = async move {
4373 let method = OpenCursorSvc(inner);
4374 let codec = tonic_prost::ProstCodec::default();
4375 let mut grpc = tonic::server::Grpc::new(codec)
4376 .apply_compression_config(
4377 accept_compression_encodings,
4378 send_compression_encodings,
4379 )
4380 .apply_max_message_size_config(
4381 max_decoding_message_size,
4382 max_encoding_message_size,
4383 );
4384 let res = grpc.streaming(method, req).await;
4385 Ok(res)
4386 };
4387 Box::pin(fut)
4388 }
4389 _ => Box::pin(async move {
4390 let mut response = http::Response::new(tonic::body::Body::default());
4391 let headers = response.headers_mut();
4392 headers.insert(
4393 tonic::Status::GRPC_STATUS,
4394 (tonic::Code::Unimplemented as i32).into(),
4395 );
4396 headers.insert(
4397 http::header::CONTENT_TYPE,
4398 tonic::metadata::GRPC_CONTENT_TYPE,
4399 );
4400 Ok(response)
4401 }),
4402 }
4403 }
4404 }
4405 impl<T> Clone for IndexedDbServer<T> {
4406 fn clone(&self) -> Self {
4407 let inner = self.inner.clone();
4408 Self {
4409 inner,
4410 accept_compression_encodings: self.accept_compression_encodings,
4411 send_compression_encodings: self.send_compression_encodings,
4412 max_decoding_message_size: self.max_decoding_message_size,
4413 max_encoding_message_size: self.max_encoding_message_size,
4414 }
4415 }
4416 }
4417 pub const SERVICE_NAME: &str = "gestalt.provider.v1.IndexedDB";
4419 impl<T> tonic::server::NamedService for IndexedDbServer<T> {
4420 const NAME: &'static str = SERVICE_NAME;
4421 }
4422}
4423#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4424pub struct S3ObjectRef {
4425 #[prost(string, tag = "1")]
4426 pub bucket: ::prost::alloc::string::String,
4427 #[prost(string, tag = "2")]
4428 pub key: ::prost::alloc::string::String,
4429 #[prost(string, tag = "3")]
4430 pub version_id: ::prost::alloc::string::String,
4431}
4432#[derive(Clone, PartialEq, ::prost::Message)]
4433pub struct S3ObjectMeta {
4434 #[prost(message, optional, tag = "1")]
4435 pub r#ref: ::core::option::Option<S3ObjectRef>,
4436 #[prost(string, tag = "2")]
4437 pub etag: ::prost::alloc::string::String,
4438 #[prost(int64, tag = "3")]
4439 pub size: i64,
4440 #[prost(string, tag = "4")]
4441 pub content_type: ::prost::alloc::string::String,
4442 #[prost(message, optional, tag = "5")]
4443 pub last_modified: ::core::option::Option<::prost_types::Timestamp>,
4444 #[prost(btree_map = "string, string", tag = "6")]
4445 pub metadata: ::prost::alloc::collections::BTreeMap<
4446 ::prost::alloc::string::String,
4447 ::prost::alloc::string::String,
4448 >,
4449 #[prost(string, tag = "7")]
4450 pub storage_class: ::prost::alloc::string::String,
4451}
4452#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4453pub struct ByteRange {
4454 #[prost(int64, optional, tag = "1")]
4455 pub start: ::core::option::Option<i64>,
4456 #[prost(int64, optional, tag = "2")]
4457 pub end: ::core::option::Option<i64>,
4458}
4459#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4460pub struct HeadObjectRequest {
4461 #[prost(message, optional, tag = "1")]
4462 pub r#ref: ::core::option::Option<S3ObjectRef>,
4463}
4464#[derive(Clone, PartialEq, ::prost::Message)]
4465pub struct HeadObjectResponse {
4466 #[prost(message, optional, tag = "1")]
4467 pub meta: ::core::option::Option<S3ObjectMeta>,
4468}
4469#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4470pub struct ReadObjectRequest {
4471 #[prost(message, optional, tag = "1")]
4472 pub r#ref: ::core::option::Option<S3ObjectRef>,
4473 #[prost(message, optional, tag = "2")]
4474 pub range: ::core::option::Option<ByteRange>,
4475 #[prost(string, tag = "3")]
4476 pub if_match: ::prost::alloc::string::String,
4477 #[prost(string, tag = "4")]
4478 pub if_none_match: ::prost::alloc::string::String,
4479 #[prost(message, optional, tag = "5")]
4480 pub if_modified_since: ::core::option::Option<::prost_types::Timestamp>,
4481 #[prost(message, optional, tag = "6")]
4482 pub if_unmodified_since: ::core::option::Option<::prost_types::Timestamp>,
4483}
4484#[derive(Clone, PartialEq, ::prost::Message)]
4485pub struct ReadObjectChunk {
4486 #[prost(oneof = "read_object_chunk::Result", tags = "1, 2")]
4487 pub result: ::core::option::Option<read_object_chunk::Result>,
4488}
4489pub mod read_object_chunk {
4491 #[derive(Clone, PartialEq, ::prost::Oneof)]
4492 pub enum Result {
4493 #[prost(message, tag = "1")]
4494 Meta(super::S3ObjectMeta),
4495 #[prost(bytes, tag = "2")]
4496 Data(::prost::alloc::vec::Vec<u8>),
4497 }
4498}
4499#[derive(Clone, PartialEq, ::prost::Message)]
4500pub struct WriteObjectOpen {
4501 #[prost(message, optional, tag = "1")]
4502 pub r#ref: ::core::option::Option<S3ObjectRef>,
4503 #[prost(string, tag = "2")]
4504 pub content_type: ::prost::alloc::string::String,
4505 #[prost(string, tag = "3")]
4506 pub cache_control: ::prost::alloc::string::String,
4507 #[prost(string, tag = "4")]
4508 pub content_disposition: ::prost::alloc::string::String,
4509 #[prost(string, tag = "5")]
4510 pub content_encoding: ::prost::alloc::string::String,
4511 #[prost(string, tag = "6")]
4512 pub content_language: ::prost::alloc::string::String,
4513 #[prost(btree_map = "string, string", tag = "7")]
4514 pub metadata: ::prost::alloc::collections::BTreeMap<
4515 ::prost::alloc::string::String,
4516 ::prost::alloc::string::String,
4517 >,
4518 #[prost(string, tag = "8")]
4519 pub if_match: ::prost::alloc::string::String,
4520 #[prost(string, tag = "9")]
4521 pub if_none_match: ::prost::alloc::string::String,
4522}
4523#[derive(Clone, PartialEq, ::prost::Message)]
4524pub struct WriteObjectRequest {
4525 #[prost(oneof = "write_object_request::Msg", tags = "1, 2")]
4526 pub msg: ::core::option::Option<write_object_request::Msg>,
4527}
4528pub mod write_object_request {
4530 #[derive(Clone, PartialEq, ::prost::Oneof)]
4531 pub enum Msg {
4532 #[prost(message, tag = "1")]
4533 Open(super::WriteObjectOpen),
4534 #[prost(bytes, tag = "2")]
4535 Data(::prost::alloc::vec::Vec<u8>),
4536 }
4537}
4538#[derive(Clone, PartialEq, ::prost::Message)]
4539pub struct WriteObjectResponse {
4540 #[prost(message, optional, tag = "1")]
4541 pub meta: ::core::option::Option<S3ObjectMeta>,
4542}
4543#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4544pub struct DeleteObjectRequest {
4545 #[prost(message, optional, tag = "1")]
4546 pub r#ref: ::core::option::Option<S3ObjectRef>,
4547}
4548#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4549pub struct ListObjectsRequest {
4550 #[prost(string, tag = "1")]
4551 pub bucket: ::prost::alloc::string::String,
4552 #[prost(string, tag = "2")]
4553 pub prefix: ::prost::alloc::string::String,
4554 #[prost(string, tag = "3")]
4555 pub delimiter: ::prost::alloc::string::String,
4556 #[prost(string, tag = "4")]
4557 pub continuation_token: ::prost::alloc::string::String,
4558 #[prost(string, tag = "5")]
4559 pub start_after: ::prost::alloc::string::String,
4560 #[prost(int32, tag = "6")]
4561 pub max_keys: i32,
4562}
4563#[derive(Clone, PartialEq, ::prost::Message)]
4564pub struct ListObjectsResponse {
4565 #[prost(message, repeated, tag = "1")]
4566 pub objects: ::prost::alloc::vec::Vec<S3ObjectMeta>,
4567 #[prost(string, repeated, tag = "2")]
4568 pub common_prefixes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
4569 #[prost(string, tag = "3")]
4570 pub next_continuation_token: ::prost::alloc::string::String,
4571 #[prost(bool, tag = "4")]
4572 pub has_more: bool,
4573}
4574#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4575pub struct CopyObjectRequest {
4576 #[prost(message, optional, tag = "1")]
4577 pub source: ::core::option::Option<S3ObjectRef>,
4578 #[prost(message, optional, tag = "2")]
4579 pub destination: ::core::option::Option<S3ObjectRef>,
4580 #[prost(string, tag = "3")]
4581 pub if_match: ::prost::alloc::string::String,
4582 #[prost(string, tag = "4")]
4583 pub if_none_match: ::prost::alloc::string::String,
4584}
4585#[derive(Clone, PartialEq, ::prost::Message)]
4586pub struct CopyObjectResponse {
4587 #[prost(message, optional, tag = "1")]
4588 pub meta: ::core::option::Option<S3ObjectMeta>,
4589}
4590#[derive(Clone, PartialEq, ::prost::Message)]
4591pub struct PresignObjectRequest {
4592 #[prost(message, optional, tag = "1")]
4593 pub r#ref: ::core::option::Option<S3ObjectRef>,
4594 #[prost(enumeration = "PresignMethod", tag = "2")]
4595 pub method: i32,
4596 #[prost(int64, tag = "3")]
4597 pub expires_seconds: i64,
4598 #[prost(string, tag = "4")]
4599 pub content_type: ::prost::alloc::string::String,
4600 #[prost(string, tag = "5")]
4601 pub content_disposition: ::prost::alloc::string::String,
4602 #[prost(btree_map = "string, string", tag = "6")]
4603 pub headers: ::prost::alloc::collections::BTreeMap<
4604 ::prost::alloc::string::String,
4605 ::prost::alloc::string::String,
4606 >,
4607}
4608#[derive(Clone, PartialEq, ::prost::Message)]
4609pub struct PresignObjectResponse {
4610 #[prost(string, tag = "1")]
4611 pub url: ::prost::alloc::string::String,
4612 #[prost(enumeration = "PresignMethod", tag = "2")]
4613 pub method: i32,
4614 #[prost(message, optional, tag = "3")]
4615 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
4616 #[prost(btree_map = "string, string", tag = "4")]
4617 pub headers: ::prost::alloc::collections::BTreeMap<
4618 ::prost::alloc::string::String,
4619 ::prost::alloc::string::String,
4620 >,
4621}
4622#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
4623#[repr(i32)]
4624pub enum PresignMethod {
4625 Unspecified = 0,
4626 Get = 1,
4627 Put = 2,
4628 Delete = 3,
4629 Head = 4,
4630}
4631impl PresignMethod {
4632 pub fn as_str_name(&self) -> &'static str {
4637 match self {
4638 Self::Unspecified => "PRESIGN_METHOD_UNSPECIFIED",
4639 Self::Get => "PRESIGN_METHOD_GET",
4640 Self::Put => "PRESIGN_METHOD_PUT",
4641 Self::Delete => "PRESIGN_METHOD_DELETE",
4642 Self::Head => "PRESIGN_METHOD_HEAD",
4643 }
4644 }
4645 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4647 match value {
4648 "PRESIGN_METHOD_UNSPECIFIED" => Some(Self::Unspecified),
4649 "PRESIGN_METHOD_GET" => Some(Self::Get),
4650 "PRESIGN_METHOD_PUT" => Some(Self::Put),
4651 "PRESIGN_METHOD_DELETE" => Some(Self::Delete),
4652 "PRESIGN_METHOD_HEAD" => Some(Self::Head),
4653 _ => None,
4654 }
4655 }
4656}
4657pub mod s3_client {
4659 #![allow(
4660 unused_variables,
4661 dead_code,
4662 missing_docs,
4663 clippy::wildcard_imports,
4664 clippy::let_unit_value
4665 )]
4666 use tonic::codegen::http::Uri;
4667 use tonic::codegen::*;
4668 #[derive(Debug, Clone)]
4669 pub struct S3Client<T> {
4670 inner: tonic::client::Grpc<T>,
4671 }
4672 impl S3Client<tonic::transport::Channel> {
4673 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
4675 where
4676 D: TryInto<tonic::transport::Endpoint>,
4677 D::Error: Into<StdError>,
4678 {
4679 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
4680 Ok(Self::new(conn))
4681 }
4682 }
4683 impl<T> S3Client<T>
4684 where
4685 T: tonic::client::GrpcService<tonic::body::Body>,
4686 T::Error: Into<StdError>,
4687 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
4688 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
4689 {
4690 pub fn new(inner: T) -> Self {
4691 let inner = tonic::client::Grpc::new(inner);
4692 Self { inner }
4693 }
4694 pub fn with_origin(inner: T, origin: Uri) -> Self {
4695 let inner = tonic::client::Grpc::with_origin(inner, origin);
4696 Self { inner }
4697 }
4698 pub fn with_interceptor<F>(inner: T, interceptor: F) -> S3Client<InterceptedService<T, F>>
4699 where
4700 F: tonic::service::Interceptor,
4701 T::ResponseBody: Default,
4702 T: tonic::codegen::Service<
4703 http::Request<tonic::body::Body>,
4704 Response = http::Response<
4705 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
4706 >,
4707 >,
4708 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
4709 Into<StdError> + std::marker::Send + std::marker::Sync,
4710 {
4711 S3Client::new(InterceptedService::new(inner, interceptor))
4712 }
4713 #[must_use]
4718 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
4719 self.inner = self.inner.send_compressed(encoding);
4720 self
4721 }
4722 #[must_use]
4724 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
4725 self.inner = self.inner.accept_compressed(encoding);
4726 self
4727 }
4728 #[must_use]
4732 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
4733 self.inner = self.inner.max_decoding_message_size(limit);
4734 self
4735 }
4736 #[must_use]
4740 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
4741 self.inner = self.inner.max_encoding_message_size(limit);
4742 self
4743 }
4744 pub async fn head_object(
4745 &mut self,
4746 request: impl tonic::IntoRequest<super::HeadObjectRequest>,
4747 ) -> std::result::Result<tonic::Response<super::HeadObjectResponse>, tonic::Status>
4748 {
4749 self.inner.ready().await.map_err(|e| {
4750 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4751 })?;
4752 let codec = tonic_prost::ProstCodec::default();
4753 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/HeadObject");
4754 let mut req = request.into_request();
4755 req.extensions_mut()
4756 .insert(GrpcMethod::new("gestalt.provider.v1.S3", "HeadObject"));
4757 self.inner.unary(req, path, codec).await
4758 }
4759 pub async fn read_object(
4762 &mut self,
4763 request: impl tonic::IntoRequest<super::ReadObjectRequest>,
4764 ) -> std::result::Result<
4765 tonic::Response<tonic::codec::Streaming<super::ReadObjectChunk>>,
4766 tonic::Status,
4767 > {
4768 self.inner.ready().await.map_err(|e| {
4769 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4770 })?;
4771 let codec = tonic_prost::ProstCodec::default();
4772 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/ReadObject");
4773 let mut req = request.into_request();
4774 req.extensions_mut()
4775 .insert(GrpcMethod::new("gestalt.provider.v1.S3", "ReadObject"));
4776 self.inner.server_streaming(req, path, codec).await
4777 }
4778 pub async fn write_object(
4782 &mut self,
4783 request: impl tonic::IntoStreamingRequest<Message = super::WriteObjectRequest>,
4784 ) -> std::result::Result<tonic::Response<super::WriteObjectResponse>, tonic::Status>
4785 {
4786 self.inner.ready().await.map_err(|e| {
4787 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4788 })?;
4789 let codec = tonic_prost::ProstCodec::default();
4790 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/WriteObject");
4791 let mut req = request.into_streaming_request();
4792 req.extensions_mut()
4793 .insert(GrpcMethod::new("gestalt.provider.v1.S3", "WriteObject"));
4794 self.inner.client_streaming(req, path, codec).await
4795 }
4796 pub async fn delete_object(
4797 &mut self,
4798 request: impl tonic::IntoRequest<super::DeleteObjectRequest>,
4799 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
4800 self.inner.ready().await.map_err(|e| {
4801 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4802 })?;
4803 let codec = tonic_prost::ProstCodec::default();
4804 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/DeleteObject");
4805 let mut req = request.into_request();
4806 req.extensions_mut()
4807 .insert(GrpcMethod::new("gestalt.provider.v1.S3", "DeleteObject"));
4808 self.inner.unary(req, path, codec).await
4809 }
4810 pub async fn list_objects(
4811 &mut self,
4812 request: impl tonic::IntoRequest<super::ListObjectsRequest>,
4813 ) -> std::result::Result<tonic::Response<super::ListObjectsResponse>, tonic::Status>
4814 {
4815 self.inner.ready().await.map_err(|e| {
4816 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4817 })?;
4818 let codec = tonic_prost::ProstCodec::default();
4819 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/ListObjects");
4820 let mut req = request.into_request();
4821 req.extensions_mut()
4822 .insert(GrpcMethod::new("gestalt.provider.v1.S3", "ListObjects"));
4823 self.inner.unary(req, path, codec).await
4824 }
4825 pub async fn copy_object(
4826 &mut self,
4827 request: impl tonic::IntoRequest<super::CopyObjectRequest>,
4828 ) -> std::result::Result<tonic::Response<super::CopyObjectResponse>, tonic::Status>
4829 {
4830 self.inner.ready().await.map_err(|e| {
4831 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4832 })?;
4833 let codec = tonic_prost::ProstCodec::default();
4834 let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/CopyObject");
4835 let mut req = request.into_request();
4836 req.extensions_mut()
4837 .insert(GrpcMethod::new("gestalt.provider.v1.S3", "CopyObject"));
4838 self.inner.unary(req, path, codec).await
4839 }
4840 pub async fn presign_object(
4841 &mut self,
4842 request: impl tonic::IntoRequest<super::PresignObjectRequest>,
4843 ) -> std::result::Result<tonic::Response<super::PresignObjectResponse>, tonic::Status>
4844 {
4845 self.inner.ready().await.map_err(|e| {
4846 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
4847 })?;
4848 let codec = tonic_prost::ProstCodec::default();
4849 let path =
4850 http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/PresignObject");
4851 let mut req = request.into_request();
4852 req.extensions_mut()
4853 .insert(GrpcMethod::new("gestalt.provider.v1.S3", "PresignObject"));
4854 self.inner.unary(req, path, codec).await
4855 }
4856 }
4857}
4858pub mod s3_server {
4860 #![allow(
4861 unused_variables,
4862 dead_code,
4863 missing_docs,
4864 clippy::wildcard_imports,
4865 clippy::let_unit_value
4866 )]
4867 use tonic::codegen::*;
4868 #[async_trait]
4870 pub trait S3: std::marker::Send + std::marker::Sync + 'static {
4871 async fn head_object(
4872 &self,
4873 request: tonic::Request<super::HeadObjectRequest>,
4874 ) -> std::result::Result<tonic::Response<super::HeadObjectResponse>, tonic::Status>;
4875 type ReadObjectStream: tonic::codegen::tokio_stream::Stream<
4877 Item = std::result::Result<super::ReadObjectChunk, tonic::Status>,
4878 > + std::marker::Send
4879 + 'static;
4880 async fn read_object(
4883 &self,
4884 request: tonic::Request<super::ReadObjectRequest>,
4885 ) -> std::result::Result<tonic::Response<Self::ReadObjectStream>, tonic::Status>;
4886 async fn write_object(
4890 &self,
4891 request: tonic::Request<tonic::Streaming<super::WriteObjectRequest>>,
4892 ) -> std::result::Result<tonic::Response<super::WriteObjectResponse>, tonic::Status>;
4893 async fn delete_object(
4894 &self,
4895 request: tonic::Request<super::DeleteObjectRequest>,
4896 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
4897 async fn list_objects(
4898 &self,
4899 request: tonic::Request<super::ListObjectsRequest>,
4900 ) -> std::result::Result<tonic::Response<super::ListObjectsResponse>, tonic::Status>;
4901 async fn copy_object(
4902 &self,
4903 request: tonic::Request<super::CopyObjectRequest>,
4904 ) -> std::result::Result<tonic::Response<super::CopyObjectResponse>, tonic::Status>;
4905 async fn presign_object(
4906 &self,
4907 request: tonic::Request<super::PresignObjectRequest>,
4908 ) -> std::result::Result<tonic::Response<super::PresignObjectResponse>, tonic::Status>;
4909 }
4910 #[derive(Debug)]
4911 pub struct S3Server<T> {
4912 inner: Arc<T>,
4913 accept_compression_encodings: EnabledCompressionEncodings,
4914 send_compression_encodings: EnabledCompressionEncodings,
4915 max_decoding_message_size: Option<usize>,
4916 max_encoding_message_size: Option<usize>,
4917 }
4918 impl<T> S3Server<T> {
4919 pub fn new(inner: T) -> Self {
4920 Self::from_arc(Arc::new(inner))
4921 }
4922 pub fn from_arc(inner: Arc<T>) -> Self {
4923 Self {
4924 inner,
4925 accept_compression_encodings: Default::default(),
4926 send_compression_encodings: Default::default(),
4927 max_decoding_message_size: None,
4928 max_encoding_message_size: None,
4929 }
4930 }
4931 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
4932 where
4933 F: tonic::service::Interceptor,
4934 {
4935 InterceptedService::new(Self::new(inner), interceptor)
4936 }
4937 #[must_use]
4939 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
4940 self.accept_compression_encodings.enable(encoding);
4941 self
4942 }
4943 #[must_use]
4945 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
4946 self.send_compression_encodings.enable(encoding);
4947 self
4948 }
4949 #[must_use]
4953 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
4954 self.max_decoding_message_size = Some(limit);
4955 self
4956 }
4957 #[must_use]
4961 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
4962 self.max_encoding_message_size = Some(limit);
4963 self
4964 }
4965 }
4966 impl<T, B> tonic::codegen::Service<http::Request<B>> for S3Server<T>
4967 where
4968 T: S3,
4969 B: Body + std::marker::Send + 'static,
4970 B::Error: Into<StdError> + std::marker::Send + 'static,
4971 {
4972 type Response = http::Response<tonic::body::Body>;
4973 type Error = std::convert::Infallible;
4974 type Future = BoxFuture<Self::Response, Self::Error>;
4975 fn poll_ready(
4976 &mut self,
4977 _cx: &mut Context<'_>,
4978 ) -> Poll<std::result::Result<(), Self::Error>> {
4979 Poll::Ready(Ok(()))
4980 }
4981 fn call(&mut self, req: http::Request<B>) -> Self::Future {
4982 match req.uri().path() {
4983 "/gestalt.provider.v1.S3/HeadObject" => {
4984 #[allow(non_camel_case_types)]
4985 struct HeadObjectSvc<T: S3>(pub Arc<T>);
4986 impl<T: S3> tonic::server::UnaryService<super::HeadObjectRequest> for HeadObjectSvc<T> {
4987 type Response = super::HeadObjectResponse;
4988 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
4989 fn call(
4990 &mut self,
4991 request: tonic::Request<super::HeadObjectRequest>,
4992 ) -> Self::Future {
4993 let inner = Arc::clone(&self.0);
4994 let fut = async move { <T as S3>::head_object(&inner, request).await };
4995 Box::pin(fut)
4996 }
4997 }
4998 let accept_compression_encodings = self.accept_compression_encodings;
4999 let send_compression_encodings = self.send_compression_encodings;
5000 let max_decoding_message_size = self.max_decoding_message_size;
5001 let max_encoding_message_size = self.max_encoding_message_size;
5002 let inner = self.inner.clone();
5003 let fut = async move {
5004 let method = HeadObjectSvc(inner);
5005 let codec = tonic_prost::ProstCodec::default();
5006 let mut grpc = tonic::server::Grpc::new(codec)
5007 .apply_compression_config(
5008 accept_compression_encodings,
5009 send_compression_encodings,
5010 )
5011 .apply_max_message_size_config(
5012 max_decoding_message_size,
5013 max_encoding_message_size,
5014 );
5015 let res = grpc.unary(method, req).await;
5016 Ok(res)
5017 };
5018 Box::pin(fut)
5019 }
5020 "/gestalt.provider.v1.S3/ReadObject" => {
5021 #[allow(non_camel_case_types)]
5022 struct ReadObjectSvc<T: S3>(pub Arc<T>);
5023 impl<T: S3> tonic::server::ServerStreamingService<super::ReadObjectRequest> for ReadObjectSvc<T> {
5024 type Response = super::ReadObjectChunk;
5025 type ResponseStream = T::ReadObjectStream;
5026 type Future =
5027 BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
5028 fn call(
5029 &mut self,
5030 request: tonic::Request<super::ReadObjectRequest>,
5031 ) -> Self::Future {
5032 let inner = Arc::clone(&self.0);
5033 let fut = async move { <T as S3>::read_object(&inner, request).await };
5034 Box::pin(fut)
5035 }
5036 }
5037 let accept_compression_encodings = self.accept_compression_encodings;
5038 let send_compression_encodings = self.send_compression_encodings;
5039 let max_decoding_message_size = self.max_decoding_message_size;
5040 let max_encoding_message_size = self.max_encoding_message_size;
5041 let inner = self.inner.clone();
5042 let fut = async move {
5043 let method = ReadObjectSvc(inner);
5044 let codec = tonic_prost::ProstCodec::default();
5045 let mut grpc = tonic::server::Grpc::new(codec)
5046 .apply_compression_config(
5047 accept_compression_encodings,
5048 send_compression_encodings,
5049 )
5050 .apply_max_message_size_config(
5051 max_decoding_message_size,
5052 max_encoding_message_size,
5053 );
5054 let res = grpc.server_streaming(method, req).await;
5055 Ok(res)
5056 };
5057 Box::pin(fut)
5058 }
5059 "/gestalt.provider.v1.S3/WriteObject" => {
5060 #[allow(non_camel_case_types)]
5061 struct WriteObjectSvc<T: S3>(pub Arc<T>);
5062 impl<T: S3> tonic::server::ClientStreamingService<super::WriteObjectRequest> for WriteObjectSvc<T> {
5063 type Response = super::WriteObjectResponse;
5064 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
5065 fn call(
5066 &mut self,
5067 request: tonic::Request<tonic::Streaming<super::WriteObjectRequest>>,
5068 ) -> Self::Future {
5069 let inner = Arc::clone(&self.0);
5070 let fut = async move { <T as S3>::write_object(&inner, request).await };
5071 Box::pin(fut)
5072 }
5073 }
5074 let accept_compression_encodings = self.accept_compression_encodings;
5075 let send_compression_encodings = self.send_compression_encodings;
5076 let max_decoding_message_size = self.max_decoding_message_size;
5077 let max_encoding_message_size = self.max_encoding_message_size;
5078 let inner = self.inner.clone();
5079 let fut = async move {
5080 let method = WriteObjectSvc(inner);
5081 let codec = tonic_prost::ProstCodec::default();
5082 let mut grpc = tonic::server::Grpc::new(codec)
5083 .apply_compression_config(
5084 accept_compression_encodings,
5085 send_compression_encodings,
5086 )
5087 .apply_max_message_size_config(
5088 max_decoding_message_size,
5089 max_encoding_message_size,
5090 );
5091 let res = grpc.client_streaming(method, req).await;
5092 Ok(res)
5093 };
5094 Box::pin(fut)
5095 }
5096 "/gestalt.provider.v1.S3/DeleteObject" => {
5097 #[allow(non_camel_case_types)]
5098 struct DeleteObjectSvc<T: S3>(pub Arc<T>);
5099 impl<T: S3> tonic::server::UnaryService<super::DeleteObjectRequest> for DeleteObjectSvc<T> {
5100 type Response = ();
5101 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
5102 fn call(
5103 &mut self,
5104 request: tonic::Request<super::DeleteObjectRequest>,
5105 ) -> Self::Future {
5106 let inner = Arc::clone(&self.0);
5107 let fut =
5108 async move { <T as S3>::delete_object(&inner, request).await };
5109 Box::pin(fut)
5110 }
5111 }
5112 let accept_compression_encodings = self.accept_compression_encodings;
5113 let send_compression_encodings = self.send_compression_encodings;
5114 let max_decoding_message_size = self.max_decoding_message_size;
5115 let max_encoding_message_size = self.max_encoding_message_size;
5116 let inner = self.inner.clone();
5117 let fut = async move {
5118 let method = DeleteObjectSvc(inner);
5119 let codec = tonic_prost::ProstCodec::default();
5120 let mut grpc = tonic::server::Grpc::new(codec)
5121 .apply_compression_config(
5122 accept_compression_encodings,
5123 send_compression_encodings,
5124 )
5125 .apply_max_message_size_config(
5126 max_decoding_message_size,
5127 max_encoding_message_size,
5128 );
5129 let res = grpc.unary(method, req).await;
5130 Ok(res)
5131 };
5132 Box::pin(fut)
5133 }
5134 "/gestalt.provider.v1.S3/ListObjects" => {
5135 #[allow(non_camel_case_types)]
5136 struct ListObjectsSvc<T: S3>(pub Arc<T>);
5137 impl<T: S3> tonic::server::UnaryService<super::ListObjectsRequest> for ListObjectsSvc<T> {
5138 type Response = super::ListObjectsResponse;
5139 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
5140 fn call(
5141 &mut self,
5142 request: tonic::Request<super::ListObjectsRequest>,
5143 ) -> Self::Future {
5144 let inner = Arc::clone(&self.0);
5145 let fut = async move { <T as S3>::list_objects(&inner, request).await };
5146 Box::pin(fut)
5147 }
5148 }
5149 let accept_compression_encodings = self.accept_compression_encodings;
5150 let send_compression_encodings = self.send_compression_encodings;
5151 let max_decoding_message_size = self.max_decoding_message_size;
5152 let max_encoding_message_size = self.max_encoding_message_size;
5153 let inner = self.inner.clone();
5154 let fut = async move {
5155 let method = ListObjectsSvc(inner);
5156 let codec = tonic_prost::ProstCodec::default();
5157 let mut grpc = tonic::server::Grpc::new(codec)
5158 .apply_compression_config(
5159 accept_compression_encodings,
5160 send_compression_encodings,
5161 )
5162 .apply_max_message_size_config(
5163 max_decoding_message_size,
5164 max_encoding_message_size,
5165 );
5166 let res = grpc.unary(method, req).await;
5167 Ok(res)
5168 };
5169 Box::pin(fut)
5170 }
5171 "/gestalt.provider.v1.S3/CopyObject" => {
5172 #[allow(non_camel_case_types)]
5173 struct CopyObjectSvc<T: S3>(pub Arc<T>);
5174 impl<T: S3> tonic::server::UnaryService<super::CopyObjectRequest> for CopyObjectSvc<T> {
5175 type Response = super::CopyObjectResponse;
5176 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
5177 fn call(
5178 &mut self,
5179 request: tonic::Request<super::CopyObjectRequest>,
5180 ) -> Self::Future {
5181 let inner = Arc::clone(&self.0);
5182 let fut = async move { <T as S3>::copy_object(&inner, request).await };
5183 Box::pin(fut)
5184 }
5185 }
5186 let accept_compression_encodings = self.accept_compression_encodings;
5187 let send_compression_encodings = self.send_compression_encodings;
5188 let max_decoding_message_size = self.max_decoding_message_size;
5189 let max_encoding_message_size = self.max_encoding_message_size;
5190 let inner = self.inner.clone();
5191 let fut = async move {
5192 let method = CopyObjectSvc(inner);
5193 let codec = tonic_prost::ProstCodec::default();
5194 let mut grpc = tonic::server::Grpc::new(codec)
5195 .apply_compression_config(
5196 accept_compression_encodings,
5197 send_compression_encodings,
5198 )
5199 .apply_max_message_size_config(
5200 max_decoding_message_size,
5201 max_encoding_message_size,
5202 );
5203 let res = grpc.unary(method, req).await;
5204 Ok(res)
5205 };
5206 Box::pin(fut)
5207 }
5208 "/gestalt.provider.v1.S3/PresignObject" => {
5209 #[allow(non_camel_case_types)]
5210 struct PresignObjectSvc<T: S3>(pub Arc<T>);
5211 impl<T: S3> tonic::server::UnaryService<super::PresignObjectRequest> for PresignObjectSvc<T> {
5212 type Response = super::PresignObjectResponse;
5213 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
5214 fn call(
5215 &mut self,
5216 request: tonic::Request<super::PresignObjectRequest>,
5217 ) -> Self::Future {
5218 let inner = Arc::clone(&self.0);
5219 let fut =
5220 async move { <T as S3>::presign_object(&inner, request).await };
5221 Box::pin(fut)
5222 }
5223 }
5224 let accept_compression_encodings = self.accept_compression_encodings;
5225 let send_compression_encodings = self.send_compression_encodings;
5226 let max_decoding_message_size = self.max_decoding_message_size;
5227 let max_encoding_message_size = self.max_encoding_message_size;
5228 let inner = self.inner.clone();
5229 let fut = async move {
5230 let method = PresignObjectSvc(inner);
5231 let codec = tonic_prost::ProstCodec::default();
5232 let mut grpc = tonic::server::Grpc::new(codec)
5233 .apply_compression_config(
5234 accept_compression_encodings,
5235 send_compression_encodings,
5236 )
5237 .apply_max_message_size_config(
5238 max_decoding_message_size,
5239 max_encoding_message_size,
5240 );
5241 let res = grpc.unary(method, req).await;
5242 Ok(res)
5243 };
5244 Box::pin(fut)
5245 }
5246 _ => Box::pin(async move {
5247 let mut response = http::Response::new(tonic::body::Body::default());
5248 let headers = response.headers_mut();
5249 headers.insert(
5250 tonic::Status::GRPC_STATUS,
5251 (tonic::Code::Unimplemented as i32).into(),
5252 );
5253 headers.insert(
5254 http::header::CONTENT_TYPE,
5255 tonic::metadata::GRPC_CONTENT_TYPE,
5256 );
5257 Ok(response)
5258 }),
5259 }
5260 }
5261 }
5262 impl<T> Clone for S3Server<T> {
5263 fn clone(&self) -> Self {
5264 let inner = self.inner.clone();
5265 Self {
5266 inner,
5267 accept_compression_encodings: self.accept_compression_encodings,
5268 send_compression_encodings: self.send_compression_encodings,
5269 max_decoding_message_size: self.max_decoding_message_size,
5270 max_encoding_message_size: self.max_encoding_message_size,
5271 }
5272 }
5273 }
5274 pub const SERVICE_NAME: &str = "gestalt.provider.v1.S3";
5276 impl<T> tonic::server::NamedService for S3Server<T> {
5277 const NAME: &'static str = SERVICE_NAME;
5278 }
5279}