#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlatformInboundInstruction {
#[prost(string, tag = "5")]
pub instruction_id: ::prost::alloc::string::String,
#[prost(oneof = "platform_inbound_instruction::Request", tags = "1, 2, 3, 4, 6")]
pub request: ::core::option::Option<platform_inbound_instruction::Request>,
}
pub mod platform_inbound_instruction {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "1")]
Register(super::ClientIdentification),
#[prost(message, tag = "2")]
EventProcessorInfo(super::EventProcessorInfo),
#[prost(message, tag = "3")]
Heartbeat(super::Heartbeat),
#[prost(message, tag = "4")]
Ack(super::super::common::InstructionAck),
#[prost(message, tag = "6")]
Result(super::super::common::InstructionResult),
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlatformOutboundInstruction {
#[prost(string, tag = "12")]
pub instruction_id: ::prost::alloc::string::String,
#[prost(
oneof = "platform_outbound_instruction::Request",
tags = "1, 3, 4, 5, 6, 7, 8, 9, 10, 11"
)]
pub request: ::core::option::Option<platform_outbound_instruction::Request>,
}
pub mod platform_outbound_instruction {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "1")]
NodeNotification(super::NodeInfo),
#[prost(message, tag = "3")]
RequestReconnect(super::RequestReconnect),
#[prost(message, tag = "4")]
PauseEventProcessor(super::EventProcessorReference),
#[prost(message, tag = "5")]
StartEventProcessor(super::EventProcessorReference),
#[prost(message, tag = "6")]
ReleaseSegment(super::EventProcessorSegmentReference),
#[prost(message, tag = "7")]
RequestEventProcessorInfo(super::EventProcessorReference),
#[prost(message, tag = "8")]
SplitEventProcessorSegment(super::EventProcessorSegmentReference),
#[prost(message, tag = "9")]
MergeEventProcessorSegment(super::EventProcessorSegmentReference),
#[prost(message, tag = "10")]
Heartbeat(super::Heartbeat),
#[prost(message, tag = "11")]
Ack(super::super::common::InstructionAck),
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestReconnect {}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlatformInfo {
#[prost(message, optional, tag = "1")]
pub primary: ::core::option::Option<NodeInfo>,
#[prost(bool, tag = "2")]
pub same_connection: bool,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NodeInfo {
#[prost(string, tag = "1")]
pub host_name: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub grpc_port: i32,
#[prost(int32, tag = "3")]
pub http_port: i32,
#[prost(int32, tag = "4")]
pub version: i32,
#[prost(string, tag = "5")]
pub node_name: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClientIdentification {
#[prost(string, tag = "1")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub component_name: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "3")]
pub tags: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(string, tag = "4")]
pub version: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EventProcessorInfo {
#[prost(string, tag = "1")]
pub processor_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub mode: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub active_threads: i32,
#[prost(bool, tag = "4")]
pub running: bool,
#[prost(bool, tag = "5")]
pub error: bool,
#[prost(message, repeated, tag = "6")]
pub segment_status: ::prost::alloc::vec::Vec<event_processor_info::SegmentStatus>,
#[prost(int32, tag = "7")]
pub available_threads: i32,
#[prost(string, tag = "8")]
pub token_store_identifier: ::prost::alloc::string::String,
}
pub mod event_processor_info {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SegmentStatus {
#[prost(int32, tag = "1")]
pub segment_id: i32,
#[prost(bool, tag = "2")]
pub caught_up: bool,
#[prost(bool, tag = "3")]
pub replaying: bool,
#[prost(int32, tag = "4")]
pub one_part_of: i32,
#[prost(int64, tag = "5")]
pub token_position: i64,
#[prost(string, tag = "6")]
pub error_state: ::prost::alloc::string::String,
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EventProcessorReference {
#[prost(string, tag = "1")]
pub processor_name: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EventProcessorSegmentReference {
#[prost(string, tag = "1")]
pub processor_name: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub segment_identifier: i32,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Heartbeat {}
pub mod platform_service_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 PlatformServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl PlatformServiceClient<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> PlatformServiceClient<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,
) -> PlatformServiceClient<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,
{
PlatformServiceClient::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 get_platform_server(
&mut self,
request: impl tonic::IntoRequest<super::ClientIdentification>,
) -> Result<tonic::Response<super::PlatformInfo>, 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(
"/io.axoniq.axonserver.grpc.control.PlatformService/GetPlatformServer",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn open_stream(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::PlatformInboundInstruction,
>,
) -> Result<
tonic::Response<
tonic::codec::Streaming<super::PlatformOutboundInstruction>,
>,
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(
"/io.axoniq.axonserver.grpc.control.PlatformService/OpenStream",
);
self.inner.streaming(request.into_streaming_request(), path, codec).await
}
}
}
pub mod platform_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait PlatformService: Send + Sync + 'static {
async fn get_platform_server(
&self,
request: tonic::Request<super::ClientIdentification>,
) -> Result<tonic::Response<super::PlatformInfo>, tonic::Status>;
type OpenStreamStream: futures_core::Stream<
Item = Result<super::PlatformOutboundInstruction, tonic::Status>,
>
+ Send
+ 'static;
async fn open_stream(
&self,
request: tonic::Request<tonic::Streaming<super::PlatformInboundInstruction>>,
) -> Result<tonic::Response<Self::OpenStreamStream>, tonic::Status>;
}
#[derive(Debug)]
pub struct PlatformServiceServer<T: PlatformService> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: PlatformService> PlatformServiceServer<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 PlatformServiceServer<T>
where
T: PlatformService,
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() {
"/io.axoniq.axonserver.grpc.control.PlatformService/GetPlatformServer" => {
#[allow(non_camel_case_types)]
struct GetPlatformServerSvc<T: PlatformService>(pub Arc<T>);
impl<
T: PlatformService,
> tonic::server::UnaryService<super::ClientIdentification>
for GetPlatformServerSvc<T> {
type Response = super::PlatformInfo;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ClientIdentification>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).get_platform_server(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 = GetPlatformServerSvc(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)
}
"/io.axoniq.axonserver.grpc.control.PlatformService/OpenStream" => {
#[allow(non_camel_case_types)]
struct OpenStreamSvc<T: PlatformService>(pub Arc<T>);
impl<
T: PlatformService,
> tonic::server::StreamingService<super::PlatformInboundInstruction>
for OpenStreamSvc<T> {
type Response = super::PlatformOutboundInstruction;
type ResponseStream = T::OpenStreamStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::PlatformInboundInstruction>,
>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).open_stream(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 = OpenStreamSvc(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.streaming(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: PlatformService> Clone for PlatformServiceServer<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: PlatformService> 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: PlatformService> tonic::server::NamedService for PlatformServiceServer<T> {
const NAME: &'static str = "io.axoniq.axonserver.grpc.control.PlatformService";
}
}