#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableSchema {
#[prost(message, repeated, tag = "1")]
pub columns: ::prost::alloc::vec::Vec<super::plan_common::ColumnDesc>,
#[prost(uint32, repeated, tag = "2")]
pub pk_indices: ::prost::alloc::vec::Vec<u32>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ValidationError {
#[prost(string, tag = "1")]
pub error_message: ::prost::alloc::string::String,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SinkParam {
#[prost(uint32, tag = "1")]
pub sink_id: u32,
#[prost(btree_map = "string, string", tag = "2")]
pub properties: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(message, optional, tag = "3")]
pub table_schema: ::core::option::Option<TableSchema>,
#[prost(enumeration = "super::catalog::SinkType", tag = "4")]
pub sink_type: i32,
#[prost(string, tag = "5")]
pub db_name: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub sink_from_name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "7")]
pub format_desc: ::core::option::Option<super::catalog::SinkFormatDesc>,
#[prost(string, tag = "8")]
pub sink_name: ::prost::alloc::string::String,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SinkWriterStreamRequest {
#[prost(oneof = "sink_writer_stream_request::Request", tags = "1, 3, 4")]
pub request: ::core::option::Option<sink_writer_stream_request::Request>,
}
pub mod sink_writer_stream_request {
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StartSink {
#[prost(message, optional, tag = "1")]
pub sink_param: ::core::option::Option<super::SinkParam>,
#[prost(message, optional, tag = "3")]
pub payload_schema: ::core::option::Option<super::TableSchema>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteBatch {
#[prost(uint64, tag = "3")]
pub batch_id: u64,
#[prost(uint64, tag = "4")]
pub epoch: u64,
#[prost(oneof = "write_batch::Payload", tags = "2, 5")]
pub payload: ::core::option::Option<write_batch::Payload>,
}
pub mod write_batch {
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamChunkPayload {
#[prost(bytes = "vec", tag = "1")]
pub binary_data: ::prost::alloc::vec::Vec<u8>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "2")]
StreamChunkPayload(StreamChunkPayload),
#[prost(int64, tag = "5")]
StreamChunkRefPointer(i64),
}
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Barrier {
#[prost(uint64, tag = "1")]
pub epoch: u64,
#[prost(bool, tag = "2")]
pub is_checkpoint: bool,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "1")]
Start(StartSink),
#[prost(message, tag = "3")]
WriteBatch(WriteBatch),
#[prost(message, tag = "4")]
Barrier(Barrier),
}
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SinkWriterStreamResponse {
#[prost(oneof = "sink_writer_stream_response::Response", tags = "1, 2, 3")]
pub response: ::core::option::Option<sink_writer_stream_response::Response>,
}
pub mod sink_writer_stream_response {
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StartResponse {}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitResponse {
#[prost(uint64, tag = "1")]
pub epoch: u64,
#[prost(message, optional, tag = "2")]
pub metadata: ::core::option::Option<super::SinkMetadata>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct BatchWrittenResponse {
#[prost(uint64, tag = "1")]
pub epoch: u64,
#[prost(uint64, tag = "2")]
pub batch_id: u64,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Start(StartResponse),
#[prost(message, tag = "2")]
Commit(CommitResponse),
#[prost(message, tag = "3")]
Batch(BatchWrittenResponse),
}
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ValidateSinkRequest {
#[prost(message, optional, tag = "1")]
pub sink_param: ::core::option::Option<SinkParam>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ValidateSinkResponse {
#[prost(message, optional, tag = "1")]
pub error: ::core::option::Option<ValidationError>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SinkMetadata {
#[prost(oneof = "sink_metadata::Metadata", tags = "1")]
pub metadata: ::core::option::Option<sink_metadata::Metadata>,
}
pub mod sink_metadata {
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SerializedMetadata {
#[prost(bytes = "vec", tag = "1")]
pub metadata: ::prost::alloc::vec::Vec<u8>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Metadata {
#[prost(message, tag = "1")]
Serialized(SerializedMetadata),
}
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SinkCoordinatorStreamRequest {
#[prost(oneof = "sink_coordinator_stream_request::Request", tags = "1, 2")]
pub request: ::core::option::Option<sink_coordinator_stream_request::Request>,
}
pub mod sink_coordinator_stream_request {
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StartCoordinator {
#[prost(message, optional, tag = "1")]
pub param: ::core::option::Option<super::SinkParam>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitMetadata {
#[prost(uint64, tag = "1")]
pub epoch: u64,
#[prost(message, repeated, tag = "2")]
pub metadata: ::prost::alloc::vec::Vec<super::SinkMetadata>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "1")]
Start(StartCoordinator),
#[prost(message, tag = "2")]
Commit(CommitMetadata),
}
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SinkCoordinatorStreamResponse {
#[prost(oneof = "sink_coordinator_stream_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<sink_coordinator_stream_response::Response>,
}
pub mod sink_coordinator_stream_response {
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StartResponse {}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CommitResponse {
#[prost(uint64, tag = "1")]
pub epoch: u64,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Start(StartResponse),
#[prost(message, tag = "2")]
Commit(CommitResponse),
}
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CdcMessage {
#[prost(string, tag = "1")]
pub payload: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub partition: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub offset: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub full_table_name: ::prost::alloc::string::String,
#[prost(int64, tag = "5")]
pub source_ts_ms: i64,
#[prost(enumeration = "cdc_message::CdcMessageType", tag = "6")]
pub msg_type: i32,
#[prost(string, tag = "7")]
pub key: ::prost::alloc::string::String,
}
pub mod cdc_message {
#[derive(prost_helpers::AnyPB)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum CdcMessageType {
Unspecified = 0,
Heartbeat = 1,
Data = 2,
TransactionMeta = 3,
SchemaChange = 4,
}
impl CdcMessageType {
pub fn as_str_name(&self) -> &'static str {
match self {
CdcMessageType::Unspecified => "UNSPECIFIED",
CdcMessageType::Heartbeat => "HEARTBEAT",
CdcMessageType::Data => "DATA",
CdcMessageType::TransactionMeta => "TRANSACTION_META",
CdcMessageType::SchemaChange => "SCHEMA_CHANGE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNSPECIFIED" => Some(Self::Unspecified),
"HEARTBEAT" => Some(Self::Heartbeat),
"DATA" => Some(Self::Data),
"TRANSACTION_META" => Some(Self::TransactionMeta),
"SCHEMA_CHANGE" => Some(Self::SchemaChange),
_ => None,
}
}
}
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetEventStreamRequest {
#[prost(uint64, tag = "1")]
pub source_id: u64,
#[prost(enumeration = "SourceType", tag = "2")]
pub source_type: i32,
#[prost(string, tag = "3")]
pub start_offset: ::prost::alloc::string::String,
#[prost(btree_map = "string, string", tag = "4")]
pub properties: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(bool, tag = "5")]
pub snapshot_done: bool,
#[prost(bool, tag = "6")]
pub is_source_job: bool,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetEventStreamResponse {
#[prost(uint64, tag = "1")]
pub source_id: u64,
#[prost(message, repeated, tag = "2")]
pub events: ::prost::alloc::vec::Vec<CdcMessage>,
#[prost(message, optional, tag = "3")]
pub control: ::core::option::Option<get_event_stream_response::ControlInfo>,
}
pub mod get_event_stream_response {
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ControlInfo {
#[prost(bool, tag = "1")]
pub handshake_ok: bool,
}
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ValidateSourceRequest {
#[prost(uint64, tag = "1")]
pub source_id: u64,
#[prost(enumeration = "SourceType", tag = "2")]
pub source_type: i32,
#[prost(btree_map = "string, string", tag = "3")]
pub properties: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(message, optional, tag = "4")]
pub table_schema: ::core::option::Option<TableSchema>,
#[prost(bool, tag = "5")]
pub is_source_job: bool,
#[prost(bool, tag = "6")]
pub is_backfill_table: bool,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ValidateSourceResponse {
#[prost(message, optional, tag = "1")]
pub error: ::core::option::Option<ValidationError>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CoordinateRequest {
#[prost(oneof = "coordinate_request::Msg", tags = "1, 2, 3, 4")]
pub msg: ::core::option::Option<coordinate_request::Msg>,
}
pub mod coordinate_request {
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StartCoordinationRequest {
#[prost(message, optional, tag = "1")]
pub vnode_bitmap: ::core::option::Option<super::super::common::Buffer>,
#[prost(message, optional, tag = "2")]
pub param: ::core::option::Option<super::SinkParam>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitRequest {
#[prost(uint64, tag = "1")]
pub epoch: u64,
#[prost(message, optional, tag = "2")]
pub metadata: ::core::option::Option<super::SinkMetadata>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateVnodeBitmapRequest {
#[prost(message, optional, tag = "1")]
pub vnode_bitmap: ::core::option::Option<super::super::common::Buffer>,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Msg {
#[prost(message, tag = "1")]
StartRequest(StartCoordinationRequest),
#[prost(message, tag = "2")]
CommitRequest(CommitRequest),
#[prost(message, tag = "3")]
UpdateVnodeRequest(UpdateVnodeBitmapRequest),
#[prost(bool, tag = "4")]
Stop(bool),
}
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CoordinateResponse {
#[prost(oneof = "coordinate_response::Msg", tags = "1, 2")]
pub msg: ::core::option::Option<coordinate_response::Msg>,
}
pub mod coordinate_response {
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StartCoordinationResponse {}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CommitResponse {
#[prost(uint64, tag = "1")]
pub epoch: u64,
}
#[derive(prost_helpers::AnyPB)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Msg {
#[prost(message, tag = "1")]
StartResponse(StartCoordinationResponse),
#[prost(message, tag = "2")]
CommitResponse(CommitResponse),
}
}
#[derive(prost_helpers::AnyPB)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SourceType {
Unspecified = 0,
Mysql = 1,
Postgres = 2,
Citus = 3,
Mongodb = 4,
SqlServer = 5,
}
impl SourceType {
pub fn as_str_name(&self) -> &'static str {
match self {
SourceType::Unspecified => "UNSPECIFIED",
SourceType::Mysql => "MYSQL",
SourceType::Postgres => "POSTGRES",
SourceType::Citus => "CITUS",
SourceType::Mongodb => "MONGODB",
SourceType::SqlServer => "SQL_SERVER",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNSPECIFIED" => Some(Self::Unspecified),
"MYSQL" => Some(Self::Mysql),
"POSTGRES" => Some(Self::Postgres),
"CITUS" => Some(Self::Citus),
"MONGODB" => Some(Self::Mongodb),
"SQL_SERVER" => Some(Self::SqlServer),
_ => None,
}
}
}
pub mod connector_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 ConnectorServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ConnectorServiceClient<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> ConnectorServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
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,
) -> ConnectorServiceClient<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> + std::marker::Send + std::marker::Sync,
{
ConnectorServiceClient::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 sink_writer_stream(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::SinkWriterStreamRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::SinkWriterStreamResponse>>,
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(
"/connector_service.ConnectorService/SinkWriterStream",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"connector_service.ConnectorService",
"SinkWriterStream",
),
);
self.inner.streaming(req, path, codec).await
}
pub async fn sink_coordinator_stream(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::SinkCoordinatorStreamRequest,
>,
) -> std::result::Result<
tonic::Response<
tonic::codec::Streaming<super::SinkCoordinatorStreamResponse>,
>,
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(
"/connector_service.ConnectorService/SinkCoordinatorStream",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"connector_service.ConnectorService",
"SinkCoordinatorStream",
),
);
self.inner.streaming(req, path, codec).await
}
pub async fn validate_sink(
&mut self,
request: impl tonic::IntoRequest<super::ValidateSinkRequest>,
) -> std::result::Result<
tonic::Response<super::ValidateSinkResponse>,
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(
"/connector_service.ConnectorService/ValidateSink",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("connector_service.ConnectorService", "ValidateSink"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_event_stream(
&mut self,
request: impl tonic::IntoRequest<super::GetEventStreamRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::GetEventStreamResponse>>,
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(
"/connector_service.ConnectorService/GetEventStream",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"connector_service.ConnectorService",
"GetEventStream",
),
);
self.inner.server_streaming(req, path, codec).await
}
pub async fn validate_source(
&mut self,
request: impl tonic::IntoRequest<super::ValidateSourceRequest>,
) -> std::result::Result<
tonic::Response<super::ValidateSourceResponse>,
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(
"/connector_service.ConnectorService/ValidateSource",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"connector_service.ConnectorService",
"ValidateSource",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod sink_coordination_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 SinkCoordinationServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SinkCoordinationServiceClient<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> SinkCoordinationServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
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,
) -> SinkCoordinationServiceClient<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> + std::marker::Send + std::marker::Sync,
{
SinkCoordinationServiceClient::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 coordinate(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::CoordinateRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::CoordinateResponse>>,
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(
"/connector_service.SinkCoordinationService/Coordinate",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"connector_service.SinkCoordinationService",
"Coordinate",
),
);
self.inner.streaming(req, path, codec).await
}
}
}
pub mod connector_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait ConnectorService: std::marker::Send + std::marker::Sync + 'static {
type SinkWriterStreamStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<
super::SinkWriterStreamResponse,
tonic::Status,
>,
>
+ std::marker::Send
+ 'static;
async fn sink_writer_stream(
&self,
request: tonic::Request<tonic::Streaming<super::SinkWriterStreamRequest>>,
) -> std::result::Result<
tonic::Response<Self::SinkWriterStreamStream>,
tonic::Status,
>;
type SinkCoordinatorStreamStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<
super::SinkCoordinatorStreamResponse,
tonic::Status,
>,
>
+ std::marker::Send
+ 'static;
async fn sink_coordinator_stream(
&self,
request: tonic::Request<
tonic::Streaming<super::SinkCoordinatorStreamRequest>,
>,
) -> std::result::Result<
tonic::Response<Self::SinkCoordinatorStreamStream>,
tonic::Status,
>;
async fn validate_sink(
&self,
request: tonic::Request<super::ValidateSinkRequest>,
) -> std::result::Result<
tonic::Response<super::ValidateSinkResponse>,
tonic::Status,
>;
type GetEventStreamStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::GetEventStreamResponse, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn get_event_stream(
&self,
request: tonic::Request<super::GetEventStreamRequest>,
) -> std::result::Result<
tonic::Response<Self::GetEventStreamStream>,
tonic::Status,
>;
async fn validate_source(
&self,
request: tonic::Request<super::ValidateSourceRequest>,
) -> std::result::Result<
tonic::Response<super::ValidateSourceResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct ConnectorServiceServer<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> ConnectorServiceServer<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 ConnectorServiceServer<T>
where
T: ConnectorService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::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 {
match req.uri().path() {
"/connector_service.ConnectorService/SinkWriterStream" => {
#[allow(non_camel_case_types)]
struct SinkWriterStreamSvc<T: ConnectorService>(pub Arc<T>);
impl<
T: ConnectorService,
> tonic::server::StreamingService<super::SinkWriterStreamRequest>
for SinkWriterStreamSvc<T> {
type Response = super::SinkWriterStreamResponse;
type ResponseStream = T::SinkWriterStreamStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::SinkWriterStreamRequest>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ConnectorService>::sink_writer_stream(&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 = SinkWriterStreamSvc(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)
}
"/connector_service.ConnectorService/SinkCoordinatorStream" => {
#[allow(non_camel_case_types)]
struct SinkCoordinatorStreamSvc<T: ConnectorService>(pub Arc<T>);
impl<
T: ConnectorService,
> tonic::server::StreamingService<
super::SinkCoordinatorStreamRequest,
> for SinkCoordinatorStreamSvc<T> {
type Response = super::SinkCoordinatorStreamResponse;
type ResponseStream = T::SinkCoordinatorStreamStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::SinkCoordinatorStreamRequest>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ConnectorService>::sink_coordinator_stream(
&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 = SinkCoordinatorStreamSvc(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)
}
"/connector_service.ConnectorService/ValidateSink" => {
#[allow(non_camel_case_types)]
struct ValidateSinkSvc<T: ConnectorService>(pub Arc<T>);
impl<
T: ConnectorService,
> tonic::server::UnaryService<super::ValidateSinkRequest>
for ValidateSinkSvc<T> {
type Response = super::ValidateSinkResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ValidateSinkRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ConnectorService>::validate_sink(&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 = ValidateSinkSvc(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)
}
"/connector_service.ConnectorService/GetEventStream" => {
#[allow(non_camel_case_types)]
struct GetEventStreamSvc<T: ConnectorService>(pub Arc<T>);
impl<
T: ConnectorService,
> tonic::server::ServerStreamingService<super::GetEventStreamRequest>
for GetEventStreamSvc<T> {
type Response = super::GetEventStreamResponse;
type ResponseStream = T::GetEventStreamStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetEventStreamRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ConnectorService>::get_event_stream(&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 = GetEventStreamSvc(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.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/connector_service.ConnectorService/ValidateSource" => {
#[allow(non_camel_case_types)]
struct ValidateSourceSvc<T: ConnectorService>(pub Arc<T>);
impl<
T: ConnectorService,
> tonic::server::UnaryService<super::ValidateSourceRequest>
for ValidateSourceSvc<T> {
type Response = super::ValidateSourceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ValidateSourceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ConnectorService>::validate_source(&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 = ValidateSourceSvc(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", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T> Clone for ConnectorServiceServer<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 = "connector_service.ConnectorService";
impl<T> tonic::server::NamedService for ConnectorServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod sink_coordination_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait SinkCoordinationService: std::marker::Send + std::marker::Sync + 'static {
type CoordinateStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::CoordinateResponse, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn coordinate(
&self,
request: tonic::Request<tonic::Streaming<super::CoordinateRequest>>,
) -> std::result::Result<tonic::Response<Self::CoordinateStream>, tonic::Status>;
}
#[derive(Debug)]
pub struct SinkCoordinationServiceServer<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> SinkCoordinationServiceServer<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 SinkCoordinationServiceServer<T>
where
T: SinkCoordinationService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::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 {
match req.uri().path() {
"/connector_service.SinkCoordinationService/Coordinate" => {
#[allow(non_camel_case_types)]
struct CoordinateSvc<T: SinkCoordinationService>(pub Arc<T>);
impl<
T: SinkCoordinationService,
> tonic::server::StreamingService<super::CoordinateRequest>
for CoordinateSvc<T> {
type Response = super::CoordinateResponse;
type ResponseStream = T::CoordinateStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::CoordinateRequest>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SinkCoordinationService>::coordinate(&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 = CoordinateSvc(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", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T> Clone for SinkCoordinationServiceServer<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 = "connector_service.SinkCoordinationService";
impl<T> tonic::server::NamedService for SinkCoordinationServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}