#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PushTaskExecutionDataRequest {
#[prost(string, tag = "1")]
pub channel: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub task_execution_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub data: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PushTaskExecutionDataResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PopTaskExecutionDataRequest {
#[prost(string, tag = "1")]
pub channel: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PopTaskExecutionDataResponse {
#[prost(string, tag = "1")]
pub task_execution_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub data: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskExecutionUpdate {
#[prost(string, tag = "1")]
pub execution_id: ::prost::alloc::string::String,
#[prost(enumeration = "TaskExecutionRecordStatus", tag = "2")]
pub status: i32,
#[prost(string, tag = "3")]
pub result: ::prost::alloc::string::String,
#[prost(bool, tag = "4")]
pub is_complete: bool,
#[prost(uint64, tag = "5")]
pub duration_seconds: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateTaskExecutionResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetUpdatesChannelRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetUpdatesChannelResponse {
#[prost(string, tag = "1")]
pub channel: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TaskExecutionRecordStatus {
Unknown = 0,
Initialized = 1,
Queued = 2,
Running = 3,
Success = 4,
Failure = 5,
Cancelled = 6,
}
impl TaskExecutionRecordStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
TaskExecutionRecordStatus::Unknown => "UNKNOWN",
TaskExecutionRecordStatus::Initialized => "INITIALIZED",
TaskExecutionRecordStatus::Queued => "QUEUED",
TaskExecutionRecordStatus::Running => "RUNNING",
TaskExecutionRecordStatus::Success => "SUCCESS",
TaskExecutionRecordStatus::Failure => "FAILURE",
TaskExecutionRecordStatus::Cancelled => "CANCELLED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"INITIALIZED" => Some(Self::Initialized),
"QUEUED" => Some(Self::Queued),
"RUNNING" => Some(Self::Running),
"SUCCESS" => Some(Self::Success),
"FAILURE" => Some(Self::Failure),
"CANCELLED" => Some(Self::Cancelled),
_ => None,
}
}
}
pub mod broker_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct BrokerClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BrokerClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> BrokerClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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,
) -> BrokerClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
BrokerClient::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
}
pub async fn push_task_execution_data(
&mut self,
request: impl tonic::IntoRequest<super::PushTaskExecutionDataRequest>,
) -> Result<
tonic::Response<super::PushTaskExecutionDataResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/broker.Broker/PushTaskExecutionData",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn pop_task_execution_data(
&mut self,
request: impl tonic::IntoRequest<super::PopTaskExecutionDataRequest>,
) -> Result<
tonic::Response<super::PopTaskExecutionDataResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/broker.Broker/PopTaskExecutionData",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn push_task_execution_update(
&mut self,
request: impl tonic::IntoRequest<super::TaskExecutionUpdate>,
) -> Result<tonic::Response<super::UpdateTaskExecutionResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/broker.Broker/PushTaskExecutionUpdate",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn pop_task_execution_update(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> Result<tonic::Response<super::TaskExecutionUpdate>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/broker.Broker/PopTaskExecutionUpdate",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_updates_channel(
&mut self,
request: impl tonic::IntoRequest<super::GetUpdatesChannelRequest>,
) -> Result<tonic::Response<super::GetUpdatesChannelResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/broker.Broker/GetUpdatesChannel",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
pub mod broker_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait Broker: Send + Sync + 'static {
async fn push_task_execution_data(
&self,
request: tonic::Request<super::PushTaskExecutionDataRequest>,
) -> Result<
tonic::Response<super::PushTaskExecutionDataResponse>,
tonic::Status,
>;
async fn pop_task_execution_data(
&self,
request: tonic::Request<super::PopTaskExecutionDataRequest>,
) -> Result<tonic::Response<super::PopTaskExecutionDataResponse>, tonic::Status>;
async fn push_task_execution_update(
&self,
request: tonic::Request<super::TaskExecutionUpdate>,
) -> Result<tonic::Response<super::UpdateTaskExecutionResponse>, tonic::Status>;
async fn pop_task_execution_update(
&self,
request: tonic::Request<()>,
) -> Result<tonic::Response<super::TaskExecutionUpdate>, tonic::Status>;
async fn get_updates_channel(
&self,
request: tonic::Request<super::GetUpdatesChannelRequest>,
) -> Result<tonic::Response<super::GetUpdatesChannelResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct BrokerServer<T: Broker> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: Broker> BrokerServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
}
}
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
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for BrokerServer<T>
where
T: Broker,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/broker.Broker/PushTaskExecutionData" => {
#[allow(non_camel_case_types)]
struct PushTaskExecutionDataSvc<T: Broker>(pub Arc<T>);
impl<
T: Broker,
> tonic::server::UnaryService<super::PushTaskExecutionDataRequest>
for PushTaskExecutionDataSvc<T> {
type Response = super::PushTaskExecutionDataResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PushTaskExecutionDataRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).push_task_execution_data(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = PushTaskExecutionDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/broker.Broker/PopTaskExecutionData" => {
#[allow(non_camel_case_types)]
struct PopTaskExecutionDataSvc<T: Broker>(pub Arc<T>);
impl<
T: Broker,
> tonic::server::UnaryService<super::PopTaskExecutionDataRequest>
for PopTaskExecutionDataSvc<T> {
type Response = super::PopTaskExecutionDataResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PopTaskExecutionDataRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).pop_task_execution_data(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = PopTaskExecutionDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/broker.Broker/PushTaskExecutionUpdate" => {
#[allow(non_camel_case_types)]
struct PushTaskExecutionUpdateSvc<T: Broker>(pub Arc<T>);
impl<
T: Broker,
> tonic::server::UnaryService<super::TaskExecutionUpdate>
for PushTaskExecutionUpdateSvc<T> {
type Response = super::UpdateTaskExecutionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TaskExecutionUpdate>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).push_task_execution_update(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = PushTaskExecutionUpdateSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/broker.Broker/PopTaskExecutionUpdate" => {
#[allow(non_camel_case_types)]
struct PopTaskExecutionUpdateSvc<T: Broker>(pub Arc<T>);
impl<T: Broker> tonic::server::UnaryService<()>
for PopTaskExecutionUpdateSvc<T> {
type Response = super::TaskExecutionUpdate;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).pop_task_execution_update(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = PopTaskExecutionUpdateSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/broker.Broker/GetUpdatesChannel" => {
#[allow(non_camel_case_types)]
struct GetUpdatesChannelSvc<T: Broker>(pub Arc<T>);
impl<
T: Broker,
> tonic::server::UnaryService<super::GetUpdatesChannelRequest>
for GetUpdatesChannelSvc<T> {
type Response = super::GetUpdatesChannelResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetUpdatesChannelRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).get_updates_channel(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = GetUpdatesChannelSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: Broker> Clone for BrokerServer<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,
}
}
}
impl<T: Broker> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Broker> tonic::server::NamedService for BrokerServer<T> {
const NAME: &'static str = "broker.Broker";
}
}