#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Blob {
#[prost(bytes = "vec", tag = "1")]
pub json: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Ack {
#[prost(string, tag = "1")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StartRequest {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub yaml: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "3")]
pub catalog_json: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "4")]
pub input_json: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StartResponse {
#[prost(string, tag = "1")]
pub run_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SignalRequest {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub run_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub event_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub key: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "6")]
pub payload_json: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CancelRequest {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub run_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InspectRequest {
#[prost(string, tag = "1")]
pub run_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InspectResponse {
#[prost(bytes = "vec", tag = "1")]
pub view_json: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "2")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListResponse {
#[prost(bytes = "vec", tag = "1")]
pub runs_json: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HistoryRequest {
#[prost(string, tag = "1")]
pub run_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HistoryResponse {
#[prost(bytes = "vec", tag = "1")]
pub events_json: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "2")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RegisterRequest {
#[prost(string, tag = "1")]
pub session_id: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub activities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(uint32, tag = "3")]
pub capacity: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ClaimRequest {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub session_id: ::prost::alloc::string::String,
#[prost(uint32, tag = "3")]
pub capacity: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Assignment {
#[prost(string, tag = "1")]
pub run_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub activation_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub activity_name: ::prost::alloc::string::String,
#[prost(uint32, tag = "4")]
pub activity_version: u32,
#[prost(bytes = "vec", tag = "5")]
pub input_json: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "6")]
pub role: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub effect_key: ::prost::alloc::string::String,
#[prost(uint64, tag = "8")]
pub generation: u64,
#[prost(uint64, tag = "9")]
pub revision: u64,
#[prost(uint64, tag = "10")]
pub lease_expiry_ms: u64,
#[prost(uint64, tag = "11")]
pub attempt_deadline_ms: u64,
#[prost(string, tag = "12")]
pub session_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClaimResponse {
#[prost(message, repeated, tag = "1")]
pub assignments: ::prost::alloc::vec::Vec<Assignment>,
#[prost(string, tag = "2")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RenewRequest {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub session_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub activation_id: ::prost::alloc::string::String,
#[prost(uint64, tag = "4")]
pub generation: u64,
#[prost(uint64, tag = "5")]
pub revision: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RenewResponse {
#[prost(uint64, tag = "1")]
pub revision: u64,
#[prost(uint64, tag = "2")]
pub lease_expiry_ms: u64,
#[prost(string, tag = "3")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReportRequest {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub session_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub run_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub activation_id: ::prost::alloc::string::String,
#[prost(uint64, tag = "5")]
pub generation: u64,
#[prost(uint64, tag = "6")]
pub revision: u64,
#[prost(bytes = "vec", tag = "7")]
pub output_json: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReconcileRequest {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub session_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub run_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub activation_id: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub outcome: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "6")]
pub output_json: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag = "7")]
pub generation: u64,
#[prost(uint64, tag = "8")]
pub revision: u64,
}
pub mod raft_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 RaftClient<T> {
inner: tonic::client::Grpc<T>,
}
impl RaftClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> RaftClient<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,
) -> RaftClient<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,
{
RaftClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn append_entries(
&mut self,
request: impl tonic::IntoRequest<super::Blob>,
) -> std::result::Result<tonic::Response<super::Blob>, 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(
"/graphrun.v1.Raft/AppendEntries",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("graphrun.v1.Raft", "AppendEntries"));
self.inner.unary(req, path, codec).await
}
pub async fn vote(
&mut self,
request: impl tonic::IntoRequest<super::Blob>,
) -> std::result::Result<tonic::Response<super::Blob>, 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("/graphrun.v1.Raft/Vote");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("graphrun.v1.Raft", "Vote"));
self.inner.unary(req, path, codec).await
}
pub async fn install_snapshot(
&mut self,
request: impl tonic::IntoRequest<super::Blob>,
) -> std::result::Result<tonic::Response<super::Blob>, 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(
"/graphrun.v1.Raft/InstallSnapshot",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("graphrun.v1.Raft", "InstallSnapshot"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod raft_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Raft: std::marker::Send + std::marker::Sync + 'static {
async fn append_entries(
&self,
request: tonic::Request<super::Blob>,
) -> std::result::Result<tonic::Response<super::Blob>, tonic::Status>;
async fn vote(
&self,
request: tonic::Request<super::Blob>,
) -> std::result::Result<tonic::Response<super::Blob>, tonic::Status>;
async fn install_snapshot(
&self,
request: tonic::Request<super::Blob>,
) -> std::result::Result<tonic::Response<super::Blob>, tonic::Status>;
}
#[derive(Debug)]
pub struct RaftServer<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> RaftServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for RaftServer<T>
where
T: Raft,
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() {
"/graphrun.v1.Raft/AppendEntries" => {
#[allow(non_camel_case_types)]
struct AppendEntriesSvc<T: Raft>(pub Arc<T>);
impl<T: Raft> tonic::server::UnaryService<super::Blob>
for AppendEntriesSvc<T> {
type Response = super::Blob;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Blob>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Raft>::append_entries(&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 = AppendEntriesSvc(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)
}
"/graphrun.v1.Raft/Vote" => {
#[allow(non_camel_case_types)]
struct VoteSvc<T: Raft>(pub Arc<T>);
impl<T: Raft> tonic::server::UnaryService<super::Blob>
for VoteSvc<T> {
type Response = super::Blob;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Blob>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Raft>::vote(&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 = VoteSvc(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)
}
"/graphrun.v1.Raft/InstallSnapshot" => {
#[allow(non_camel_case_types)]
struct InstallSnapshotSvc<T: Raft>(pub Arc<T>);
impl<T: Raft> tonic::server::UnaryService<super::Blob>
for InstallSnapshotSvc<T> {
type Response = super::Blob;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Blob>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Raft>::install_snapshot(&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 = InstallSnapshotSvc(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 RaftServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "graphrun.v1.Raft";
impl<T> tonic::server::NamedService for RaftServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod client_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 ClientClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ClientClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ClientClient<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,
) -> ClientClient<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,
{
ClientClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn start(
&mut self,
request: impl tonic::IntoRequest<super::StartRequest>,
) -> std::result::Result<tonic::Response<super::StartResponse>, 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("/graphrun.v1.Client/Start");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("graphrun.v1.Client", "Start"));
self.inner.unary(req, path, codec).await
}
pub async fn signal(
&mut self,
request: impl tonic::IntoRequest<super::SignalRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, 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(
"/graphrun.v1.Client/Signal",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("graphrun.v1.Client", "Signal"));
self.inner.unary(req, path, codec).await
}
pub async fn cancel(
&mut self,
request: impl tonic::IntoRequest<super::CancelRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, 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(
"/graphrun.v1.Client/Cancel",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("graphrun.v1.Client", "Cancel"));
self.inner.unary(req, path, codec).await
}
pub async fn inspect(
&mut self,
request: impl tonic::IntoRequest<super::InspectRequest>,
) -> std::result::Result<
tonic::Response<super::InspectResponse>,
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(
"/graphrun.v1.Client/Inspect",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("graphrun.v1.Client", "Inspect"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::ListResponse>, 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("/graphrun.v1.Client/List");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("graphrun.v1.Client", "List"));
self.inner.unary(req, path, codec).await
}
pub async fn history(
&mut self,
request: impl tonic::IntoRequest<super::HistoryRequest>,
) -> std::result::Result<
tonic::Response<super::HistoryResponse>,
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(
"/graphrun.v1.Client/History",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("graphrun.v1.Client", "History"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod client_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Client: std::marker::Send + std::marker::Sync + 'static {
async fn start(
&self,
request: tonic::Request<super::StartRequest>,
) -> std::result::Result<tonic::Response<super::StartResponse>, tonic::Status>;
async fn signal(
&self,
request: tonic::Request<super::SignalRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, tonic::Status>;
async fn cancel(
&self,
request: tonic::Request<super::CancelRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, tonic::Status>;
async fn inspect(
&self,
request: tonic::Request<super::InspectRequest>,
) -> std::result::Result<tonic::Response<super::InspectResponse>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::ListResponse>, tonic::Status>;
async fn history(
&self,
request: tonic::Request<super::HistoryRequest>,
) -> std::result::Result<tonic::Response<super::HistoryResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct ClientServer<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> ClientServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for ClientServer<T>
where
T: Client,
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() {
"/graphrun.v1.Client/Start" => {
#[allow(non_camel_case_types)]
struct StartSvc<T: Client>(pub Arc<T>);
impl<T: Client> tonic::server::UnaryService<super::StartRequest>
for StartSvc<T> {
type Response = super::StartResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::StartRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Client>::start(&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 = StartSvc(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)
}
"/graphrun.v1.Client/Signal" => {
#[allow(non_camel_case_types)]
struct SignalSvc<T: Client>(pub Arc<T>);
impl<T: Client> tonic::server::UnaryService<super::SignalRequest>
for SignalSvc<T> {
type Response = super::Ack;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SignalRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Client>::signal(&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 = SignalSvc(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)
}
"/graphrun.v1.Client/Cancel" => {
#[allow(non_camel_case_types)]
struct CancelSvc<T: Client>(pub Arc<T>);
impl<T: Client> tonic::server::UnaryService<super::CancelRequest>
for CancelSvc<T> {
type Response = super::Ack;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CancelRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Client>::cancel(&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 = CancelSvc(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)
}
"/graphrun.v1.Client/Inspect" => {
#[allow(non_camel_case_types)]
struct InspectSvc<T: Client>(pub Arc<T>);
impl<T: Client> tonic::server::UnaryService<super::InspectRequest>
for InspectSvc<T> {
type Response = super::InspectResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::InspectRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Client>::inspect(&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 = InspectSvc(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)
}
"/graphrun.v1.Client/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: Client>(pub Arc<T>);
impl<T: Client> tonic::server::UnaryService<super::ListRequest>
for ListSvc<T> {
type Response = super::ListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Client>::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)
}
"/graphrun.v1.Client/History" => {
#[allow(non_camel_case_types)]
struct HistorySvc<T: Client>(pub Arc<T>);
impl<T: Client> tonic::server::UnaryService<super::HistoryRequest>
for HistorySvc<T> {
type Response = super::HistoryResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::HistoryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Client>::history(&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 = HistorySvc(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 ClientServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "graphrun.v1.Client";
impl<T> tonic::server::NamedService for ClientServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod worker_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 WorkerClient<T> {
inner: tonic::client::Grpc<T>,
}
impl WorkerClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> WorkerClient<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,
) -> WorkerClient<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,
{
WorkerClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn register(
&mut self,
request: impl tonic::IntoRequest<super::RegisterRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, 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(
"/graphrun.v1.Worker/Register",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("graphrun.v1.Worker", "Register"));
self.inner.unary(req, path, codec).await
}
pub async fn claim(
&mut self,
request: impl tonic::IntoRequest<super::ClaimRequest>,
) -> std::result::Result<tonic::Response<super::ClaimResponse>, 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("/graphrun.v1.Worker/Claim");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("graphrun.v1.Worker", "Claim"));
self.inner.unary(req, path, codec).await
}
pub async fn renew(
&mut self,
request: impl tonic::IntoRequest<super::RenewRequest>,
) -> std::result::Result<tonic::Response<super::RenewResponse>, 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("/graphrun.v1.Worker/Renew");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("graphrun.v1.Worker", "Renew"));
self.inner.unary(req, path, codec).await
}
pub async fn report(
&mut self,
request: impl tonic::IntoRequest<super::ReportRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, 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(
"/graphrun.v1.Worker/Report",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("graphrun.v1.Worker", "Report"));
self.inner.unary(req, path, codec).await
}
pub async fn reconcile(
&mut self,
request: impl tonic::IntoRequest<super::ReconcileRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, 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(
"/graphrun.v1.Worker/Reconcile",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("graphrun.v1.Worker", "Reconcile"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod worker_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Worker: std::marker::Send + std::marker::Sync + 'static {
async fn register(
&self,
request: tonic::Request<super::RegisterRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, tonic::Status>;
async fn claim(
&self,
request: tonic::Request<super::ClaimRequest>,
) -> std::result::Result<tonic::Response<super::ClaimResponse>, tonic::Status>;
async fn renew(
&self,
request: tonic::Request<super::RenewRequest>,
) -> std::result::Result<tonic::Response<super::RenewResponse>, tonic::Status>;
async fn report(
&self,
request: tonic::Request<super::ReportRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, tonic::Status>;
async fn reconcile(
&self,
request: tonic::Request<super::ReconcileRequest>,
) -> std::result::Result<tonic::Response<super::Ack>, tonic::Status>;
}
#[derive(Debug)]
pub struct WorkerServer<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> WorkerServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for WorkerServer<T>
where
T: Worker,
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() {
"/graphrun.v1.Worker/Register" => {
#[allow(non_camel_case_types)]
struct RegisterSvc<T: Worker>(pub Arc<T>);
impl<T: Worker> tonic::server::UnaryService<super::RegisterRequest>
for RegisterSvc<T> {
type Response = super::Ack;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RegisterRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Worker>::register(&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 = RegisterSvc(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)
}
"/graphrun.v1.Worker/Claim" => {
#[allow(non_camel_case_types)]
struct ClaimSvc<T: Worker>(pub Arc<T>);
impl<T: Worker> tonic::server::UnaryService<super::ClaimRequest>
for ClaimSvc<T> {
type Response = super::ClaimResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ClaimRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Worker>::claim(&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 = ClaimSvc(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)
}
"/graphrun.v1.Worker/Renew" => {
#[allow(non_camel_case_types)]
struct RenewSvc<T: Worker>(pub Arc<T>);
impl<T: Worker> tonic::server::UnaryService<super::RenewRequest>
for RenewSvc<T> {
type Response = super::RenewResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RenewRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Worker>::renew(&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 = RenewSvc(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)
}
"/graphrun.v1.Worker/Report" => {
#[allow(non_camel_case_types)]
struct ReportSvc<T: Worker>(pub Arc<T>);
impl<T: Worker> tonic::server::UnaryService<super::ReportRequest>
for ReportSvc<T> {
type Response = super::Ack;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReportRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Worker>::report(&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 = ReportSvc(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)
}
"/graphrun.v1.Worker/Reconcile" => {
#[allow(non_camel_case_types)]
struct ReconcileSvc<T: Worker>(pub Arc<T>);
impl<T: Worker> tonic::server::UnaryService<super::ReconcileRequest>
for ReconcileSvc<T> {
type Response = super::Ack;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReconcileRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Worker>::reconcile(&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 = ReconcileSvc(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 WorkerServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "graphrun.v1.Worker";
impl<T> tonic::server::NamedService for WorkerServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}