#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FramesPayload {
#[prost(message, repeated, tag = "1")]
pub frames: ::prost::alloc::vec::Vec<Frame>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AdminRequest {
#[prost(string, tag = "1")]
pub rql: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub params: ::core::option::Option<Params>,
#[prost(enumeration = "Format", tag = "3")]
pub format: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AdminResponse {
#[prost(oneof = "admin_response::Payload", tags = "1, 2")]
pub payload: ::core::option::Option<admin_response::Payload>,
}
pub mod admin_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "1")]
Frames(super::FramesPayload),
#[prost(bytes, tag = "2")]
Rbcf(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandRequest {
#[prost(string, tag = "1")]
pub rql: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub params: ::core::option::Option<Params>,
#[prost(enumeration = "Format", tag = "3")]
pub format: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandResponse {
#[prost(oneof = "command_response::Payload", tags = "1, 2")]
pub payload: ::core::option::Option<command_response::Payload>,
}
pub mod command_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "1")]
Frames(super::FramesPayload),
#[prost(bytes, tag = "2")]
Rbcf(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryRequest {
#[prost(string, tag = "1")]
pub rql: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub params: ::core::option::Option<Params>,
#[prost(enumeration = "Format", tag = "3")]
pub format: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryResponse {
#[prost(oneof = "query_response::Payload", tags = "1, 2")]
pub payload: ::core::option::Option<query_response::Payload>,
}
pub mod query_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "1")]
Frames(super::FramesPayload),
#[prost(bytes, tag = "2")]
Rbcf(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub params: ::core::option::Option<Params>,
#[prost(enumeration = "Format", tag = "3")]
pub format: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationResponse {
#[prost(oneof = "operation_response::Payload", tags = "1, 2")]
pub payload: ::core::option::Option<operation_response::Payload>,
}
pub mod operation_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "1")]
Frames(super::FramesPayload),
#[prost(bytes, tag = "2")]
Rbcf(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeRequest {
#[prost(string, tag = "1")]
pub rql: ::prost::alloc::string::String,
#[prost(enumeration = "Format", tag = "2")]
pub format: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscriptionEvent {
#[prost(oneof = "subscription_event::Event", tags = "1, 2")]
pub event: ::core::option::Option<subscription_event::Event>,
}
pub mod subscription_event {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Event {
#[prost(message, tag = "1")]
Subscribed(super::SubscribedEvent),
#[prost(message, tag = "2")]
Change(super::ChangeEvent),
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SubscribedEvent {
#[prost(string, tag = "1")]
pub subscription_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChangeEvent {
#[prost(oneof = "change_event::Payload", tags = "1, 2")]
pub payload: ::core::option::Option<change_event::Payload>,
}
pub mod change_event {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "1")]
Frames(super::FramesPayload),
#[prost(bytes, tag = "2")]
Rbcf(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchSubscribeRequest {
#[prost(string, repeated, tag = "1")]
pub rql: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(enumeration = "Format", tag = "2")]
pub format: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BatchUnsubscribeRequest {
#[prost(string, tag = "1")]
pub batch_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BatchUnsubscribeResponse {
#[prost(string, tag = "1")]
pub batch_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchSubscriptionEvent {
#[prost(oneof = "batch_subscription_event::Event", tags = "1, 2, 3")]
pub event: ::core::option::Option<batch_subscription_event::Event>,
}
pub mod batch_subscription_event {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Event {
#[prost(message, tag = "1")]
Subscribed(super::BatchSubscribedEvent),
#[prost(message, tag = "2")]
Change(super::BatchChangeEvent),
#[prost(message, tag = "3")]
MemberClosed(super::BatchMemberClosedEvent),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchSubscribedEvent {
#[prost(string, tag = "1")]
pub batch_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub members: ::prost::alloc::vec::Vec<BatchMember>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BatchMember {
#[prost(uint32, tag = "1")]
pub index: u32,
#[prost(string, tag = "2")]
pub subscription_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchChangeEvent {
#[prost(string, tag = "1")]
pub batch_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub entries: ::prost::alloc::vec::Vec<BatchChangeEntry>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchChangeEntry {
#[prost(string, tag = "1")]
pub subscription_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub change: ::core::option::Option<ChangeEvent>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BatchMemberClosedEvent {
#[prost(string, tag = "1")]
pub batch_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub subscription_id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Format {
Unspecified = 0,
Proto = 1,
Rbcf = 2,
}
impl Format {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "FORMAT_UNSPECIFIED",
Self::Proto => "FORMAT_PROTO",
Self::Rbcf => "FORMAT_RBCF",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"FORMAT_UNSPECIFIED" => Some(Self::Unspecified),
"FORMAT_PROTO" => Some(Self::Proto),
"FORMAT_RBCF" => Some(Self::Rbcf),
_ => None,
}
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnsubscribeRequest {
#[prost(string, tag = "1")]
pub subscription_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnsubscribeResponse {
#[prost(string, tag = "1")]
pub subscription_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthenticateRequest {
#[prost(string, tag = "1")]
pub method: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "2")]
pub credentials: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthenticateResponse {
#[prost(string, tag = "1")]
pub status: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub token: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub identity: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LogoutRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LogoutResponse {
#[prost(string, tag = "1")]
pub status: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Params {
#[prost(oneof = "params::Params", tags = "1, 2")]
pub params: ::core::option::Option<params::Params>,
}
pub mod params {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Params {
#[prost(message, tag = "1")]
Positional(super::PositionalParams),
#[prost(message, tag = "2")]
Named(super::NamedParams),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PositionalParams {
#[prost(message, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<TypedValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NamedParams {
#[prost(map = "string, message", tag = "1")]
pub values: ::std::collections::HashMap<::prost::alloc::string::String, TypedValue>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TypedValue {
#[prost(uint32, tag = "1")]
pub r#type: u32,
#[prost(bytes = "vec", tag = "2")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Frame {
#[prost(uint64, repeated, tag = "1")]
pub row_numbers: ::prost::alloc::vec::Vec<u64>,
#[prost(message, repeated, tag = "2")]
pub columns: ::prost::alloc::vec::Vec<FrameColumn>,
#[prost(string, repeated, tag = "3")]
pub created_at: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "4")]
pub updated_at: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FrameColumn {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub r#type: u32,
#[prost(bytes = "vec", tag = "3")]
pub payload: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "4")]
pub bitvec: ::prost::alloc::vec::Vec<u8>,
}
pub mod reify_db_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct ReifyDbClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ReifyDbClient<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> ReifyDbClient<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,
) -> ReifyDbClient<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,
{
ReifyDbClient::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 admin(
&mut self,
request: impl tonic::IntoRequest<super::AdminRequest>,
) -> std::result::Result<tonic::Response<super::AdminResponse>, 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("/reifydb.v1.ReifyDB/Admin");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("reifydb.v1.ReifyDB", "Admin"));
self.inner.unary(req, path, codec).await
}
pub async fn command(
&mut self,
request: impl tonic::IntoRequest<super::CommandRequest>,
) -> std::result::Result<
tonic::Response<super::CommandResponse>,
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(
"/reifydb.v1.ReifyDB/Command",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("reifydb.v1.ReifyDB", "Command"));
self.inner.unary(req, path, codec).await
}
pub async fn query(
&mut self,
request: impl tonic::IntoRequest<super::QueryRequest>,
) -> std::result::Result<tonic::Response<super::QueryResponse>, 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("/reifydb.v1.ReifyDB/Query");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("reifydb.v1.ReifyDB", "Query"));
self.inner.unary(req, path, codec).await
}
pub async fn subscribe(
&mut self,
request: impl tonic::IntoRequest<super::SubscribeRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::SubscriptionEvent>>,
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(
"/reifydb.v1.ReifyDB/Subscribe",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("reifydb.v1.ReifyDB", "Subscribe"));
self.inner.server_streaming(req, path, codec).await
}
pub async fn unsubscribe(
&mut self,
request: impl tonic::IntoRequest<super::UnsubscribeRequest>,
) -> std::result::Result<
tonic::Response<super::UnsubscribeResponse>,
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(
"/reifydb.v1.ReifyDB/Unsubscribe",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("reifydb.v1.ReifyDB", "Unsubscribe"));
self.inner.unary(req, path, codec).await
}
pub async fn batch_subscribe(
&mut self,
request: impl tonic::IntoRequest<super::BatchSubscribeRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::BatchSubscriptionEvent>>,
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(
"/reifydb.v1.ReifyDB/BatchSubscribe",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("reifydb.v1.ReifyDB", "BatchSubscribe"));
self.inner.server_streaming(req, path, codec).await
}
pub async fn batch_unsubscribe(
&mut self,
request: impl tonic::IntoRequest<super::BatchUnsubscribeRequest>,
) -> std::result::Result<
tonic::Response<super::BatchUnsubscribeResponse>,
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(
"/reifydb.v1.ReifyDB/BatchUnsubscribe",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("reifydb.v1.ReifyDB", "BatchUnsubscribe"));
self.inner.unary(req, path, codec).await
}
pub async fn authenticate(
&mut self,
request: impl tonic::IntoRequest<super::AuthenticateRequest>,
) -> std::result::Result<
tonic::Response<super::AuthenticateResponse>,
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(
"/reifydb.v1.ReifyDB/Authenticate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("reifydb.v1.ReifyDB", "Authenticate"));
self.inner.unary(req, path, codec).await
}
pub async fn logout(
&mut self,
request: impl tonic::IntoRequest<super::LogoutRequest>,
) -> std::result::Result<
tonic::Response<super::LogoutResponse>,
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(
"/reifydb.v1.ReifyDB/Logout",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("reifydb.v1.ReifyDB", "Logout"));
self.inner.unary(req, path, codec).await
}
pub async fn call(
&mut self,
request: impl tonic::IntoRequest<super::OperationRequest>,
) -> std::result::Result<
tonic::Response<super::OperationResponse>,
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(
"/reifydb.v1.ReifyDB/Call",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("reifydb.v1.ReifyDB", "Call"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod reify_db_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait ReifyDb: std::marker::Send + std::marker::Sync + 'static {
async fn admin(
&self,
request: tonic::Request<super::AdminRequest>,
) -> std::result::Result<tonic::Response<super::AdminResponse>, tonic::Status>;
async fn command(
&self,
request: tonic::Request<super::CommandRequest>,
) -> std::result::Result<tonic::Response<super::CommandResponse>, tonic::Status>;
async fn query(
&self,
request: tonic::Request<super::QueryRequest>,
) -> std::result::Result<tonic::Response<super::QueryResponse>, tonic::Status>;
type SubscribeStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::SubscriptionEvent, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn subscribe(
&self,
request: tonic::Request<super::SubscribeRequest>,
) -> std::result::Result<tonic::Response<Self::SubscribeStream>, tonic::Status>;
async fn unsubscribe(
&self,
request: tonic::Request<super::UnsubscribeRequest>,
) -> std::result::Result<tonic::Response<super::UnsubscribeResponse>, tonic::Status>;
async fn authenticate(
&self,
request: tonic::Request<super::AuthenticateRequest>,
) -> std::result::Result<tonic::Response<super::AuthenticateResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct ReifyDbServer<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> ReifyDbServer<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 ReifyDbServer<T>
where
T: ReifyDb,
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() {
"/reifydb.v1.ReifyDB/Admin" => {
#[allow(non_camel_case_types)]
struct AdminSvc<T: ReifyDb>(pub Arc<T>);
impl<T: ReifyDb> tonic::server::UnaryService<super::AdminRequest>
for AdminSvc<T> {
type Response = super::AdminResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AdminRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ReifyDb>::admin(&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 = AdminSvc(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)
}
"/reifydb.v1.ReifyDB/Command" => {
#[allow(non_camel_case_types)]
struct CommandSvc<T: ReifyDb>(pub Arc<T>);
impl<T: ReifyDb> tonic::server::UnaryService<super::CommandRequest>
for CommandSvc<T> {
type Response = super::CommandResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CommandRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ReifyDb>::command(&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 = CommandSvc(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)
}
"/reifydb.v1.ReifyDB/Query" => {
#[allow(non_camel_case_types)]
struct QuerySvc<T: ReifyDb>(pub Arc<T>);
impl<T: ReifyDb> tonic::server::UnaryService<super::QueryRequest>
for QuerySvc<T> {
type Response = super::QueryResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ReifyDb>::query(&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 = QuerySvc(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)
}
"/reifydb.v1.ReifyDB/Subscribe" => {
#[allow(non_camel_case_types)]
struct SubscribeSvc<T: ReifyDb>(pub Arc<T>);
impl<
T: ReifyDb,
> tonic::server::ServerStreamingService<super::SubscribeRequest>
for SubscribeSvc<T> {
type Response = super::SubscriptionEvent;
type ResponseStream = T::SubscribeStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SubscribeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ReifyDb>::subscribe(&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 = SubscribeSvc(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)
}
"/reifydb.v1.ReifyDB/Unsubscribe" => {
#[allow(non_camel_case_types)]
struct UnsubscribeSvc<T: ReifyDb>(pub Arc<T>);
impl<T: ReifyDb> tonic::server::UnaryService<super::UnsubscribeRequest>
for UnsubscribeSvc<T> {
type Response = super::UnsubscribeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::UnsubscribeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ReifyDb>::unsubscribe(&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 = UnsubscribeSvc(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)
}
"/reifydb.v1.ReifyDB/Authenticate" => {
#[allow(non_camel_case_types)]
struct AuthenticateSvc<T: ReifyDb>(pub Arc<T>);
impl<T: ReifyDb> tonic::server::UnaryService<super::AuthenticateRequest>
for AuthenticateSvc<T> {
type Response = super::AuthenticateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthenticateRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ReifyDb>::authenticate(&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 = AuthenticateSvc(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 ReifyDbServer<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 = "reifydb.v1.ReifyDB";
impl<T> tonic::server::NamedService for ReifyDbServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}