#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamIn {
#[prost(oneof = "stream_in::Message", tags = "1, 2, 3")]
pub message: ::core::option::Option<stream_in::Message>,
}
pub mod stream_in {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Message {
#[prost(message, tag = "1")]
Init(super::InitReq),
#[prost(message, tag = "2")]
Filter(super::FilterReq),
#[prost(message, tag = "3")]
Replay(super::ReplayReq),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitReq {
#[prost(string, tag = "1")]
pub stream_id: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub slice_min: i32,
#[prost(int32, tag = "3")]
pub slice_max: i32,
#[prost(message, optional, tag = "4")]
pub offset: ::core::option::Option<Offset>,
#[prost(message, repeated, tag = "5")]
pub filter: ::prost::alloc::vec::Vec<FilterCriteria>,
#[prost(message, optional, tag = "6")]
pub replica_info: ::core::option::Option<ReplicaInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FilterReq {
#[prost(message, repeated, tag = "1")]
pub criteria: ::prost::alloc::vec::Vec<FilterCriteria>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReplayReq {
#[prost(message, repeated, tag = "1")]
pub persistence_id_offset: ::prost::alloc::vec::Vec<PersistenceIdSeqNr>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FilterCriteria {
#[prost(
oneof = "filter_criteria::Message",
tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14"
)]
pub message: ::core::option::Option<filter_criteria::Message>,
}
pub mod filter_criteria {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Message {
#[prost(message, tag = "1")]
ExcludeTags(super::ExcludeTags),
#[prost(message, tag = "2")]
RemoveExcludeTags(super::RemoveExcludeTags),
#[prost(message, tag = "3")]
IncludeTags(super::IncludeTags),
#[prost(message, tag = "4")]
RemoveIncludeTags(super::RemoveIncludeTags),
#[prost(message, tag = "5")]
ExcludeMatchingEntityIds(super::ExcludeRegexEntityIds),
#[prost(message, tag = "6")]
RemoveExcludeMatchingEntityIds(super::RemoveExcludeRegexEntityIds),
#[prost(message, tag = "7")]
IncludeMatchingEntityIds(super::IncludeRegexEntityIds),
#[prost(message, tag = "8")]
RemoveIncludeMatchingEntityIds(super::RemoveIncludeRegexEntityIds),
#[prost(message, tag = "9")]
ExcludeEntityIds(super::ExcludeEntityIds),
#[prost(message, tag = "10")]
RemoveExcludeEntityIds(super::RemoveExcludeEntityIds),
#[prost(message, tag = "11")]
IncludeEntityIds(super::IncludeEntityIds),
#[prost(message, tag = "12")]
RemoveIncludeEntityIds(super::RemoveIncludeEntityIds),
#[prost(message, tag = "13")]
IncludeTopics(super::IncludeTopics),
#[prost(message, tag = "14")]
RemoveIncludeTopics(super::RemoveIncludeTopics),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExcludeTags {
#[prost(string, repeated, tag = "1")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveExcludeTags {
#[prost(string, repeated, tag = "1")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IncludeTags {
#[prost(string, repeated, tag = "1")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveIncludeTags {
#[prost(string, repeated, tag = "1")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IncludeEntityIds {
#[prost(message, repeated, tag = "1")]
pub entity_id_offset: ::prost::alloc::vec::Vec<EntityIdOffset>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EntityIdOffset {
#[prost(string, tag = "1")]
pub entity_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub seq_nr: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveIncludeEntityIds {
#[prost(string, repeated, tag = "1")]
pub entity_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExcludeEntityIds {
#[prost(string, repeated, tag = "1")]
pub entity_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveExcludeEntityIds {
#[prost(string, repeated, tag = "1")]
pub entity_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExcludeRegexEntityIds {
#[prost(string, repeated, tag = "1")]
pub matching: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveExcludeRegexEntityIds {
#[prost(string, repeated, tag = "1")]
pub matching: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IncludeRegexEntityIds {
#[prost(string, repeated, tag = "1")]
pub matching: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveIncludeRegexEntityIds {
#[prost(string, repeated, tag = "1")]
pub matching: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IncludeTopics {
#[prost(string, repeated, tag = "1")]
pub expression: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveIncludeTopics {
#[prost(string, repeated, tag = "1")]
pub expression: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Offset {
#[prost(message, optional, tag = "1")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, repeated, tag = "2")]
pub seen: ::prost::alloc::vec::Vec<PersistenceIdSeqNr>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PersistenceIdSeqNr {
#[prost(string, tag = "1")]
pub persistence_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub seq_nr: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReplicaInfo {
#[prost(string, tag = "1")]
pub replica_id: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub other_replica_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamOut {
#[prost(oneof = "stream_out::Message", tags = "1, 2")]
pub message: ::core::option::Option<stream_out::Message>,
}
pub mod stream_out {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Message {
#[prost(message, tag = "1")]
Event(super::Event),
#[prost(message, tag = "2")]
FilteredEvent(super::FilteredEvent),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Event {
#[prost(string, tag = "1")]
pub persistence_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub seq_nr: i64,
#[prost(int32, tag = "3")]
pub slice: i32,
#[prost(message, optional, tag = "4")]
pub offset: ::core::option::Option<Offset>,
#[prost(message, optional, tag = "5")]
pub payload: ::core::option::Option<::prost_types::Any>,
#[prost(string, tag = "6")]
pub source: ::prost::alloc::string::String,
#[prost(message, optional, tag = "7")]
pub metadata: ::core::option::Option<::prost_types::Any>,
#[prost(string, repeated, tag = "8")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FilteredEvent {
#[prost(string, tag = "1")]
pub persistence_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub seq_nr: i64,
#[prost(int32, tag = "3")]
pub slice: i32,
#[prost(message, optional, tag = "4")]
pub offset: ::core::option::Option<Offset>,
#[prost(string, tag = "5")]
pub source: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EventTimestampRequest {
#[prost(string, tag = "1")]
pub stream_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub persistence_id: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub seq_nr: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EventTimestampResponse {
#[prost(message, optional, tag = "1")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoadEventRequest {
#[prost(string, tag = "1")]
pub stream_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub persistence_id: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub seq_nr: i64,
#[prost(message, optional, tag = "4")]
pub replica_info: ::core::option::Option<ReplicaInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoadEventResponse {
#[prost(oneof = "load_event_response::Message", tags = "1, 2")]
pub message: ::core::option::Option<load_event_response::Message>,
}
pub mod load_event_response {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Message {
#[prost(message, tag = "1")]
Event(super::Event),
#[prost(message, tag = "2")]
FilteredEvent(super::FilteredEvent),
}
}
pub mod event_producer_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 EventProducerServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl EventProducerServiceClient<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> EventProducerServiceClient<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,
) -> EventProducerServiceClient<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,
{
EventProducerServiceClient::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 events_by_slices(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::StreamIn>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::StreamOut>>,
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(
"/akka.projection.grpc.EventProducerService/EventsBySlices",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"akka.projection.grpc.EventProducerService",
"EventsBySlices",
),
);
self.inner.streaming(req, path, codec).await
}
pub async fn event_timestamp(
&mut self,
request: impl tonic::IntoRequest<super::EventTimestampRequest>,
) -> std::result::Result<
tonic::Response<super::EventTimestampResponse>,
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(
"/akka.projection.grpc.EventProducerService/EventTimestamp",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"akka.projection.grpc.EventProducerService",
"EventTimestamp",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn load_event(
&mut self,
request: impl tonic::IntoRequest<super::LoadEventRequest>,
) -> std::result::Result<
tonic::Response<super::LoadEventResponse>,
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(
"/akka.projection.grpc.EventProducerService/LoadEvent",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"akka.projection.grpc.EventProducerService",
"LoadEvent",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod event_producer_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait EventProducerService: Send + Sync + 'static {
type EventsBySlicesStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::StreamOut, tonic::Status>,
>
+ Send
+ 'static;
async fn events_by_slices(
&self,
request: tonic::Request<tonic::Streaming<super::StreamIn>>,
) -> std::result::Result<
tonic::Response<Self::EventsBySlicesStream>,
tonic::Status,
>;
async fn event_timestamp(
&self,
request: tonic::Request<super::EventTimestampRequest>,
) -> std::result::Result<
tonic::Response<super::EventTimestampResponse>,
tonic::Status,
>;
async fn load_event(
&self,
request: tonic::Request<super::LoadEventRequest>,
) -> std::result::Result<
tonic::Response<super::LoadEventResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct EventProducerServiceServer<T: EventProducerService> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
struct _Inner<T>(Arc<T>);
impl<T: EventProducerService> EventProducerServiceServer<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(),
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 EventProducerServiceServer<T>
where
T: EventProducerService,
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<std::result::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() {
"/akka.projection.grpc.EventProducerService/EventsBySlices" => {
#[allow(non_camel_case_types)]
struct EventsBySlicesSvc<T: EventProducerService>(pub Arc<T>);
impl<
T: EventProducerService,
> tonic::server::StreamingService<super::StreamIn>
for EventsBySlicesSvc<T> {
type Response = super::StreamOut;
type ResponseStream = T::EventsBySlicesStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<tonic::Streaming<super::StreamIn>>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EventProducerService>::events_by_slices(
&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 inner = inner.0;
let method = EventsBySlicesSvc(inner);
let codec = tonic::codec::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.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/akka.projection.grpc.EventProducerService/EventTimestamp" => {
#[allow(non_camel_case_types)]
struct EventTimestampSvc<T: EventProducerService>(pub Arc<T>);
impl<
T: EventProducerService,
> tonic::server::UnaryService<super::EventTimestampRequest>
for EventTimestampSvc<T> {
type Response = super::EventTimestampResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::EventTimestampRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EventProducerService>::event_timestamp(
&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 inner = inner.0;
let method = EventTimestampSvc(inner);
let codec = tonic::codec::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)
}
"/akka.projection.grpc.EventProducerService/LoadEvent" => {
#[allow(non_camel_case_types)]
struct LoadEventSvc<T: EventProducerService>(pub Arc<T>);
impl<
T: EventProducerService,
> tonic::server::UnaryService<super::LoadEventRequest>
for LoadEventSvc<T> {
type Response = super::LoadEventResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LoadEventRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EventProducerService>::load_event(&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 inner = inner.0;
let method = LoadEventSvc(inner);
let codec = tonic::codec::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 {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: EventProducerService> Clone for EventProducerServiceServer<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,
}
}
}
impl<T: EventProducerService> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(Arc::clone(&self.0))
}
}
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: EventProducerService> tonic::server::NamedService
for EventProducerServiceServer<T> {
const NAME: &'static str = "akka.projection.grpc.EventProducerService";
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConsumeEventOut {
#[prost(oneof = "consume_event_out::Message", tags = "1, 2")]
pub message: ::core::option::Option<consume_event_out::Message>,
}
pub mod consume_event_out {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Message {
#[prost(message, tag = "1")]
Start(super::ConsumerEventStart),
#[prost(message, tag = "2")]
Ack(super::ConsumerEventAck),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConsumerEventAck {
#[prost(string, tag = "1")]
pub persistence_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub seq_nr: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConsumeEventIn {
#[prost(oneof = "consume_event_in::Message", tags = "1, 2, 3, 4")]
pub message: ::core::option::Option<consume_event_in::Message>,
}
pub mod consume_event_in {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Message {
#[prost(message, tag = "1")]
Init(super::ConsumerEventInit),
#[prost(message, tag = "2")]
Event(super::Event),
#[prost(message, tag = "3")]
FilteredEvent(super::FilteredEvent),
#[prost(message, tag = "4")]
KeepAlive(super::KeepAlive),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConsumerEventInit {
#[prost(string, tag = "1")]
pub origin_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub stream_id: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub fill_sequence_number_gaps: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConsumerEventStart {
#[prost(message, repeated, tag = "1")]
pub filter: ::prost::alloc::vec::Vec<FilterCriteria>,
#[prost(message, optional, tag = "2")]
pub replica_info: ::core::option::Option<ReplicaInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeepAlive {}
pub mod event_consumer_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 EventConsumerServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl EventConsumerServiceClient<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> EventConsumerServiceClient<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,
) -> EventConsumerServiceClient<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,
{
EventConsumerServiceClient::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 consume_event(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::ConsumeEventIn>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::ConsumeEventOut>>,
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(
"/akka.projection.grpc.EventConsumerService/ConsumeEvent",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"akka.projection.grpc.EventConsumerService",
"ConsumeEvent",
),
);
self.inner.streaming(req, path, codec).await
}
}
}
pub mod event_consumer_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait EventConsumerService: Send + Sync + 'static {
type ConsumeEventStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::ConsumeEventOut, tonic::Status>,
>
+ Send
+ 'static;
async fn consume_event(
&self,
request: tonic::Request<tonic::Streaming<super::ConsumeEventIn>>,
) -> std::result::Result<
tonic::Response<Self::ConsumeEventStream>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct EventConsumerServiceServer<T: EventConsumerService> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
struct _Inner<T>(Arc<T>);
impl<T: EventConsumerService> EventConsumerServiceServer<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(),
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 EventConsumerServiceServer<T>
where
T: EventConsumerService,
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<std::result::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() {
"/akka.projection.grpc.EventConsumerService/ConsumeEvent" => {
#[allow(non_camel_case_types)]
struct ConsumeEventSvc<T: EventConsumerService>(pub Arc<T>);
impl<
T: EventConsumerService,
> tonic::server::StreamingService<super::ConsumeEventIn>
for ConsumeEventSvc<T> {
type Response = super::ConsumeEventOut;
type ResponseStream = T::ConsumeEventStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::ConsumeEventIn>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EventConsumerService>::consume_event(&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 inner = inner.0;
let method = ConsumeEventSvc(inner);
let codec = tonic::codec::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.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: EventConsumerService> Clone for EventConsumerServiceServer<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,
}
}
}
impl<T: EventConsumerService> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(Arc::clone(&self.0))
}
}
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: EventConsumerService> tonic::server::NamedService
for EventConsumerServiceServer<T> {
const NAME: &'static str = "akka.projection.grpc.EventConsumerService";
}
}