#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RegisterSchemaRequest {
#[prost(string, tag = "1")]
pub subject: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub schema_type: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "3")]
pub schema_definition: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "4")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub created_by: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "6")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RegisterSchemaResponse {
#[prost(uint64, tag = "1")]
pub schema_id: u64,
#[prost(uint32, tag = "2")]
pub version: u32,
#[prost(bool, tag = "3")]
pub is_new_version: bool,
#[prost(string, tag = "4")]
pub fingerprint: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetSchemaRequest {
#[prost(uint64, tag = "1")]
pub schema_id: u64,
#[prost(uint32, optional, tag = "2")]
pub version: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetSchemaResponse {
#[prost(uint64, tag = "1")]
pub schema_id: u64,
#[prost(uint32, tag = "2")]
pub version: u32,
#[prost(string, tag = "3")]
pub subject: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub schema_type: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "5")]
pub schema_definition: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "6")]
pub description: ::prost::alloc::string::String,
#[prost(uint64, tag = "7")]
pub created_at: u64,
#[prost(string, tag = "8")]
pub created_by: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "9")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "10")]
pub fingerprint: ::prost::alloc::string::String,
#[prost(string, tag = "11")]
pub compatibility_mode: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetLatestSchemaRequest {
#[prost(string, tag = "1")]
pub subject: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListVersionsRequest {
#[prost(string, tag = "1")]
pub subject: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListVersionsResponse {
#[prost(message, repeated, tag = "1")]
pub versions: ::prost::alloc::vec::Vec<SchemaVersionInfo>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SchemaVersionInfo {
#[prost(uint32, tag = "1")]
pub version: u32,
#[prost(uint64, tag = "2")]
pub created_at: u64,
#[prost(string, tag = "3")]
pub created_by: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub fingerprint: ::prost::alloc::string::String,
#[prost(uint64, tag = "6")]
pub schema_id: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CheckCompatibilityRequest {
#[prost(string, tag = "1")]
pub subject: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub new_schema_definition: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "3")]
pub schema_type: ::prost::alloc::string::String,
#[prost(string, optional, tag = "4")]
pub compatibility_mode: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CheckCompatibilityResponse {
#[prost(bool, tag = "1")]
pub is_compatible: bool,
#[prost(string, repeated, tag = "2")]
pub errors: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteSchemaVersionRequest {
#[prost(string, tag = "1")]
pub subject: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub version: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteSchemaVersionResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetCompatibilityModeRequest {
#[prost(string, tag = "1")]
pub subject: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub compatibility_mode: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetCompatibilityModeResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ConfigureTopicSchemaRequest {
#[prost(string, tag = "1")]
pub topic_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub schema_subject: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub validation_policy: ::prost::alloc::string::String,
#[prost(bool, tag = "4")]
pub enable_payload_validation: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ConfigureTopicSchemaResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UpdateTopicValidationPolicyRequest {
#[prost(string, tag = "1")]
pub topic_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub validation_policy: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub enable_payload_validation: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UpdateTopicValidationPolicyResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTopicSchemaConfigRequest {
#[prost(string, tag = "1")]
pub topic_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTopicSchemaConfigResponse {
#[prost(string, tag = "1")]
pub schema_subject: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub validation_policy: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub enable_payload_validation: bool,
#[prost(uint64, tag = "4")]
pub schema_id: u64,
}
pub mod schema_registry_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 SchemaRegistryClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SchemaRegistryClient<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> SchemaRegistryClient<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,
) -> SchemaRegistryClient<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,
{
SchemaRegistryClient::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 register_schema(
&mut self,
request: impl tonic::IntoRequest<super::RegisterSchemaRequest>,
) -> std::result::Result<
tonic::Response<super::RegisterSchemaResponse>,
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(
"/danube_schema.SchemaRegistry/RegisterSchema",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("danube_schema.SchemaRegistry", "RegisterSchema"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_schema(
&mut self,
request: impl tonic::IntoRequest<super::GetSchemaRequest>,
) -> std::result::Result<
tonic::Response<super::GetSchemaResponse>,
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(
"/danube_schema.SchemaRegistry/GetSchema",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_schema.SchemaRegistry", "GetSchema"));
self.inner.unary(req, path, codec).await
}
pub async fn get_latest_schema(
&mut self,
request: impl tonic::IntoRequest<super::GetLatestSchemaRequest>,
) -> std::result::Result<
tonic::Response<super::GetSchemaResponse>,
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(
"/danube_schema.SchemaRegistry/GetLatestSchema",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("danube_schema.SchemaRegistry", "GetLatestSchema"),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_versions(
&mut self,
request: impl tonic::IntoRequest<super::ListVersionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListVersionsResponse>,
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(
"/danube_schema.SchemaRegistry/ListVersions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_schema.SchemaRegistry", "ListVersions"));
self.inner.unary(req, path, codec).await
}
pub async fn check_compatibility(
&mut self,
request: impl tonic::IntoRequest<super::CheckCompatibilityRequest>,
) -> std::result::Result<
tonic::Response<super::CheckCompatibilityResponse>,
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(
"/danube_schema.SchemaRegistry/CheckCompatibility",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("danube_schema.SchemaRegistry", "CheckCompatibility"),
);
self.inner.unary(req, path, codec).await
}
pub async fn delete_schema_version(
&mut self,
request: impl tonic::IntoRequest<super::DeleteSchemaVersionRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteSchemaVersionResponse>,
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(
"/danube_schema.SchemaRegistry/DeleteSchemaVersion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"danube_schema.SchemaRegistry",
"DeleteSchemaVersion",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn set_compatibility_mode(
&mut self,
request: impl tonic::IntoRequest<super::SetCompatibilityModeRequest>,
) -> std::result::Result<
tonic::Response<super::SetCompatibilityModeResponse>,
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(
"/danube_schema.SchemaRegistry/SetCompatibilityMode",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"danube_schema.SchemaRegistry",
"SetCompatibilityMode",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn configure_topic_schema(
&mut self,
request: impl tonic::IntoRequest<super::ConfigureTopicSchemaRequest>,
) -> std::result::Result<
tonic::Response<super::ConfigureTopicSchemaResponse>,
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(
"/danube_schema.SchemaRegistry/ConfigureTopicSchema",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"danube_schema.SchemaRegistry",
"ConfigureTopicSchema",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn update_topic_validation_policy(
&mut self,
request: impl tonic::IntoRequest<super::UpdateTopicValidationPolicyRequest>,
) -> std::result::Result<
tonic::Response<super::UpdateTopicValidationPolicyResponse>,
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(
"/danube_schema.SchemaRegistry/UpdateTopicValidationPolicy",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"danube_schema.SchemaRegistry",
"UpdateTopicValidationPolicy",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_topic_schema_config(
&mut self,
request: impl tonic::IntoRequest<super::GetTopicSchemaConfigRequest>,
) -> std::result::Result<
tonic::Response<super::GetTopicSchemaConfigResponse>,
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(
"/danube_schema.SchemaRegistry/GetTopicSchemaConfig",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"danube_schema.SchemaRegistry",
"GetTopicSchemaConfig",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod schema_registry_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait SchemaRegistry: std::marker::Send + std::marker::Sync + 'static {
async fn register_schema(
&self,
request: tonic::Request<super::RegisterSchemaRequest>,
) -> std::result::Result<
tonic::Response<super::RegisterSchemaResponse>,
tonic::Status,
>;
async fn get_schema(
&self,
request: tonic::Request<super::GetSchemaRequest>,
) -> std::result::Result<
tonic::Response<super::GetSchemaResponse>,
tonic::Status,
>;
async fn get_latest_schema(
&self,
request: tonic::Request<super::GetLatestSchemaRequest>,
) -> std::result::Result<
tonic::Response<super::GetSchemaResponse>,
tonic::Status,
>;
async fn list_versions(
&self,
request: tonic::Request<super::ListVersionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListVersionsResponse>,
tonic::Status,
>;
async fn check_compatibility(
&self,
request: tonic::Request<super::CheckCompatibilityRequest>,
) -> std::result::Result<
tonic::Response<super::CheckCompatibilityResponse>,
tonic::Status,
>;
async fn delete_schema_version(
&self,
request: tonic::Request<super::DeleteSchemaVersionRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteSchemaVersionResponse>,
tonic::Status,
>;
async fn set_compatibility_mode(
&self,
request: tonic::Request<super::SetCompatibilityModeRequest>,
) -> std::result::Result<
tonic::Response<super::SetCompatibilityModeResponse>,
tonic::Status,
>;
async fn configure_topic_schema(
&self,
request: tonic::Request<super::ConfigureTopicSchemaRequest>,
) -> std::result::Result<
tonic::Response<super::ConfigureTopicSchemaResponse>,
tonic::Status,
>;
async fn update_topic_validation_policy(
&self,
request: tonic::Request<super::UpdateTopicValidationPolicyRequest>,
) -> std::result::Result<
tonic::Response<super::UpdateTopicValidationPolicyResponse>,
tonic::Status,
>;
async fn get_topic_schema_config(
&self,
request: tonic::Request<super::GetTopicSchemaConfigRequest>,
) -> std::result::Result<
tonic::Response<super::GetTopicSchemaConfigResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct SchemaRegistryServer<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> SchemaRegistryServer<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 SchemaRegistryServer<T>
where
T: SchemaRegistry,
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() {
"/danube_schema.SchemaRegistry/RegisterSchema" => {
#[allow(non_camel_case_types)]
struct RegisterSchemaSvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<super::RegisterSchemaRequest>
for RegisterSchemaSvc<T> {
type Response = super::RegisterSchemaResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RegisterSchemaRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::register_schema(&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 = RegisterSchemaSvc(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)
}
"/danube_schema.SchemaRegistry/GetSchema" => {
#[allow(non_camel_case_types)]
struct GetSchemaSvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<super::GetSchemaRequest>
for GetSchemaSvc<T> {
type Response = super::GetSchemaResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetSchemaRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::get_schema(&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 = GetSchemaSvc(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)
}
"/danube_schema.SchemaRegistry/GetLatestSchema" => {
#[allow(non_camel_case_types)]
struct GetLatestSchemaSvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<super::GetLatestSchemaRequest>
for GetLatestSchemaSvc<T> {
type Response = super::GetSchemaResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetLatestSchemaRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::get_latest_schema(&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 = GetLatestSchemaSvc(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)
}
"/danube_schema.SchemaRegistry/ListVersions" => {
#[allow(non_camel_case_types)]
struct ListVersionsSvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<super::ListVersionsRequest>
for ListVersionsSvc<T> {
type Response = super::ListVersionsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListVersionsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::list_versions(&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 = ListVersionsSvc(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)
}
"/danube_schema.SchemaRegistry/CheckCompatibility" => {
#[allow(non_camel_case_types)]
struct CheckCompatibilitySvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<super::CheckCompatibilityRequest>
for CheckCompatibilitySvc<T> {
type Response = super::CheckCompatibilityResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CheckCompatibilityRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::check_compatibility(&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 = CheckCompatibilitySvc(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)
}
"/danube_schema.SchemaRegistry/DeleteSchemaVersion" => {
#[allow(non_camel_case_types)]
struct DeleteSchemaVersionSvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<super::DeleteSchemaVersionRequest>
for DeleteSchemaVersionSvc<T> {
type Response = super::DeleteSchemaVersionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DeleteSchemaVersionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::delete_schema_version(
&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 = DeleteSchemaVersionSvc(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)
}
"/danube_schema.SchemaRegistry/SetCompatibilityMode" => {
#[allow(non_camel_case_types)]
struct SetCompatibilityModeSvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<super::SetCompatibilityModeRequest>
for SetCompatibilityModeSvc<T> {
type Response = super::SetCompatibilityModeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SetCompatibilityModeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::set_compatibility_mode(
&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 = SetCompatibilityModeSvc(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)
}
"/danube_schema.SchemaRegistry/ConfigureTopicSchema" => {
#[allow(non_camel_case_types)]
struct ConfigureTopicSchemaSvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<super::ConfigureTopicSchemaRequest>
for ConfigureTopicSchemaSvc<T> {
type Response = super::ConfigureTopicSchemaResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ConfigureTopicSchemaRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::configure_topic_schema(
&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 = ConfigureTopicSchemaSvc(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)
}
"/danube_schema.SchemaRegistry/UpdateTopicValidationPolicy" => {
#[allow(non_camel_case_types)]
struct UpdateTopicValidationPolicySvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<
super::UpdateTopicValidationPolicyRequest,
> for UpdateTopicValidationPolicySvc<T> {
type Response = super::UpdateTopicValidationPolicyResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::UpdateTopicValidationPolicyRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::update_topic_validation_policy(
&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 = UpdateTopicValidationPolicySvc(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)
}
"/danube_schema.SchemaRegistry/GetTopicSchemaConfig" => {
#[allow(non_camel_case_types)]
struct GetTopicSchemaConfigSvc<T: SchemaRegistry>(pub Arc<T>);
impl<
T: SchemaRegistry,
> tonic::server::UnaryService<super::GetTopicSchemaConfigRequest>
for GetTopicSchemaConfigSvc<T> {
type Response = super::GetTopicSchemaConfigResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetTopicSchemaConfigRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SchemaRegistry>::get_topic_schema_config(
&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 = GetTopicSchemaConfigSvc(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 SchemaRegistryServer<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 = "danube_schema.SchemaRegistry";
impl<T> tonic::server::NamedService for SchemaRegistryServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}