#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CatalogParameter {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(bool, tag = "4")]
pub required: bool,
#[prost(message, optional, tag = "5")]
pub default: ::core::option::Option<::prost_types::Value>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OperationAnnotations {
#[prost(bool, optional, tag = "1")]
pub read_only_hint: ::core::option::Option<bool>,
#[prost(bool, optional, tag = "2")]
pub idempotent_hint: ::core::option::Option<bool>,
#[prost(bool, optional, tag = "3")]
pub destructive_hint: ::core::option::Option<bool>,
#[prost(bool, optional, tag = "4")]
pub open_world_hint: ::core::option::Option<bool>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CatalogOperation {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub method: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub input_schema: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub output_schema: ::prost::alloc::string::String,
#[prost(message, optional, tag = "7")]
pub annotations: ::core::option::Option<OperationAnnotations>,
#[prost(message, repeated, tag = "8")]
pub parameters: ::prost::alloc::vec::Vec<CatalogParameter>,
#[prost(string, repeated, tag = "9")]
pub required_scopes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "10")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bool, tag = "11")]
pub read_only: bool,
#[prost(bool, optional, tag = "12")]
pub visible: ::core::option::Option<bool>,
#[prost(string, tag = "13")]
pub transport: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "14")]
pub allowed_roles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Catalog {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub icon_svg: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "5")]
pub operations: ::prost::alloc::vec::Vec<CatalogOperation>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ConnectionParamDef {
#[prost(bool, tag = "1")]
pub required: bool,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub default_value: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub from: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub field: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProviderMetadata {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(enumeration = "ConnectionMode", tag = "4")]
pub connection_mode: i32,
#[prost(string, repeated, tag = "5")]
pub auth_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(btree_map = "string, message", tag = "6")]
pub connection_params:
::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ConnectionParamDef>,
#[prost(message, optional, tag = "7")]
pub static_catalog: ::core::option::Option<Catalog>,
#[prost(bool, tag = "8")]
pub supports_session_catalog: bool,
#[prost(bool, tag = "9")]
pub supports_post_connect: bool,
#[prost(int32, tag = "11")]
pub min_protocol_version: i32,
#[prost(int32, tag = "12")]
pub max_protocol_version: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OperationResult {
#[prost(int32, tag = "1")]
pub status: i32,
#[prost(string, tag = "2")]
pub body: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct IntegrationToken {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub user_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub integration: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub instance: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub access_token: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub refresh_token: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub scopes: ::prost::alloc::string::String,
#[prost(message, optional, tag = "8")]
pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "9")]
pub last_refreshed_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(int32, tag = "10")]
pub refresh_error_count: i32,
#[prost(string, tag = "11")]
pub metadata_json: ::prost::alloc::string::String,
#[prost(message, optional, tag = "12")]
pub created_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "13")]
pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SubjectContext {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub kind: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub auth_source: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CredentialContext {
#[prost(string, tag = "1")]
pub mode: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub subject_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub connection: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub instance: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AccessContext {
#[prost(string, tag = "1")]
pub policy: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub role: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RequestContext {
#[prost(message, optional, tag = "1")]
pub subject: ::core::option::Option<SubjectContext>,
#[prost(message, optional, tag = "2")]
pub credential: ::core::option::Option<CredentialContext>,
#[prost(message, optional, tag = "3")]
pub access: ::core::option::Option<AccessContext>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecuteRequest {
#[prost(string, tag = "1")]
pub operation: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub params: ::core::option::Option<::prost_types::Struct>,
#[prost(string, tag = "3")]
pub token: ::prost::alloc::string::String,
#[prost(btree_map = "string, string", tag = "4")]
pub connection_params: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(string, tag = "5")]
pub invocation_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "6")]
pub context: ::core::option::Option<RequestContext>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSessionCatalogRequest {
#[prost(string, tag = "1")]
pub token: ::prost::alloc::string::String,
#[prost(btree_map = "string, string", tag = "2")]
pub connection_params: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(string, tag = "3")]
pub invocation_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "4")]
pub context: ::core::option::Option<RequestContext>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSessionCatalogResponse {
#[prost(message, optional, tag = "1")]
pub catalog: ::core::option::Option<Catalog>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PostConnectRequest {
#[prost(message, optional, tag = "1")]
pub token: ::core::option::Option<IntegrationToken>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PostConnectResponse {
#[prost(btree_map = "string, string", tag = "1")]
pub metadata: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StartProviderRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<::prost_types::Struct>,
#[prost(int32, tag = "4")]
pub protocol_version: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StartProviderResponse {
#[prost(int32, tag = "1")]
pub protocol_version: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ConnectionMode {
Unspecified = 0,
None = 1,
User = 2,
Identity = 3,
Either = 4,
}
impl ConnectionMode {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "CONNECTION_MODE_UNSPECIFIED",
Self::None => "CONNECTION_MODE_NONE",
Self::User => "CONNECTION_MODE_USER",
Self::Identity => "CONNECTION_MODE_IDENTITY",
Self::Either => "CONNECTION_MODE_EITHER",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CONNECTION_MODE_UNSPECIFIED" => Some(Self::Unspecified),
"CONNECTION_MODE_NONE" => Some(Self::None),
"CONNECTION_MODE_USER" => Some(Self::User),
"CONNECTION_MODE_IDENTITY" => Some(Self::Identity),
"CONNECTION_MODE_EITHER" => Some(Self::Either),
_ => None,
}
}
}
pub mod integration_provider_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct IntegrationProviderClient<T> {
inner: tonic::client::Grpc<T>,
}
impl IntegrationProviderClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> IntegrationProviderClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> IntegrationProviderClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
IntegrationProviderClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get_metadata(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::ProviderMetadata>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.IntegrationProvider/GetMetadata",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IntegrationProvider",
"GetMetadata",
));
self.inner.unary(req, path, codec).await
}
pub async fn start_provider(
&mut self,
request: impl tonic::IntoRequest<super::StartProviderRequest>,
) -> std::result::Result<tonic::Response<super::StartProviderResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.IntegrationProvider/StartProvider",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IntegrationProvider",
"StartProvider",
));
self.inner.unary(req, path, codec).await
}
pub async fn execute(
&mut self,
request: impl tonic::IntoRequest<super::ExecuteRequest>,
) -> std::result::Result<tonic::Response<super::OperationResult>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.IntegrationProvider/Execute",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IntegrationProvider",
"Execute",
));
self.inner.unary(req, path, codec).await
}
pub async fn get_session_catalog(
&mut self,
request: impl tonic::IntoRequest<super::GetSessionCatalogRequest>,
) -> std::result::Result<tonic::Response<super::GetSessionCatalogResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.IntegrationProvider/GetSessionCatalog",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IntegrationProvider",
"GetSessionCatalog",
));
self.inner.unary(req, path, codec).await
}
pub async fn post_connect(
&mut self,
request: impl tonic::IntoRequest<super::PostConnectRequest>,
) -> std::result::Result<tonic::Response<super::PostConnectResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.IntegrationProvider/PostConnect",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IntegrationProvider",
"PostConnect",
));
self.inner.unary(req, path, codec).await
}
}
}
pub mod integration_provider_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait IntegrationProvider: std::marker::Send + std::marker::Sync + 'static {
async fn get_metadata(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::ProviderMetadata>, tonic::Status>;
async fn start_provider(
&self,
request: tonic::Request<super::StartProviderRequest>,
) -> std::result::Result<tonic::Response<super::StartProviderResponse>, tonic::Status>;
async fn execute(
&self,
request: tonic::Request<super::ExecuteRequest>,
) -> std::result::Result<tonic::Response<super::OperationResult>, tonic::Status>;
async fn get_session_catalog(
&self,
request: tonic::Request<super::GetSessionCatalogRequest>,
) -> std::result::Result<tonic::Response<super::GetSessionCatalogResponse>, tonic::Status>;
async fn post_connect(
&self,
request: tonic::Request<super::PostConnectRequest>,
) -> std::result::Result<tonic::Response<super::PostConnectResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct IntegrationProviderServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> IntegrationProviderServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for IntegrationProviderServer<T>
where
T: IntegrationProvider,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/gestalt.provider.v1.IntegrationProvider/GetMetadata" => {
#[allow(non_camel_case_types)]
struct GetMetadataSvc<T: IntegrationProvider>(pub Arc<T>);
impl<T: IntegrationProvider> tonic::server::UnaryService<()> for GetMetadataSvc<T> {
type Response = super::ProviderMetadata;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IntegrationProvider>::get_metadata(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetMetadataSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IntegrationProvider/StartProvider" => {
#[allow(non_camel_case_types)]
struct StartProviderSvc<T: IntegrationProvider>(pub Arc<T>);
impl<T: IntegrationProvider>
tonic::server::UnaryService<super::StartProviderRequest>
for StartProviderSvc<T>
{
type Response = super::StartProviderResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::StartProviderRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IntegrationProvider>::start_provider(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = StartProviderSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IntegrationProvider/Execute" => {
#[allow(non_camel_case_types)]
struct ExecuteSvc<T: IntegrationProvider>(pub Arc<T>);
impl<T: IntegrationProvider> tonic::server::UnaryService<super::ExecuteRequest> for ExecuteSvc<T> {
type Response = super::OperationResult;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ExecuteRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IntegrationProvider>::execute(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ExecuteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IntegrationProvider/GetSessionCatalog" => {
#[allow(non_camel_case_types)]
struct GetSessionCatalogSvc<T: IntegrationProvider>(pub Arc<T>);
impl<T: IntegrationProvider>
tonic::server::UnaryService<super::GetSessionCatalogRequest>
for GetSessionCatalogSvc<T>
{
type Response = super::GetSessionCatalogResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetSessionCatalogRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IntegrationProvider>::get_session_catalog(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSessionCatalogSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IntegrationProvider/PostConnect" => {
#[allow(non_camel_case_types)]
struct PostConnectSvc<T: IntegrationProvider>(pub Arc<T>);
impl<T: IntegrationProvider>
tonic::server::UnaryService<super::PostConnectRequest>
for PostConnectSvc<T>
{
type Response = super::PostConnectResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::PostConnectRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IntegrationProvider>::post_connect(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = PostConnectSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
let mut response = http::Response::new(tonic::body::Body::default());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> Clone for IntegrationProviderServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "gestalt.provider.v1.IntegrationProvider";
impl<T> tonic::server::NamedService for IntegrationProviderServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ProviderIdentity {
#[prost(enumeration = "ProviderKind", tag = "1")]
pub kind: i32,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub version: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "6")]
pub warnings: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(int32, tag = "10")]
pub min_protocol_version: i32,
#[prost(int32, tag = "11")]
pub max_protocol_version: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConfigureProviderRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<::prost_types::Struct>,
#[prost(int32, tag = "3")]
pub protocol_version: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ConfigureProviderResponse {
#[prost(int32, tag = "1")]
pub protocol_version: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HealthCheckResponse {
#[prost(bool, tag = "1")]
pub ready: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ProviderKind {
Unspecified = 0,
Integration = 1,
Auth = 2,
Indexeddb = 3,
Secrets = 4,
Telemetry = 5,
Cache = 6,
S3 = 7,
}
impl ProviderKind {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "PROVIDER_KIND_UNSPECIFIED",
Self::Integration => "PROVIDER_KIND_INTEGRATION",
Self::Auth => "PROVIDER_KIND_AUTH",
Self::Indexeddb => "PROVIDER_KIND_INDEXEDDB",
Self::Secrets => "PROVIDER_KIND_SECRETS",
Self::Telemetry => "PROVIDER_KIND_TELEMETRY",
Self::Cache => "PROVIDER_KIND_CACHE",
Self::S3 => "PROVIDER_KIND_S3",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PROVIDER_KIND_UNSPECIFIED" => Some(Self::Unspecified),
"PROVIDER_KIND_INTEGRATION" => Some(Self::Integration),
"PROVIDER_KIND_AUTH" => Some(Self::Auth),
"PROVIDER_KIND_INDEXEDDB" => Some(Self::Indexeddb),
"PROVIDER_KIND_SECRETS" => Some(Self::Secrets),
"PROVIDER_KIND_TELEMETRY" => Some(Self::Telemetry),
"PROVIDER_KIND_CACHE" => Some(Self::Cache),
"PROVIDER_KIND_S3" => Some(Self::S3),
_ => None,
}
}
}
pub mod provider_lifecycle_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct ProviderLifecycleClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ProviderLifecycleClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ProviderLifecycleClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ProviderLifecycleClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
ProviderLifecycleClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get_provider_identity(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::ProviderIdentity>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.ProviderLifecycle/GetProviderIdentity",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.ProviderLifecycle",
"GetProviderIdentity",
));
self.inner.unary(req, path, codec).await
}
pub async fn configure_provider(
&mut self,
request: impl tonic::IntoRequest<super::ConfigureProviderRequest>,
) -> std::result::Result<tonic::Response<super::ConfigureProviderResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.ProviderLifecycle/ConfigureProvider",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.ProviderLifecycle",
"ConfigureProvider",
));
self.inner.unary(req, path, codec).await
}
pub async fn health_check(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::HealthCheckResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.ProviderLifecycle/HealthCheck",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.ProviderLifecycle",
"HealthCheck",
));
self.inner.unary(req, path, codec).await
}
}
}
pub mod provider_lifecycle_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait ProviderLifecycle: std::marker::Send + std::marker::Sync + 'static {
async fn get_provider_identity(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::ProviderIdentity>, tonic::Status>;
async fn configure_provider(
&self,
request: tonic::Request<super::ConfigureProviderRequest>,
) -> std::result::Result<tonic::Response<super::ConfigureProviderResponse>, tonic::Status>;
async fn health_check(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::HealthCheckResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct ProviderLifecycleServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> ProviderLifecycleServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for ProviderLifecycleServer<T>
where
T: ProviderLifecycle,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/gestalt.provider.v1.ProviderLifecycle/GetProviderIdentity" => {
#[allow(non_camel_case_types)]
struct GetProviderIdentitySvc<T: ProviderLifecycle>(pub Arc<T>);
impl<T: ProviderLifecycle> tonic::server::UnaryService<()> for GetProviderIdentitySvc<T> {
type Response = super::ProviderIdentity;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProviderLifecycle>::get_provider_identity(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetProviderIdentitySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.ProviderLifecycle/ConfigureProvider" => {
#[allow(non_camel_case_types)]
struct ConfigureProviderSvc<T: ProviderLifecycle>(pub Arc<T>);
impl<T: ProviderLifecycle>
tonic::server::UnaryService<super::ConfigureProviderRequest>
for ConfigureProviderSvc<T>
{
type Response = super::ConfigureProviderResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ConfigureProviderRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProviderLifecycle>::configure_provider(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ConfigureProviderSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.ProviderLifecycle/HealthCheck" => {
#[allow(non_camel_case_types)]
struct HealthCheckSvc<T: ProviderLifecycle>(pub Arc<T>);
impl<T: ProviderLifecycle> tonic::server::UnaryService<()> for HealthCheckSvc<T> {
type Response = super::HealthCheckResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProviderLifecycle>::health_check(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = HealthCheckSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
let mut response = http::Response::new(tonic::body::Body::default());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> Clone for ProviderLifecycleServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "gestalt.provider.v1.ProviderLifecycle";
impl<T> tonic::server::NamedService for ProviderLifecycleServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthenticatedUser {
#[prost(string, tag = "1")]
pub subject: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub email: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub email_verified: bool,
#[prost(string, tag = "4")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub avatar_url: ::prost::alloc::string::String,
#[prost(btree_map = "string, string", tag = "6")]
pub claims: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BeginLoginRequest {
#[prost(string, tag = "1")]
pub callback_url: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub host_state: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub scopes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(btree_map = "string, string", tag = "4")]
pub options: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BeginLoginResponse {
#[prost(string, tag = "1")]
pub authorization_url: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub provider_state: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompleteLoginRequest {
#[prost(btree_map = "string, string", tag = "1")]
pub query: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(bytes = "vec", tag = "2")]
pub provider_state: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "3")]
pub callback_url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ValidateExternalTokenRequest {
#[prost(string, tag = "1")]
pub token: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthSessionSettings {
#[prost(int64, tag = "1")]
pub session_ttl_seconds: i64,
}
pub mod auth_provider_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct AuthProviderClient<T> {
inner: tonic::client::Grpc<T>,
}
impl AuthProviderClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> AuthProviderClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> AuthProviderClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
AuthProviderClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn begin_login(
&mut self,
request: impl tonic::IntoRequest<super::BeginLoginRequest>,
) -> std::result::Result<tonic::Response<super::BeginLoginResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.AuthProvider/BeginLogin",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.AuthProvider",
"BeginLogin",
));
self.inner.unary(req, path, codec).await
}
pub async fn complete_login(
&mut self,
request: impl tonic::IntoRequest<super::CompleteLoginRequest>,
) -> std::result::Result<tonic::Response<super::AuthenticatedUser>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.AuthProvider/CompleteLogin",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.AuthProvider",
"CompleteLogin",
));
self.inner.unary(req, path, codec).await
}
pub async fn validate_external_token(
&mut self,
request: impl tonic::IntoRequest<super::ValidateExternalTokenRequest>,
) -> std::result::Result<tonic::Response<super::AuthenticatedUser>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.AuthProvider/ValidateExternalToken",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.AuthProvider",
"ValidateExternalToken",
));
self.inner.unary(req, path, codec).await
}
pub async fn get_session_settings(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::AuthSessionSettings>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.AuthProvider/GetSessionSettings",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.AuthProvider",
"GetSessionSettings",
));
self.inner.unary(req, path, codec).await
}
}
}
pub mod auth_provider_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait AuthProvider: std::marker::Send + std::marker::Sync + 'static {
async fn begin_login(
&self,
request: tonic::Request<super::BeginLoginRequest>,
) -> std::result::Result<tonic::Response<super::BeginLoginResponse>, tonic::Status>;
async fn complete_login(
&self,
request: tonic::Request<super::CompleteLoginRequest>,
) -> std::result::Result<tonic::Response<super::AuthenticatedUser>, tonic::Status>;
async fn validate_external_token(
&self,
request: tonic::Request<super::ValidateExternalTokenRequest>,
) -> std::result::Result<tonic::Response<super::AuthenticatedUser>, tonic::Status>;
async fn get_session_settings(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::AuthSessionSettings>, tonic::Status>;
}
#[derive(Debug)]
pub struct AuthProviderServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> AuthProviderServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for AuthProviderServer<T>
where
T: AuthProvider,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/gestalt.provider.v1.AuthProvider/BeginLogin" => {
#[allow(non_camel_case_types)]
struct BeginLoginSvc<T: AuthProvider>(pub Arc<T>);
impl<T: AuthProvider> tonic::server::UnaryService<super::BeginLoginRequest> for BeginLoginSvc<T> {
type Response = super::BeginLoginResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::BeginLoginRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthProvider>::begin_login(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = BeginLoginSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.AuthProvider/CompleteLogin" => {
#[allow(non_camel_case_types)]
struct CompleteLoginSvc<T: AuthProvider>(pub Arc<T>);
impl<T: AuthProvider> tonic::server::UnaryService<super::CompleteLoginRequest>
for CompleteLoginSvc<T>
{
type Response = super::AuthenticatedUser;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CompleteLoginRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthProvider>::complete_login(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CompleteLoginSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.AuthProvider/ValidateExternalToken" => {
#[allow(non_camel_case_types)]
struct ValidateExternalTokenSvc<T: AuthProvider>(pub Arc<T>);
impl<T: AuthProvider>
tonic::server::UnaryService<super::ValidateExternalTokenRequest>
for ValidateExternalTokenSvc<T>
{
type Response = super::AuthenticatedUser;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ValidateExternalTokenRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthProvider>::validate_external_token(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ValidateExternalTokenSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.AuthProvider/GetSessionSettings" => {
#[allow(non_camel_case_types)]
struct GetSessionSettingsSvc<T: AuthProvider>(pub Arc<T>);
impl<T: AuthProvider> tonic::server::UnaryService<()> for GetSessionSettingsSvc<T> {
type Response = super::AuthSessionSettings;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthProvider>::get_session_settings(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSessionSettingsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
let mut response = http::Response::new(tonic::body::Body::default());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> Clone for AuthProviderServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "gestalt.provider.v1.AuthProvider";
impl<T> tonic::server::NamedService for AuthProviderServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheSetEntry {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheResult {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub found: bool,
#[prost(bytes = "vec", tag = "3")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheGetRequest {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheGetResponse {
#[prost(bool, tag = "1")]
pub found: bool,
#[prost(bytes = "vec", tag = "2")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheGetManyRequest {
#[prost(string, repeated, tag = "1")]
pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CacheGetManyResponse {
#[prost(message, repeated, tag = "1")]
pub entries: ::prost::alloc::vec::Vec<CacheResult>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheSetRequest {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub value: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag = "3")]
pub ttl: ::core::option::Option<::prost_types::Duration>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CacheSetManyRequest {
#[prost(message, repeated, tag = "1")]
pub entries: ::prost::alloc::vec::Vec<CacheSetEntry>,
#[prost(message, optional, tag = "2")]
pub ttl: ::core::option::Option<::prost_types::Duration>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheDeleteRequest {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheDeleteResponse {
#[prost(bool, tag = "1")]
pub deleted: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheDeleteManyRequest {
#[prost(string, repeated, tag = "1")]
pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheDeleteManyResponse {
#[prost(int64, tag = "1")]
pub deleted: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheTouchRequest {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub ttl: ::core::option::Option<::prost_types::Duration>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CacheTouchResponse {
#[prost(bool, tag = "1")]
pub touched: bool,
}
pub mod cache_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct CacheClient<T> {
inner: tonic::client::Grpc<T>,
}
impl CacheClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> CacheClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> CacheClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
CacheClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::CacheGetRequest>,
) -> std::result::Result<tonic::Response<super::CacheGetResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/Get");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.Cache", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn get_many(
&mut self,
request: impl tonic::IntoRequest<super::CacheGetManyRequest>,
) -> std::result::Result<tonic::Response<super::CacheGetManyResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/GetMany");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.Cache", "GetMany"));
self.inner.unary(req, path, codec).await
}
pub async fn set(
&mut self,
request: impl tonic::IntoRequest<super::CacheSetRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/Set");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.Cache", "Set"));
self.inner.unary(req, path, codec).await
}
pub async fn set_many(
&mut self,
request: impl tonic::IntoRequest<super::CacheSetManyRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/SetMany");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.Cache", "SetMany"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::CacheDeleteRequest>,
) -> std::result::Result<tonic::Response<super::CacheDeleteResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/Delete");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.Cache", "Delete"));
self.inner.unary(req, path, codec).await
}
pub async fn delete_many(
&mut self,
request: impl tonic::IntoRequest<super::CacheDeleteManyRequest>,
) -> std::result::Result<tonic::Response<super::CacheDeleteManyResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/DeleteMany");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.Cache", "DeleteMany"));
self.inner.unary(req, path, codec).await
}
pub async fn touch(
&mut self,
request: impl tonic::IntoRequest<super::CacheTouchRequest>,
) -> std::result::Result<tonic::Response<super::CacheTouchResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.Cache/Touch");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.Cache", "Touch"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod cache_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait Cache: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::CacheGetRequest>,
) -> std::result::Result<tonic::Response<super::CacheGetResponse>, tonic::Status>;
async fn get_many(
&self,
request: tonic::Request<super::CacheGetManyRequest>,
) -> std::result::Result<tonic::Response<super::CacheGetManyResponse>, tonic::Status>;
async fn set(
&self,
request: tonic::Request<super::CacheSetRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn set_many(
&self,
request: tonic::Request<super::CacheSetManyRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::CacheDeleteRequest>,
) -> std::result::Result<tonic::Response<super::CacheDeleteResponse>, tonic::Status>;
async fn delete_many(
&self,
request: tonic::Request<super::CacheDeleteManyRequest>,
) -> std::result::Result<tonic::Response<super::CacheDeleteManyResponse>, tonic::Status>;
async fn touch(
&self,
request: tonic::Request<super::CacheTouchRequest>,
) -> std::result::Result<tonic::Response<super::CacheTouchResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct CacheServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> CacheServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for CacheServer<T>
where
T: Cache,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/gestalt.provider.v1.Cache/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: Cache>(pub Arc<T>);
impl<T: Cache> tonic::server::UnaryService<super::CacheGetRequest> for GetSvc<T> {
type Response = super::CacheGetResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CacheGetRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as Cache>::get(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.Cache/GetMany" => {
#[allow(non_camel_case_types)]
struct GetManySvc<T: Cache>(pub Arc<T>);
impl<T: Cache> tonic::server::UnaryService<super::CacheGetManyRequest> for GetManySvc<T> {
type Response = super::CacheGetManyResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CacheGetManyRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as Cache>::get_many(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetManySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.Cache/Set" => {
#[allow(non_camel_case_types)]
struct SetSvc<T: Cache>(pub Arc<T>);
impl<T: Cache> tonic::server::UnaryService<super::CacheSetRequest> for SetSvc<T> {
type Response = ();
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CacheSetRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as Cache>::set(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.Cache/SetMany" => {
#[allow(non_camel_case_types)]
struct SetManySvc<T: Cache>(pub Arc<T>);
impl<T: Cache> tonic::server::UnaryService<super::CacheSetManyRequest> for SetManySvc<T> {
type Response = ();
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CacheSetManyRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as Cache>::set_many(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SetManySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.Cache/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: Cache>(pub Arc<T>);
impl<T: Cache> tonic::server::UnaryService<super::CacheDeleteRequest> for DeleteSvc<T> {
type Response = super::CacheDeleteResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CacheDeleteRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as Cache>::delete(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.Cache/DeleteMany" => {
#[allow(non_camel_case_types)]
struct DeleteManySvc<T: Cache>(pub Arc<T>);
impl<T: Cache> tonic::server::UnaryService<super::CacheDeleteManyRequest> for DeleteManySvc<T> {
type Response = super::CacheDeleteManyResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CacheDeleteManyRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as Cache>::delete_many(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteManySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.Cache/Touch" => {
#[allow(non_camel_case_types)]
struct TouchSvc<T: Cache>(pub Arc<T>);
impl<T: Cache> tonic::server::UnaryService<super::CacheTouchRequest> for TouchSvc<T> {
type Response = super::CacheTouchResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CacheTouchRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as Cache>::touch(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = TouchSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
let mut response = http::Response::new(tonic::body::Body::default());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> Clone for CacheServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "gestalt.provider.v1.Cache";
impl<T> tonic::server::NamedService for CacheServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetSecretRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetSecretResponse {
#[prost(string, tag = "1")]
pub value: ::prost::alloc::string::String,
}
pub mod secrets_provider_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct SecretsProviderClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SecretsProviderClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SecretsProviderClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SecretsProviderClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
SecretsProviderClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get_secret(
&mut self,
request: impl tonic::IntoRequest<super::GetSecretRequest>,
) -> std::result::Result<tonic::Response<super::GetSecretResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.SecretsProvider/GetSecret",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.SecretsProvider",
"GetSecret",
));
self.inner.unary(req, path, codec).await
}
}
}
pub mod secrets_provider_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait SecretsProvider: std::marker::Send + std::marker::Sync + 'static {
async fn get_secret(
&self,
request: tonic::Request<super::GetSecretRequest>,
) -> std::result::Result<tonic::Response<super::GetSecretResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct SecretsProviderServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> SecretsProviderServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for SecretsProviderServer<T>
where
T: SecretsProvider,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/gestalt.provider.v1.SecretsProvider/GetSecret" => {
#[allow(non_camel_case_types)]
struct GetSecretSvc<T: SecretsProvider>(pub Arc<T>);
impl<T: SecretsProvider> tonic::server::UnaryService<super::GetSecretRequest> for GetSecretSvc<T> {
type Response = super::GetSecretResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetSecretRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SecretsProvider>::get_secret(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSecretSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
let mut response = http::Response::new(tonic::body::Body::default());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> Clone for SecretsProviderServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "gestalt.provider.v1.SecretsProvider";
impl<T> tonic::server::NamedService for SecretsProviderServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TypedValue {
#[prost(oneof = "typed_value::Kind", tags = "1, 2, 3, 4, 5, 6, 7, 8")]
pub kind: ::core::option::Option<typed_value::Kind>,
}
pub mod typed_value {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Kind {
#[prost(enumeration = "::prost_types::NullValue", tag = "1")]
NullValue(i32),
#[prost(string, tag = "2")]
StringValue(::prost::alloc::string::String),
#[prost(int64, tag = "3")]
IntValue(i64),
#[prost(double, tag = "4")]
FloatValue(f64),
#[prost(bool, tag = "5")]
BoolValue(bool),
#[prost(message, tag = "6")]
TimeValue(::prost_types::Timestamp),
#[prost(bytes, tag = "7")]
BytesValue(::prost::alloc::vec::Vec<u8>),
#[prost(message, tag = "8")]
JsonValue(::prost_types::Value),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Record {
#[prost(btree_map = "string, message", tag = "1")]
pub fields: ::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, TypedValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ObjectStoreSchema {
#[prost(message, repeated, tag = "1")]
pub indexes: ::prost::alloc::vec::Vec<IndexSchema>,
#[prost(message, repeated, tag = "2")]
pub columns: ::prost::alloc::vec::Vec<ColumnDef>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct IndexSchema {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub key_path: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bool, tag = "3")]
pub unique: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ColumnDef {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub r#type: i32,
#[prost(bool, tag = "3")]
pub primary_key: bool,
#[prost(bool, tag = "4")]
pub not_null: bool,
#[prost(bool, tag = "5")]
pub unique: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyRange {
#[prost(message, optional, tag = "1")]
pub lower: ::core::option::Option<TypedValue>,
#[prost(message, optional, tag = "2")]
pub upper: ::core::option::Option<TypedValue>,
#[prost(bool, tag = "3")]
pub lower_open: bool,
#[prost(bool, tag = "4")]
pub upper_open: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecordRequest {
#[prost(string, tag = "1")]
pub store: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub record: ::core::option::Option<Record>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecordResponse {
#[prost(message, optional, tag = "1")]
pub record: ::core::option::Option<Record>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecordsResponse {
#[prost(message, repeated, tag = "1")]
pub records: ::prost::alloc::vec::Vec<Record>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct KeysResponse {
#[prost(string, repeated, tag = "1")]
pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ObjectStoreRequest {
#[prost(string, tag = "1")]
pub store: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ObjectStoreNameRequest {
#[prost(string, tag = "1")]
pub store: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ObjectStoreRangeRequest {
#[prost(string, tag = "1")]
pub store: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub range: ::core::option::Option<KeyRange>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateObjectStoreRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub schema: ::core::option::Option<ObjectStoreSchema>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteObjectStoreRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IndexQueryRequest {
#[prost(string, tag = "1")]
pub store: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub index: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub values: ::prost::alloc::vec::Vec<TypedValue>,
#[prost(message, optional, tag = "4")]
pub range: ::core::option::Option<KeyRange>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CountResponse {
#[prost(int64, tag = "1")]
pub count: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenCursorRequest {
#[prost(string, tag = "1")]
pub store: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub range: ::core::option::Option<KeyRange>,
#[prost(enumeration = "CursorDirection", tag = "3")]
pub direction: i32,
#[prost(bool, tag = "4")]
pub keys_only: bool,
#[prost(string, tag = "5")]
pub index: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "6")]
pub values: ::prost::alloc::vec::Vec<TypedValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyValue {
#[prost(oneof = "key_value::Kind", tags = "1, 2")]
pub kind: ::core::option::Option<key_value::Kind>,
}
pub mod key_value {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Kind {
#[prost(message, tag = "1")]
Scalar(super::TypedValue),
#[prost(message, tag = "2")]
Array(super::KeyValueArray),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyValueArray {
#[prost(message, repeated, tag = "1")]
pub elements: ::prost::alloc::vec::Vec<KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CursorKeyTarget {
#[prost(message, repeated, tag = "1")]
pub key: ::prost::alloc::vec::Vec<KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CursorCommand {
#[prost(oneof = "cursor_command::Command", tags = "1, 2, 3, 4, 5, 6")]
pub command: ::core::option::Option<cursor_command::Command>,
}
pub mod cursor_command {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Command {
#[prost(bool, tag = "1")]
Next(bool),
#[prost(message, tag = "2")]
ContinueToKey(super::CursorKeyTarget),
#[prost(int32, tag = "3")]
Advance(i32),
#[prost(message, tag = "4")]
Update(super::Record),
#[prost(bool, tag = "5")]
Delete(bool),
#[prost(bool, tag = "6")]
Close(bool),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CursorClientMessage {
#[prost(oneof = "cursor_client_message::Msg", tags = "1, 2")]
pub msg: ::core::option::Option<cursor_client_message::Msg>,
}
pub mod cursor_client_message {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Msg {
#[prost(message, tag = "1")]
Open(super::OpenCursorRequest),
#[prost(message, tag = "2")]
Command(super::CursorCommand),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CursorEntry {
#[prost(message, repeated, tag = "1")]
pub key: ::prost::alloc::vec::Vec<KeyValue>,
#[prost(string, tag = "2")]
pub primary_key: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub record: ::core::option::Option<Record>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CursorResponse {
#[prost(oneof = "cursor_response::Result", tags = "1, 2")]
pub result: ::core::option::Option<cursor_response::Result>,
}
pub mod cursor_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Result {
#[prost(message, tag = "1")]
Entry(super::CursorEntry),
#[prost(bool, tag = "2")]
Done(bool),
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteResponse {
#[prost(int64, tag = "1")]
pub deleted: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct KeyResponse {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CursorDirection {
CursorNext = 0,
CursorNextUnique = 1,
CursorPrev = 2,
CursorPrevUnique = 3,
}
impl CursorDirection {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::CursorNext => "CURSOR_NEXT",
Self::CursorNextUnique => "CURSOR_NEXT_UNIQUE",
Self::CursorPrev => "CURSOR_PREV",
Self::CursorPrevUnique => "CURSOR_PREV_UNIQUE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CURSOR_NEXT" => Some(Self::CursorNext),
"CURSOR_NEXT_UNIQUE" => Some(Self::CursorNextUnique),
"CURSOR_PREV" => Some(Self::CursorPrev),
"CURSOR_PREV_UNIQUE" => Some(Self::CursorPrevUnique),
_ => None,
}
}
}
pub mod indexed_db_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct IndexedDbClient<T> {
inner: tonic::client::Grpc<T>,
}
impl IndexedDbClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> IndexedDbClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> IndexedDbClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
IndexedDbClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn create_object_store(
&mut self,
request: impl tonic::IntoRequest<super::CreateObjectStoreRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.IndexedDB/CreateObjectStore",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"CreateObjectStore",
));
self.inner.unary(req, path, codec).await
}
pub async fn delete_object_store(
&mut self,
request: impl tonic::IntoRequest<super::DeleteObjectStoreRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.IndexedDB/DeleteObjectStore",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"DeleteObjectStore",
));
self.inner.unary(req, path, codec).await
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::ObjectStoreRequest>,
) -> std::result::Result<tonic::Response<super::RecordResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Get");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn get_key(
&mut self,
request: impl tonic::IntoRequest<super::ObjectStoreRequest>,
) -> std::result::Result<tonic::Response<super::KeyResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/GetKey");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "GetKey"));
self.inner.unary(req, path, codec).await
}
pub async fn add(
&mut self,
request: impl tonic::IntoRequest<super::RecordRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Add");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Add"));
self.inner.unary(req, path, codec).await
}
pub async fn put(
&mut self,
request: impl tonic::IntoRequest<super::RecordRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Put");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Put"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::ObjectStoreRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Delete");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Delete"));
self.inner.unary(req, path, codec).await
}
pub async fn clear(
&mut self,
request: impl tonic::IntoRequest<super::ObjectStoreNameRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Clear");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Clear"));
self.inner.unary(req, path, codec).await
}
pub async fn get_all(
&mut self,
request: impl tonic::IntoRequest<super::ObjectStoreRangeRequest>,
) -> std::result::Result<tonic::Response<super::RecordsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/GetAll");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "GetAll"));
self.inner.unary(req, path, codec).await
}
pub async fn get_all_keys(
&mut self,
request: impl tonic::IntoRequest<super::ObjectStoreRangeRequest>,
) -> std::result::Result<tonic::Response<super::KeysResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/GetAllKeys");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"GetAllKeys",
));
self.inner.unary(req, path, codec).await
}
pub async fn count(
&mut self,
request: impl tonic::IntoRequest<super::ObjectStoreRangeRequest>,
) -> std::result::Result<tonic::Response<super::CountResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/Count");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "Count"));
self.inner.unary(req, path, codec).await
}
pub async fn delete_range(
&mut self,
request: impl tonic::IntoRequest<super::ObjectStoreRangeRequest>,
) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/DeleteRange");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"DeleteRange",
));
self.inner.unary(req, path, codec).await
}
pub async fn index_get(
&mut self,
request: impl tonic::IntoRequest<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::RecordResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexGet");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.IndexedDB", "IndexGet"));
self.inner.unary(req, path, codec).await
}
pub async fn index_get_key(
&mut self,
request: impl tonic::IntoRequest<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::KeyResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexGetKey");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"IndexGetKey",
));
self.inner.unary(req, path, codec).await
}
pub async fn index_get_all(
&mut self,
request: impl tonic::IntoRequest<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::RecordsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexGetAll");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"IndexGetAll",
));
self.inner.unary(req, path, codec).await
}
pub async fn index_get_all_keys(
&mut self,
request: impl tonic::IntoRequest<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::KeysResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/gestalt.provider.v1.IndexedDB/IndexGetAllKeys",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"IndexGetAllKeys",
));
self.inner.unary(req, path, codec).await
}
pub async fn index_count(
&mut self,
request: impl tonic::IntoRequest<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::CountResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexCount");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"IndexCount",
));
self.inner.unary(req, path, codec).await
}
pub async fn index_delete(
&mut self,
request: impl tonic::IntoRequest<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/IndexDelete");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"IndexDelete",
));
self.inner.unary(req, path, codec).await
}
pub async fn open_cursor(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::CursorClientMessage>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::CursorResponse>>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.IndexedDB/OpenCursor");
let mut req = request.into_streaming_request();
req.extensions_mut().insert(GrpcMethod::new(
"gestalt.provider.v1.IndexedDB",
"OpenCursor",
));
self.inner.streaming(req, path, codec).await
}
}
}
pub mod indexed_db_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait IndexedDb: std::marker::Send + std::marker::Sync + 'static {
async fn create_object_store(
&self,
request: tonic::Request<super::CreateObjectStoreRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn delete_object_store(
&self,
request: tonic::Request<super::DeleteObjectStoreRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn get(
&self,
request: tonic::Request<super::ObjectStoreRequest>,
) -> std::result::Result<tonic::Response<super::RecordResponse>, tonic::Status>;
async fn get_key(
&self,
request: tonic::Request<super::ObjectStoreRequest>,
) -> std::result::Result<tonic::Response<super::KeyResponse>, tonic::Status>;
async fn add(
&self,
request: tonic::Request<super::RecordRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn put(
&self,
request: tonic::Request<super::RecordRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::ObjectStoreRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn clear(
&self,
request: tonic::Request<super::ObjectStoreNameRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn get_all(
&self,
request: tonic::Request<super::ObjectStoreRangeRequest>,
) -> std::result::Result<tonic::Response<super::RecordsResponse>, tonic::Status>;
async fn get_all_keys(
&self,
request: tonic::Request<super::ObjectStoreRangeRequest>,
) -> std::result::Result<tonic::Response<super::KeysResponse>, tonic::Status>;
async fn count(
&self,
request: tonic::Request<super::ObjectStoreRangeRequest>,
) -> std::result::Result<tonic::Response<super::CountResponse>, tonic::Status>;
async fn delete_range(
&self,
request: tonic::Request<super::ObjectStoreRangeRequest>,
) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status>;
async fn index_get(
&self,
request: tonic::Request<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::RecordResponse>, tonic::Status>;
async fn index_get_key(
&self,
request: tonic::Request<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::KeyResponse>, tonic::Status>;
async fn index_get_all(
&self,
request: tonic::Request<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::RecordsResponse>, tonic::Status>;
async fn index_get_all_keys(
&self,
request: tonic::Request<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::KeysResponse>, tonic::Status>;
async fn index_count(
&self,
request: tonic::Request<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::CountResponse>, tonic::Status>;
async fn index_delete(
&self,
request: tonic::Request<super::IndexQueryRequest>,
) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status>;
type OpenCursorStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::CursorResponse, tonic::Status>,
> + std::marker::Send
+ 'static;
async fn open_cursor(
&self,
request: tonic::Request<tonic::Streaming<super::CursorClientMessage>>,
) -> std::result::Result<tonic::Response<Self::OpenCursorStream>, tonic::Status>;
}
#[derive(Debug)]
pub struct IndexedDbServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> IndexedDbServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for IndexedDbServer<T>
where
T: IndexedDb,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/gestalt.provider.v1.IndexedDB/CreateObjectStore" => {
#[allow(non_camel_case_types)]
struct CreateObjectStoreSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::CreateObjectStoreRequest>
for CreateObjectStoreSvc<T>
{
type Response = ();
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CreateObjectStoreRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IndexedDb>::create_object_store(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateObjectStoreSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/DeleteObjectStore" => {
#[allow(non_camel_case_types)]
struct DeleteObjectStoreSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::DeleteObjectStoreRequest>
for DeleteObjectStoreSvc<T>
{
type Response = ();
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::DeleteObjectStoreRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IndexedDb>::delete_object_store(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteObjectStoreSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRequest> for GetSvc<T> {
type Response = super::RecordResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ObjectStoreRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as IndexedDb>::get(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/GetKey" => {
#[allow(non_camel_case_types)]
struct GetKeySvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRequest> for GetKeySvc<T> {
type Response = super::KeyResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ObjectStoreRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as IndexedDb>::get_key(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetKeySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/Add" => {
#[allow(non_camel_case_types)]
struct AddSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::RecordRequest> for AddSvc<T> {
type Response = ();
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::RecordRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as IndexedDb>::add(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = AddSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/Put" => {
#[allow(non_camel_case_types)]
struct PutSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::RecordRequest> for PutSvc<T> {
type Response = ();
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::RecordRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as IndexedDb>::put(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = PutSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRequest> for DeleteSvc<T> {
type Response = ();
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ObjectStoreRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as IndexedDb>::delete(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/Clear" => {
#[allow(non_camel_case_types)]
struct ClearSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreNameRequest> for ClearSvc<T> {
type Response = ();
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ObjectStoreNameRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as IndexedDb>::clear(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ClearSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/GetAll" => {
#[allow(non_camel_case_types)]
struct GetAllSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRangeRequest> for GetAllSvc<T> {
type Response = super::RecordsResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ObjectStoreRangeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as IndexedDb>::get_all(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetAllSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/GetAllKeys" => {
#[allow(non_camel_case_types)]
struct GetAllKeysSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRangeRequest>
for GetAllKeysSvc<T>
{
type Response = super::KeysResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ObjectStoreRangeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IndexedDb>::get_all_keys(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetAllKeysSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/Count" => {
#[allow(non_camel_case_types)]
struct CountSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRangeRequest> for CountSvc<T> {
type Response = super::CountResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ObjectStoreRangeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as IndexedDb>::count(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CountSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/DeleteRange" => {
#[allow(non_camel_case_types)]
struct DeleteRangeSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::ObjectStoreRangeRequest>
for DeleteRangeSvc<T>
{
type Response = super::DeleteResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ObjectStoreRangeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IndexedDb>::delete_range(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteRangeSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/IndexGet" => {
#[allow(non_camel_case_types)]
struct IndexGetSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexGetSvc<T> {
type Response = super::RecordResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::IndexQueryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as IndexedDb>::index_get(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = IndexGetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/IndexGetKey" => {
#[allow(non_camel_case_types)]
struct IndexGetKeySvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexGetKeySvc<T> {
type Response = super::KeyResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::IndexQueryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IndexedDb>::index_get_key(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = IndexGetKeySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/IndexGetAll" => {
#[allow(non_camel_case_types)]
struct IndexGetAllSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexGetAllSvc<T> {
type Response = super::RecordsResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::IndexQueryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IndexedDb>::index_get_all(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = IndexGetAllSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/IndexGetAllKeys" => {
#[allow(non_camel_case_types)]
struct IndexGetAllKeysSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexGetAllKeysSvc<T> {
type Response = super::KeysResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::IndexQueryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IndexedDb>::index_get_all_keys(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = IndexGetAllKeysSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/IndexCount" => {
#[allow(non_camel_case_types)]
struct IndexCountSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexCountSvc<T> {
type Response = super::CountResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::IndexQueryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as IndexedDb>::index_count(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = IndexCountSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/IndexDelete" => {
#[allow(non_camel_case_types)]
struct IndexDeleteSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::UnaryService<super::IndexQueryRequest> for IndexDeleteSvc<T> {
type Response = super::DeleteResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::IndexQueryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as IndexedDb>::index_delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = IndexDeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.IndexedDB/OpenCursor" => {
#[allow(non_camel_case_types)]
struct OpenCursorSvc<T: IndexedDb>(pub Arc<T>);
impl<T: IndexedDb> tonic::server::StreamingService<super::CursorClientMessage>
for OpenCursorSvc<T>
{
type Response = super::CursorResponse;
type ResponseStream = T::OpenCursorStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<tonic::Streaming<super::CursorClientMessage>>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as IndexedDb>::open_cursor(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = OpenCursorSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
let mut response = http::Response::new(tonic::body::Body::default());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> Clone for IndexedDbServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "gestalt.provider.v1.IndexedDB";
impl<T> tonic::server::NamedService for IndexedDbServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct S3ObjectRef {
#[prost(string, tag = "1")]
pub bucket: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub key: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub version_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct S3ObjectMeta {
#[prost(message, optional, tag = "1")]
pub r#ref: ::core::option::Option<S3ObjectRef>,
#[prost(string, tag = "2")]
pub etag: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub size: i64,
#[prost(string, tag = "4")]
pub content_type: ::prost::alloc::string::String,
#[prost(message, optional, tag = "5")]
pub last_modified: ::core::option::Option<::prost_types::Timestamp>,
#[prost(btree_map = "string, string", tag = "6")]
pub metadata: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(string, tag = "7")]
pub storage_class: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ByteRange {
#[prost(int64, optional, tag = "1")]
pub start: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "2")]
pub end: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HeadObjectRequest {
#[prost(message, optional, tag = "1")]
pub r#ref: ::core::option::Option<S3ObjectRef>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HeadObjectResponse {
#[prost(message, optional, tag = "1")]
pub meta: ::core::option::Option<S3ObjectMeta>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReadObjectRequest {
#[prost(message, optional, tag = "1")]
pub r#ref: ::core::option::Option<S3ObjectRef>,
#[prost(message, optional, tag = "2")]
pub range: ::core::option::Option<ByteRange>,
#[prost(string, tag = "3")]
pub if_match: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub if_none_match: ::prost::alloc::string::String,
#[prost(message, optional, tag = "5")]
pub if_modified_since: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "6")]
pub if_unmodified_since: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadObjectChunk {
#[prost(oneof = "read_object_chunk::Result", tags = "1, 2")]
pub result: ::core::option::Option<read_object_chunk::Result>,
}
pub mod read_object_chunk {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Result {
#[prost(message, tag = "1")]
Meta(super::S3ObjectMeta),
#[prost(bytes, tag = "2")]
Data(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteObjectOpen {
#[prost(message, optional, tag = "1")]
pub r#ref: ::core::option::Option<S3ObjectRef>,
#[prost(string, tag = "2")]
pub content_type: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub cache_control: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub content_disposition: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub content_encoding: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub content_language: ::prost::alloc::string::String,
#[prost(btree_map = "string, string", tag = "7")]
pub metadata: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(string, tag = "8")]
pub if_match: ::prost::alloc::string::String,
#[prost(string, tag = "9")]
pub if_none_match: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteObjectRequest {
#[prost(oneof = "write_object_request::Msg", tags = "1, 2")]
pub msg: ::core::option::Option<write_object_request::Msg>,
}
pub mod write_object_request {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Msg {
#[prost(message, tag = "1")]
Open(super::WriteObjectOpen),
#[prost(bytes, tag = "2")]
Data(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteObjectResponse {
#[prost(message, optional, tag = "1")]
pub meta: ::core::option::Option<S3ObjectMeta>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteObjectRequest {
#[prost(message, optional, tag = "1")]
pub r#ref: ::core::option::Option<S3ObjectRef>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListObjectsRequest {
#[prost(string, tag = "1")]
pub bucket: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub prefix: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub delimiter: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub continuation_token: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub start_after: ::prost::alloc::string::String,
#[prost(int32, tag = "6")]
pub max_keys: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListObjectsResponse {
#[prost(message, repeated, tag = "1")]
pub objects: ::prost::alloc::vec::Vec<S3ObjectMeta>,
#[prost(string, repeated, tag = "2")]
pub common_prefixes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "3")]
pub next_continuation_token: ::prost::alloc::string::String,
#[prost(bool, tag = "4")]
pub has_more: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CopyObjectRequest {
#[prost(message, optional, tag = "1")]
pub source: ::core::option::Option<S3ObjectRef>,
#[prost(message, optional, tag = "2")]
pub destination: ::core::option::Option<S3ObjectRef>,
#[prost(string, tag = "3")]
pub if_match: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub if_none_match: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CopyObjectResponse {
#[prost(message, optional, tag = "1")]
pub meta: ::core::option::Option<S3ObjectMeta>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PresignObjectRequest {
#[prost(message, optional, tag = "1")]
pub r#ref: ::core::option::Option<S3ObjectRef>,
#[prost(enumeration = "PresignMethod", tag = "2")]
pub method: i32,
#[prost(int64, tag = "3")]
pub expires_seconds: i64,
#[prost(string, tag = "4")]
pub content_type: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub content_disposition: ::prost::alloc::string::String,
#[prost(btree_map = "string, string", tag = "6")]
pub headers: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PresignObjectResponse {
#[prost(string, tag = "1")]
pub url: ::prost::alloc::string::String,
#[prost(enumeration = "PresignMethod", tag = "2")]
pub method: i32,
#[prost(message, optional, tag = "3")]
pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(btree_map = "string, string", tag = "4")]
pub headers: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PresignMethod {
Unspecified = 0,
Get = 1,
Put = 2,
Delete = 3,
Head = 4,
}
impl PresignMethod {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "PRESIGN_METHOD_UNSPECIFIED",
Self::Get => "PRESIGN_METHOD_GET",
Self::Put => "PRESIGN_METHOD_PUT",
Self::Delete => "PRESIGN_METHOD_DELETE",
Self::Head => "PRESIGN_METHOD_HEAD",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PRESIGN_METHOD_UNSPECIFIED" => Some(Self::Unspecified),
"PRESIGN_METHOD_GET" => Some(Self::Get),
"PRESIGN_METHOD_PUT" => Some(Self::Put),
"PRESIGN_METHOD_DELETE" => Some(Self::Delete),
"PRESIGN_METHOD_HEAD" => Some(Self::Head),
_ => None,
}
}
}
pub mod s3_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct S3Client<T> {
inner: tonic::client::Grpc<T>,
}
impl S3Client<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> S3Client<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> S3Client<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
S3Client::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn head_object(
&mut self,
request: impl tonic::IntoRequest<super::HeadObjectRequest>,
) -> std::result::Result<tonic::Response<super::HeadObjectResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/HeadObject");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.S3", "HeadObject"));
self.inner.unary(req, path, codec).await
}
pub async fn read_object(
&mut self,
request: impl tonic::IntoRequest<super::ReadObjectRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::ReadObjectChunk>>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/ReadObject");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.S3", "ReadObject"));
self.inner.server_streaming(req, path, codec).await
}
pub async fn write_object(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::WriteObjectRequest>,
) -> std::result::Result<tonic::Response<super::WriteObjectResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/WriteObject");
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.S3", "WriteObject"));
self.inner.client_streaming(req, path, codec).await
}
pub async fn delete_object(
&mut self,
request: impl tonic::IntoRequest<super::DeleteObjectRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/DeleteObject");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.S3", "DeleteObject"));
self.inner.unary(req, path, codec).await
}
pub async fn list_objects(
&mut self,
request: impl tonic::IntoRequest<super::ListObjectsRequest>,
) -> std::result::Result<tonic::Response<super::ListObjectsResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/ListObjects");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.S3", "ListObjects"));
self.inner.unary(req, path, codec).await
}
pub async fn copy_object(
&mut self,
request: impl tonic::IntoRequest<super::CopyObjectRequest>,
) -> std::result::Result<tonic::Response<super::CopyObjectResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/CopyObject");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.S3", "CopyObject"));
self.inner.unary(req, path, codec).await
}
pub async fn presign_object(
&mut self,
request: impl tonic::IntoRequest<super::PresignObjectRequest>,
) -> std::result::Result<tonic::Response<super::PresignObjectResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/gestalt.provider.v1.S3/PresignObject");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("gestalt.provider.v1.S3", "PresignObject"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod s3_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait S3: std::marker::Send + std::marker::Sync + 'static {
async fn head_object(
&self,
request: tonic::Request<super::HeadObjectRequest>,
) -> std::result::Result<tonic::Response<super::HeadObjectResponse>, tonic::Status>;
type ReadObjectStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::ReadObjectChunk, tonic::Status>,
> + std::marker::Send
+ 'static;
async fn read_object(
&self,
request: tonic::Request<super::ReadObjectRequest>,
) -> std::result::Result<tonic::Response<Self::ReadObjectStream>, tonic::Status>;
async fn write_object(
&self,
request: tonic::Request<tonic::Streaming<super::WriteObjectRequest>>,
) -> std::result::Result<tonic::Response<super::WriteObjectResponse>, tonic::Status>;
async fn delete_object(
&self,
request: tonic::Request<super::DeleteObjectRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn list_objects(
&self,
request: tonic::Request<super::ListObjectsRequest>,
) -> std::result::Result<tonic::Response<super::ListObjectsResponse>, tonic::Status>;
async fn copy_object(
&self,
request: tonic::Request<super::CopyObjectRequest>,
) -> std::result::Result<tonic::Response<super::CopyObjectResponse>, tonic::Status>;
async fn presign_object(
&self,
request: tonic::Request<super::PresignObjectRequest>,
) -> std::result::Result<tonic::Response<super::PresignObjectResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct S3Server<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> S3Server<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for S3Server<T>
where
T: S3,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/gestalt.provider.v1.S3/HeadObject" => {
#[allow(non_camel_case_types)]
struct HeadObjectSvc<T: S3>(pub Arc<T>);
impl<T: S3> tonic::server::UnaryService<super::HeadObjectRequest> for HeadObjectSvc<T> {
type Response = super::HeadObjectResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::HeadObjectRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as S3>::head_object(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = HeadObjectSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.S3/ReadObject" => {
#[allow(non_camel_case_types)]
struct ReadObjectSvc<T: S3>(pub Arc<T>);
impl<T: S3> tonic::server::ServerStreamingService<super::ReadObjectRequest> for ReadObjectSvc<T> {
type Response = super::ReadObjectChunk;
type ResponseStream = T::ReadObjectStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ReadObjectRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as S3>::read_object(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ReadObjectSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.S3/WriteObject" => {
#[allow(non_camel_case_types)]
struct WriteObjectSvc<T: S3>(pub Arc<T>);
impl<T: S3> tonic::server::ClientStreamingService<super::WriteObjectRequest> for WriteObjectSvc<T> {
type Response = super::WriteObjectResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<tonic::Streaming<super::WriteObjectRequest>>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as S3>::write_object(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = WriteObjectSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.client_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.S3/DeleteObject" => {
#[allow(non_camel_case_types)]
struct DeleteObjectSvc<T: S3>(pub Arc<T>);
impl<T: S3> tonic::server::UnaryService<super::DeleteObjectRequest> for DeleteObjectSvc<T> {
type Response = ();
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::DeleteObjectRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as S3>::delete_object(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteObjectSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.S3/ListObjects" => {
#[allow(non_camel_case_types)]
struct ListObjectsSvc<T: S3>(pub Arc<T>);
impl<T: S3> tonic::server::UnaryService<super::ListObjectsRequest> for ListObjectsSvc<T> {
type Response = super::ListObjectsResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ListObjectsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as S3>::list_objects(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListObjectsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.S3/CopyObject" => {
#[allow(non_camel_case_types)]
struct CopyObjectSvc<T: S3>(pub Arc<T>);
impl<T: S3> tonic::server::UnaryService<super::CopyObjectRequest> for CopyObjectSvc<T> {
type Response = super::CopyObjectResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CopyObjectRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { <T as S3>::copy_object(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CopyObjectSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/gestalt.provider.v1.S3/PresignObject" => {
#[allow(non_camel_case_types)]
struct PresignObjectSvc<T: S3>(pub Arc<T>);
impl<T: S3> tonic::server::UnaryService<super::PresignObjectRequest> for PresignObjectSvc<T> {
type Response = super::PresignObjectResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::PresignObjectRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as S3>::presign_object(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = PresignObjectSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
let mut response = http::Response::new(tonic::body::Body::default());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> Clone for S3Server<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "gestalt.provider.v1.S3";
impl<T> tonic::server::NamedService for S3Server<T> {
const NAME: &'static str = SERVICE_NAME;
}
}