3473 lines
152 KiB
Rust
3473 lines
152 KiB
Rust
// @generated
|
|
/// Generated client implementations.
|
|
pub mod validator_mapfix_service_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 ValidatorMapfixServiceClient<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl ValidatorMapfixServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
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> ValidatorMapfixServiceClient<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,
|
|
) -> ValidatorMapfixServiceClient<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,
|
|
{
|
|
ValidatorMapfixServiceClient::new(
|
|
InterceptedService::new(inner, interceptor),
|
|
)
|
|
}
|
|
/// Compress requests with the given encoding.
|
|
///
|
|
/// This requires the server to support it otherwise it might respond with an
|
|
/// error.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.send_compressed(encoding);
|
|
self
|
|
}
|
|
/// Enable decompressing responses.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.accept_compressed(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_decoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::MapfixCreate>,
|
|
) -> std::result::Result<tonic::Response<super::MapfixId>, 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(
|
|
"/validator.ValidatorMapfixService/Create",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("validator.ValidatorMapfixService", "Create"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn create_audit_error(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::AuditErrorRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/CreateAuditError",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"CreateAuditError",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn create_audit_checklist(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::AuditChecklistRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/CreateAuditChecklist",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"CreateAuditChecklist",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_validated_model(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ValidatedModelRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/SetValidatedModel",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"SetValidatedModel",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_submitted(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SubmittedRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/SetStatusSubmitted",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"SetStatusSubmitted",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_request_changes(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/SetStatusRequestChanges",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"SetStatusRequestChanges",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_validated(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/SetStatusValidated",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"SetStatusValidated",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_not_validated(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/SetStatusNotValidated",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"SetStatusNotValidated",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_uploaded(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/SetStatusUploaded",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"SetStatusUploaded",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_not_uploaded(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/SetStatusNotUploaded",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"SetStatusNotUploaded",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_released(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::MapfixReleaseRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/SetStatusReleased",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"SetStatusReleased",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_not_released(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorMapfixService/SetStatusNotReleased",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorMapfixService",
|
|
"SetStatusNotReleased",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
}
|
|
}
|
|
/// Generated server implementations.
|
|
pub mod validator_mapfix_service_server {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
/// Generated trait containing gRPC methods that should be implemented for use with ValidatorMapfixServiceServer.
|
|
#[async_trait]
|
|
pub trait ValidatorMapfixService: std::marker::Send + std::marker::Sync + 'static {
|
|
async fn create(
|
|
&self,
|
|
request: tonic::Request<super::MapfixCreate>,
|
|
) -> std::result::Result<tonic::Response<super::MapfixId>, tonic::Status>;
|
|
async fn create_audit_error(
|
|
&self,
|
|
request: tonic::Request<super::AuditErrorRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn create_audit_checklist(
|
|
&self,
|
|
request: tonic::Request<super::AuditChecklistRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_validated_model(
|
|
&self,
|
|
request: tonic::Request<super::ValidatedModelRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_submitted(
|
|
&self,
|
|
request: tonic::Request<super::SubmittedRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_request_changes(
|
|
&self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_validated(
|
|
&self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_not_validated(
|
|
&self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_uploaded(
|
|
&self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_not_uploaded(
|
|
&self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_released(
|
|
&self,
|
|
request: tonic::Request<super::MapfixReleaseRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_not_released(
|
|
&self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct ValidatorMapfixServiceServer<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> ValidatorMapfixServiceServer<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)
|
|
}
|
|
/// Enable decompressing requests with the given encoding.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.accept_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Compress responses with the given encoding, if the client supports it.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.send_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.max_decoding_message_size = Some(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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 ValidatorMapfixServiceServer<T>
|
|
where
|
|
T: ValidatorMapfixService,
|
|
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() {
|
|
"/validator.ValidatorMapfixService/Create" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CreateSvc<T: ValidatorMapfixService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::MapfixCreate> for CreateSvc<T> {
|
|
type Response = super::MapfixId;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::MapfixCreate>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::create(&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 = CreateSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/CreateAuditError" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CreateAuditErrorSvc<T: ValidatorMapfixService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::AuditErrorRequest>
|
|
for CreateAuditErrorSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::AuditErrorRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::create_audit_error(
|
|
&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 = CreateAuditErrorSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/CreateAuditChecklist" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CreateAuditChecklistSvc<T: ValidatorMapfixService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::AuditChecklistRequest>
|
|
for CreateAuditChecklistSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::AuditChecklistRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::create_audit_checklist(
|
|
&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 = CreateAuditChecklistSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/SetValidatedModel" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetValidatedModelSvc<T: ValidatorMapfixService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::ValidatedModelRequest>
|
|
for SetValidatedModelSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ValidatedModelRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::set_validated_model(
|
|
&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 = SetValidatedModelSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/SetStatusSubmitted" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusSubmittedSvc<T: ValidatorMapfixService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::SubmittedRequest>
|
|
for SetStatusSubmittedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SubmittedRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::set_status_submitted(
|
|
&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 = SetStatusSubmittedSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/SetStatusRequestChanges" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusRequestChangesSvc<T: ValidatorMapfixService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::MapfixId>
|
|
for SetStatusRequestChangesSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::set_status_request_changes(
|
|
&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 = SetStatusRequestChangesSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/SetStatusValidated" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusValidatedSvc<T: ValidatorMapfixService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::MapfixId>
|
|
for SetStatusValidatedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::set_status_validated(
|
|
&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 = SetStatusValidatedSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/SetStatusNotValidated" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusNotValidatedSvc<T: ValidatorMapfixService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::MapfixId>
|
|
for SetStatusNotValidatedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::set_status_not_validated(
|
|
&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 = SetStatusNotValidatedSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/SetStatusUploaded" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusUploadedSvc<T: ValidatorMapfixService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::MapfixId>
|
|
for SetStatusUploadedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::set_status_uploaded(
|
|
&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 = SetStatusUploadedSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/SetStatusNotUploaded" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusNotUploadedSvc<T: ValidatorMapfixService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::MapfixId>
|
|
for SetStatusNotUploadedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::set_status_not_uploaded(
|
|
&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 = SetStatusNotUploadedSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/SetStatusReleased" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusReleasedSvc<T: ValidatorMapfixService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::MapfixReleaseRequest>
|
|
for SetStatusReleasedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::MapfixReleaseRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::set_status_released(
|
|
&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 = SetStatusReleasedSvc(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)
|
|
}
|
|
"/validator.ValidatorMapfixService/SetStatusNotReleased" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusNotReleasedSvc<T: ValidatorMapfixService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorMapfixService,
|
|
> tonic::server::UnaryService<super::MapfixId>
|
|
for SetStatusNotReleasedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::MapfixId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorMapfixService>::set_status_not_released(
|
|
&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 = SetStatusNotReleasedSvc(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 ValidatorMapfixServiceServer<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,
|
|
}
|
|
}
|
|
}
|
|
/// Generated gRPC service name
|
|
pub const SERVICE_NAME: &str = "validator.ValidatorMapfixService";
|
|
impl<T> tonic::server::NamedService for ValidatorMapfixServiceServer<T> {
|
|
const NAME: &'static str = SERVICE_NAME;
|
|
}
|
|
}
|
|
/// Generated client implementations.
|
|
pub mod validator_submission_service_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 ValidatorSubmissionServiceClient<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl ValidatorSubmissionServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
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> ValidatorSubmissionServiceClient<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,
|
|
) -> ValidatorSubmissionServiceClient<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,
|
|
{
|
|
ValidatorSubmissionServiceClient::new(
|
|
InterceptedService::new(inner, interceptor),
|
|
)
|
|
}
|
|
/// Compress requests with the given encoding.
|
|
///
|
|
/// This requires the server to support it otherwise it might respond with an
|
|
/// error.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.send_compressed(encoding);
|
|
self
|
|
}
|
|
/// Enable decompressing responses.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.accept_compressed(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_decoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SubmissionCreate>,
|
|
) -> std::result::Result<tonic::Response<super::SubmissionId>, 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(
|
|
"/validator.ValidatorSubmissionService/Create",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("validator.ValidatorSubmissionService", "Create"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn create_audit_error(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::AuditErrorRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/CreateAuditError",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"CreateAuditError",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn create_audit_checklist(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::AuditChecklistRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/CreateAuditChecklist",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"CreateAuditChecklist",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_validated_model(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ValidatedModelRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/SetValidatedModel",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"SetValidatedModel",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_submitted(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SubmittedRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/SetStatusSubmitted",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"SetStatusSubmitted",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_request_changes(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SubmissionId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/SetStatusRequestChanges",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"SetStatusRequestChanges",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_validated(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SubmissionId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/SetStatusValidated",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"SetStatusValidated",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_not_validated(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SubmissionId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/SetStatusNotValidated",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"SetStatusNotValidated",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_uploaded(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::StatusUploadedRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/SetStatusUploaded",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"SetStatusUploaded",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_not_uploaded(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SubmissionId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/SetStatusNotUploaded",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"SetStatusNotUploaded",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn set_status_released(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SubmissionReleaseRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorSubmissionService/SetStatusReleased",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"validator.ValidatorSubmissionService",
|
|
"SetStatusReleased",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
}
|
|
}
|
|
/// Generated server implementations.
|
|
pub mod validator_submission_service_server {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
/// Generated trait containing gRPC methods that should be implemented for use with ValidatorSubmissionServiceServer.
|
|
#[async_trait]
|
|
pub trait ValidatorSubmissionService: std::marker::Send + std::marker::Sync + 'static {
|
|
async fn create(
|
|
&self,
|
|
request: tonic::Request<super::SubmissionCreate>,
|
|
) -> std::result::Result<tonic::Response<super::SubmissionId>, tonic::Status>;
|
|
async fn create_audit_error(
|
|
&self,
|
|
request: tonic::Request<super::AuditErrorRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn create_audit_checklist(
|
|
&self,
|
|
request: tonic::Request<super::AuditChecklistRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_validated_model(
|
|
&self,
|
|
request: tonic::Request<super::ValidatedModelRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_submitted(
|
|
&self,
|
|
request: tonic::Request<super::SubmittedRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_request_changes(
|
|
&self,
|
|
request: tonic::Request<super::SubmissionId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_validated(
|
|
&self,
|
|
request: tonic::Request<super::SubmissionId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_not_validated(
|
|
&self,
|
|
request: tonic::Request<super::SubmissionId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_uploaded(
|
|
&self,
|
|
request: tonic::Request<super::StatusUploadedRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_not_uploaded(
|
|
&self,
|
|
request: tonic::Request<super::SubmissionId>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn set_status_released(
|
|
&self,
|
|
request: tonic::Request<super::SubmissionReleaseRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct ValidatorSubmissionServiceServer<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> ValidatorSubmissionServiceServer<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)
|
|
}
|
|
/// Enable decompressing requests with the given encoding.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.accept_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Compress responses with the given encoding, if the client supports it.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.send_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.max_decoding_message_size = Some(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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 ValidatorSubmissionServiceServer<T>
|
|
where
|
|
T: ValidatorSubmissionService,
|
|
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() {
|
|
"/validator.ValidatorSubmissionService/Create" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CreateSvc<T: ValidatorSubmissionService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::SubmissionCreate>
|
|
for CreateSvc<T> {
|
|
type Response = super::SubmissionId;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SubmissionCreate>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::create(&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 = CreateSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/CreateAuditError" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CreateAuditErrorSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::AuditErrorRequest>
|
|
for CreateAuditErrorSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::AuditErrorRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::create_audit_error(
|
|
&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 = CreateAuditErrorSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/CreateAuditChecklist" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CreateAuditChecklistSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::AuditChecklistRequest>
|
|
for CreateAuditChecklistSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::AuditChecklistRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::create_audit_checklist(
|
|
&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 = CreateAuditChecklistSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/SetValidatedModel" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetValidatedModelSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::ValidatedModelRequest>
|
|
for SetValidatedModelSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ValidatedModelRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::set_validated_model(
|
|
&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 = SetValidatedModelSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/SetStatusSubmitted" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusSubmittedSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::SubmittedRequest>
|
|
for SetStatusSubmittedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SubmittedRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::set_status_submitted(
|
|
&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 = SetStatusSubmittedSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/SetStatusRequestChanges" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusRequestChangesSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::SubmissionId>
|
|
for SetStatusRequestChangesSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SubmissionId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::set_status_request_changes(
|
|
&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 = SetStatusRequestChangesSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/SetStatusValidated" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusValidatedSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::SubmissionId>
|
|
for SetStatusValidatedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SubmissionId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::set_status_validated(
|
|
&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 = SetStatusValidatedSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/SetStatusNotValidated" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusNotValidatedSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::SubmissionId>
|
|
for SetStatusNotValidatedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SubmissionId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::set_status_not_validated(
|
|
&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 = SetStatusNotValidatedSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/SetStatusUploaded" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusUploadedSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::StatusUploadedRequest>
|
|
for SetStatusUploadedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::StatusUploadedRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::set_status_uploaded(
|
|
&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 = SetStatusUploadedSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/SetStatusNotUploaded" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusNotUploadedSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::SubmissionId>
|
|
for SetStatusNotUploadedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SubmissionId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::set_status_not_uploaded(
|
|
&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 = SetStatusNotUploadedSvc(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)
|
|
}
|
|
"/validator.ValidatorSubmissionService/SetStatusReleased" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetStatusReleasedSvc<T: ValidatorSubmissionService>(
|
|
pub Arc<T>,
|
|
);
|
|
impl<
|
|
T: ValidatorSubmissionService,
|
|
> tonic::server::UnaryService<super::SubmissionReleaseRequest>
|
|
for SetStatusReleasedSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SubmissionReleaseRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorSubmissionService>::set_status_released(
|
|
&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 = SetStatusReleasedSvc(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 ValidatorSubmissionServiceServer<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,
|
|
}
|
|
}
|
|
}
|
|
/// Generated gRPC service name
|
|
pub const SERVICE_NAME: &str = "validator.ValidatorSubmissionService";
|
|
impl<T> tonic::server::NamedService for ValidatorSubmissionServiceServer<T> {
|
|
const NAME: &'static str = SERVICE_NAME;
|
|
}
|
|
}
|
|
/// Generated client implementations.
|
|
pub mod validator_operation_service_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 ValidatorOperationServiceClient<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl ValidatorOperationServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
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> ValidatorOperationServiceClient<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,
|
|
) -> ValidatorOperationServiceClient<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,
|
|
{
|
|
ValidatorOperationServiceClient::new(
|
|
InterceptedService::new(inner, interceptor),
|
|
)
|
|
}
|
|
/// Compress requests with the given encoding.
|
|
///
|
|
/// This requires the server to support it otherwise it might respond with an
|
|
/// error.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.send_compressed(encoding);
|
|
self
|
|
}
|
|
/// Enable decompressing responses.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.accept_compressed(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_decoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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 success(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::OperationSuccessRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorOperationService/Success",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("validator.ValidatorOperationService", "Success"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn fail(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::OperationFailRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, 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(
|
|
"/validator.ValidatorOperationService/Fail",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("validator.ValidatorOperationService", "Fail"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
}
|
|
}
|
|
/// Generated server implementations.
|
|
pub mod validator_operation_service_server {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
/// Generated trait containing gRPC methods that should be implemented for use with ValidatorOperationServiceServer.
|
|
#[async_trait]
|
|
pub trait ValidatorOperationService: std::marker::Send + std::marker::Sync + 'static {
|
|
async fn success(
|
|
&self,
|
|
request: tonic::Request<super::OperationSuccessRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
async fn fail(
|
|
&self,
|
|
request: tonic::Request<super::OperationFailRequest>,
|
|
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct ValidatorOperationServiceServer<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> ValidatorOperationServiceServer<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)
|
|
}
|
|
/// Enable decompressing requests with the given encoding.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.accept_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Compress responses with the given encoding, if the client supports it.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.send_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.max_decoding_message_size = Some(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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 ValidatorOperationServiceServer<T>
|
|
where
|
|
T: ValidatorOperationService,
|
|
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() {
|
|
"/validator.ValidatorOperationService/Success" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SuccessSvc<T: ValidatorOperationService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorOperationService,
|
|
> tonic::server::UnaryService<super::OperationSuccessRequest>
|
|
for SuccessSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::OperationSuccessRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorOperationService>::success(&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 = SuccessSvc(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)
|
|
}
|
|
"/validator.ValidatorOperationService/Fail" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct FailSvc<T: ValidatorOperationService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorOperationService,
|
|
> tonic::server::UnaryService<super::OperationFailRequest>
|
|
for FailSvc<T> {
|
|
type Response = super::NullResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::OperationFailRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorOperationService>::fail(&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 = FailSvc(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 ValidatorOperationServiceServer<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,
|
|
}
|
|
}
|
|
}
|
|
/// Generated gRPC service name
|
|
pub const SERVICE_NAME: &str = "validator.ValidatorOperationService";
|
|
impl<T> tonic::server::NamedService for ValidatorOperationServiceServer<T> {
|
|
const NAME: &'static str = SERVICE_NAME;
|
|
}
|
|
}
|
|
/// Generated client implementations.
|
|
pub mod validator_script_service_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 ValidatorScriptServiceClient<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl ValidatorScriptServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
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> ValidatorScriptServiceClient<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,
|
|
) -> ValidatorScriptServiceClient<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,
|
|
{
|
|
ValidatorScriptServiceClient::new(
|
|
InterceptedService::new(inner, interceptor),
|
|
)
|
|
}
|
|
/// Compress requests with the given encoding.
|
|
///
|
|
/// This requires the server to support it otherwise it might respond with an
|
|
/// error.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.send_compressed(encoding);
|
|
self
|
|
}
|
|
/// Enable decompressing responses.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.accept_compressed(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_decoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ScriptCreate>,
|
|
) -> std::result::Result<tonic::Response<super::ScriptId>, 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(
|
|
"/validator.ValidatorScriptService/Create",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("validator.ValidatorScriptService", "Create"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn get(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ScriptId>,
|
|
) -> std::result::Result<tonic::Response<super::Script>, 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(
|
|
"/validator.ValidatorScriptService/Get",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("validator.ValidatorScriptService", "Get"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn list(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ScriptListRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ScriptListResponse>,
|
|
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(
|
|
"/validator.ValidatorScriptService/List",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("validator.ValidatorScriptService", "List"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
}
|
|
}
|
|
/// Generated server implementations.
|
|
pub mod validator_script_service_server {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
/// Generated trait containing gRPC methods that should be implemented for use with ValidatorScriptServiceServer.
|
|
#[async_trait]
|
|
pub trait ValidatorScriptService: std::marker::Send + std::marker::Sync + 'static {
|
|
async fn create(
|
|
&self,
|
|
request: tonic::Request<super::ScriptCreate>,
|
|
) -> std::result::Result<tonic::Response<super::ScriptId>, tonic::Status>;
|
|
async fn get(
|
|
&self,
|
|
request: tonic::Request<super::ScriptId>,
|
|
) -> std::result::Result<tonic::Response<super::Script>, tonic::Status>;
|
|
async fn list(
|
|
&self,
|
|
request: tonic::Request<super::ScriptListRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ScriptListResponse>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct ValidatorScriptServiceServer<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> ValidatorScriptServiceServer<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)
|
|
}
|
|
/// Enable decompressing requests with the given encoding.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.accept_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Compress responses with the given encoding, if the client supports it.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.send_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.max_decoding_message_size = Some(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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 ValidatorScriptServiceServer<T>
|
|
where
|
|
T: ValidatorScriptService,
|
|
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() {
|
|
"/validator.ValidatorScriptService/Create" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CreateSvc<T: ValidatorScriptService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorScriptService,
|
|
> tonic::server::UnaryService<super::ScriptCreate> for CreateSvc<T> {
|
|
type Response = super::ScriptId;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ScriptCreate>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorScriptService>::create(&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 = CreateSvc(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)
|
|
}
|
|
"/validator.ValidatorScriptService/Get" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetSvc<T: ValidatorScriptService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorScriptService,
|
|
> tonic::server::UnaryService<super::ScriptId> for GetSvc<T> {
|
|
type Response = super::Script;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ScriptId>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorScriptService>::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)
|
|
}
|
|
"/validator.ValidatorScriptService/List" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListSvc<T: ValidatorScriptService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorScriptService,
|
|
> tonic::server::UnaryService<super::ScriptListRequest>
|
|
for ListSvc<T> {
|
|
type Response = super::ScriptListResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ScriptListRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorScriptService>::list(&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 = ListSvc(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 ValidatorScriptServiceServer<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,
|
|
}
|
|
}
|
|
}
|
|
/// Generated gRPC service name
|
|
pub const SERVICE_NAME: &str = "validator.ValidatorScriptService";
|
|
impl<T> tonic::server::NamedService for ValidatorScriptServiceServer<T> {
|
|
const NAME: &'static str = SERVICE_NAME;
|
|
}
|
|
}
|
|
/// Generated client implementations.
|
|
pub mod validator_script_policy_service_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 ValidatorScriptPolicyServiceClient<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl ValidatorScriptPolicyServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
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> ValidatorScriptPolicyServiceClient<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,
|
|
) -> ValidatorScriptPolicyServiceClient<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,
|
|
{
|
|
ValidatorScriptPolicyServiceClient::new(
|
|
InterceptedService::new(inner, interceptor),
|
|
)
|
|
}
|
|
/// Compress requests with the given encoding.
|
|
///
|
|
/// This requires the server to support it otherwise it might respond with an
|
|
/// error.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.send_compressed(encoding);
|
|
self
|
|
}
|
|
/// Enable decompressing responses.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.accept_compressed(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_decoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ScriptPolicyCreate>,
|
|
) -> std::result::Result<tonic::Response<super::ScriptPolicyId>, 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(
|
|
"/validator.ValidatorScriptPolicyService/Create",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("validator.ValidatorScriptPolicyService", "Create"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn list(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ScriptPolicyListRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ScriptPolicyListResponse>,
|
|
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(
|
|
"/validator.ValidatorScriptPolicyService/List",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("validator.ValidatorScriptPolicyService", "List"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
}
|
|
}
|
|
/// Generated server implementations.
|
|
pub mod validator_script_policy_service_server {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
/// Generated trait containing gRPC methods that should be implemented for use with ValidatorScriptPolicyServiceServer.
|
|
#[async_trait]
|
|
pub trait ValidatorScriptPolicyService: std::marker::Send + std::marker::Sync + 'static {
|
|
async fn create(
|
|
&self,
|
|
request: tonic::Request<super::ScriptPolicyCreate>,
|
|
) -> std::result::Result<tonic::Response<super::ScriptPolicyId>, tonic::Status>;
|
|
async fn list(
|
|
&self,
|
|
request: tonic::Request<super::ScriptPolicyListRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ScriptPolicyListResponse>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct ValidatorScriptPolicyServiceServer<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> ValidatorScriptPolicyServiceServer<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)
|
|
}
|
|
/// Enable decompressing requests with the given encoding.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.accept_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Compress responses with the given encoding, if the client supports it.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.send_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.max_decoding_message_size = Some(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[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 ValidatorScriptPolicyServiceServer<T>
|
|
where
|
|
T: ValidatorScriptPolicyService,
|
|
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() {
|
|
"/validator.ValidatorScriptPolicyService/Create" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CreateSvc<T: ValidatorScriptPolicyService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorScriptPolicyService,
|
|
> tonic::server::UnaryService<super::ScriptPolicyCreate>
|
|
for CreateSvc<T> {
|
|
type Response = super::ScriptPolicyId;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ScriptPolicyCreate>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorScriptPolicyService>::create(&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 = CreateSvc(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)
|
|
}
|
|
"/validator.ValidatorScriptPolicyService/List" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListSvc<T: ValidatorScriptPolicyService>(pub Arc<T>);
|
|
impl<
|
|
T: ValidatorScriptPolicyService,
|
|
> tonic::server::UnaryService<super::ScriptPolicyListRequest>
|
|
for ListSvc<T> {
|
|
type Response = super::ScriptPolicyListResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ScriptPolicyListRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ValidatorScriptPolicyService>::list(&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 = ListSvc(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 ValidatorScriptPolicyServiceServer<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,
|
|
}
|
|
}
|
|
}
|
|
/// Generated gRPC service name
|
|
pub const SERVICE_NAME: &str = "validator.ValidatorScriptPolicyService";
|
|
impl<T> tonic::server::NamedService for ValidatorScriptPolicyServiceServer<T> {
|
|
const NAME: &'static str = SERVICE_NAME;
|
|
}
|
|
}
|