use crate::connector_service::*;
impl serde::Serialize for CdcMessage {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if !self.payload.is_empty() {
len += 1;
}
if !self.partition.is_empty() {
len += 1;
}
if !self.offset.is_empty() {
len += 1;
}
if !self.full_table_name.is_empty() {
len += 1;
}
if self.source_ts_ms != 0 {
len += 1;
}
if self.msg_type != 0 {
len += 1;
}
if !self.key.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.CdcMessage", len)?;
if !self.payload.is_empty() {
struct_ser.serialize_field("payload", &self.payload)?;
}
if !self.partition.is_empty() {
struct_ser.serialize_field("partition", &self.partition)?;
}
if !self.offset.is_empty() {
struct_ser.serialize_field("offset", &self.offset)?;
}
if !self.full_table_name.is_empty() {
struct_ser.serialize_field("fullTableName", &self.full_table_name)?;
}
if self.source_ts_ms != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("sourceTsMs", ToString::to_string(&self.source_ts_ms).as_str())?;
}
if self.msg_type != 0 {
let v = cdc_message::CdcMessageType::try_from(self.msg_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.msg_type)))?;
struct_ser.serialize_field("msgType", &v)?;
}
if !self.key.is_empty() {
struct_ser.serialize_field("key", &self.key)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for CdcMessage {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"payload",
"partition",
"offset",
"full_table_name",
"fullTableName",
"source_ts_ms",
"sourceTsMs",
"msg_type",
"msgType",
"key",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Payload,
Partition,
Offset,
FullTableName,
SourceTsMs,
MsgType,
Key,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"payload" => Ok(GeneratedField::Payload),
"partition" => Ok(GeneratedField::Partition),
"offset" => Ok(GeneratedField::Offset),
"fullTableName" | "full_table_name" => Ok(GeneratedField::FullTableName),
"sourceTsMs" | "source_ts_ms" => Ok(GeneratedField::SourceTsMs),
"msgType" | "msg_type" => Ok(GeneratedField::MsgType),
"key" => Ok(GeneratedField::Key),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = CdcMessage;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.CdcMessage")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<CdcMessage, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut payload__ = None;
let mut partition__ = None;
let mut offset__ = None;
let mut full_table_name__ = None;
let mut source_ts_ms__ = None;
let mut msg_type__ = None;
let mut key__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Payload => {
if payload__.is_some() {
return Err(serde::de::Error::duplicate_field("payload"));
}
payload__ = Some(map_.next_value()?);
}
GeneratedField::Partition => {
if partition__.is_some() {
return Err(serde::de::Error::duplicate_field("partition"));
}
partition__ = Some(map_.next_value()?);
}
GeneratedField::Offset => {
if offset__.is_some() {
return Err(serde::de::Error::duplicate_field("offset"));
}
offset__ = Some(map_.next_value()?);
}
GeneratedField::FullTableName => {
if full_table_name__.is_some() {
return Err(serde::de::Error::duplicate_field("fullTableName"));
}
full_table_name__ = Some(map_.next_value()?);
}
GeneratedField::SourceTsMs => {
if source_ts_ms__.is_some() {
return Err(serde::de::Error::duplicate_field("sourceTsMs"));
}
source_ts_ms__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::MsgType => {
if msg_type__.is_some() {
return Err(serde::de::Error::duplicate_field("msgType"));
}
msg_type__ = Some(map_.next_value::<cdc_message::CdcMessageType>()? as i32);
}
GeneratedField::Key => {
if key__.is_some() {
return Err(serde::de::Error::duplicate_field("key"));
}
key__ = Some(map_.next_value()?);
}
}
}
Ok(CdcMessage {
payload: payload__.unwrap_or_default(),
partition: partition__.unwrap_or_default(),
offset: offset__.unwrap_or_default(),
full_table_name: full_table_name__.unwrap_or_default(),
source_ts_ms: source_ts_ms__.unwrap_or_default(),
msg_type: msg_type__.unwrap_or_default(),
key: key__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.CdcMessage", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for cdc_message::CdcMessageType {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "UNSPECIFIED",
Self::Heartbeat => "HEARTBEAT",
Self::Data => "DATA",
Self::TransactionMeta => "TRANSACTION_META",
Self::SchemaChange => "SCHEMA_CHANGE",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for cdc_message::CdcMessageType {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"UNSPECIFIED",
"HEARTBEAT",
"DATA",
"TRANSACTION_META",
"SCHEMA_CHANGE",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = cdc_message::CdcMessageType;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"UNSPECIFIED" => Ok(cdc_message::CdcMessageType::Unspecified),
"HEARTBEAT" => Ok(cdc_message::CdcMessageType::Heartbeat),
"DATA" => Ok(cdc_message::CdcMessageType::Data),
"TRANSACTION_META" => Ok(cdc_message::CdcMessageType::TransactionMeta),
"SCHEMA_CHANGE" => Ok(cdc_message::CdcMessageType::SchemaChange),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for CoordinateRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.msg.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.CoordinateRequest", len)?;
if let Some(v) = self.msg.as_ref() {
match v {
coordinate_request::Msg::StartRequest(v) => {
struct_ser.serialize_field("startRequest", v)?;
}
coordinate_request::Msg::CommitRequest(v) => {
struct_ser.serialize_field("commitRequest", v)?;
}
coordinate_request::Msg::UpdateVnodeRequest(v) => {
struct_ser.serialize_field("updateVnodeRequest", v)?;
}
coordinate_request::Msg::Stop(v) => {
struct_ser.serialize_field("stop", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for CoordinateRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"start_request",
"startRequest",
"commit_request",
"commitRequest",
"update_vnode_request",
"updateVnodeRequest",
"stop",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
StartRequest,
CommitRequest,
UpdateVnodeRequest,
Stop,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"startRequest" | "start_request" => Ok(GeneratedField::StartRequest),
"commitRequest" | "commit_request" => Ok(GeneratedField::CommitRequest),
"updateVnodeRequest" | "update_vnode_request" => Ok(GeneratedField::UpdateVnodeRequest),
"stop" => Ok(GeneratedField::Stop),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = CoordinateRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.CoordinateRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<CoordinateRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut msg__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::StartRequest => {
if msg__.is_some() {
return Err(serde::de::Error::duplicate_field("startRequest"));
}
msg__ = map_.next_value::<::std::option::Option<_>>()?.map(coordinate_request::Msg::StartRequest)
;
}
GeneratedField::CommitRequest => {
if msg__.is_some() {
return Err(serde::de::Error::duplicate_field("commitRequest"));
}
msg__ = map_.next_value::<::std::option::Option<_>>()?.map(coordinate_request::Msg::CommitRequest)
;
}
GeneratedField::UpdateVnodeRequest => {
if msg__.is_some() {
return Err(serde::de::Error::duplicate_field("updateVnodeRequest"));
}
msg__ = map_.next_value::<::std::option::Option<_>>()?.map(coordinate_request::Msg::UpdateVnodeRequest)
;
}
GeneratedField::Stop => {
if msg__.is_some() {
return Err(serde::de::Error::duplicate_field("stop"));
}
msg__ = map_.next_value::<::std::option::Option<_>>()?.map(coordinate_request::Msg::Stop);
}
}
}
Ok(CoordinateRequest {
msg: msg__,
})
}
}
deserializer.deserialize_struct("connector_service.CoordinateRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for coordinate_request::CommitRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.epoch != 0 {
len += 1;
}
if self.metadata.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.CoordinateRequest.CommitRequest", len)?;
if self.epoch != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("epoch", ToString::to_string(&self.epoch).as_str())?;
}
if let Some(v) = self.metadata.as_ref() {
struct_ser.serialize_field("metadata", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for coordinate_request::CommitRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"epoch",
"metadata",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Epoch,
Metadata,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"epoch" => Ok(GeneratedField::Epoch),
"metadata" => Ok(GeneratedField::Metadata),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = coordinate_request::CommitRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.CoordinateRequest.CommitRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<coordinate_request::CommitRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut epoch__ = None;
let mut metadata__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Epoch => {
if epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("epoch"));
}
epoch__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Metadata => {
if metadata__.is_some() {
return Err(serde::de::Error::duplicate_field("metadata"));
}
metadata__ = map_.next_value()?;
}
}
}
Ok(coordinate_request::CommitRequest {
epoch: epoch__.unwrap_or_default(),
metadata: metadata__,
})
}
}
deserializer.deserialize_struct("connector_service.CoordinateRequest.CommitRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for coordinate_request::StartCoordinationRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.vnode_bitmap.is_some() {
len += 1;
}
if self.param.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.CoordinateRequest.StartCoordinationRequest", len)?;
if let Some(v) = self.vnode_bitmap.as_ref() {
struct_ser.serialize_field("vnodeBitmap", v)?;
}
if let Some(v) = self.param.as_ref() {
struct_ser.serialize_field("param", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for coordinate_request::StartCoordinationRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"vnode_bitmap",
"vnodeBitmap",
"param",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
VnodeBitmap,
Param,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"vnodeBitmap" | "vnode_bitmap" => Ok(GeneratedField::VnodeBitmap),
"param" => Ok(GeneratedField::Param),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = coordinate_request::StartCoordinationRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.CoordinateRequest.StartCoordinationRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<coordinate_request::StartCoordinationRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut vnode_bitmap__ = None;
let mut param__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::VnodeBitmap => {
if vnode_bitmap__.is_some() {
return Err(serde::de::Error::duplicate_field("vnodeBitmap"));
}
vnode_bitmap__ = map_.next_value()?;
}
GeneratedField::Param => {
if param__.is_some() {
return Err(serde::de::Error::duplicate_field("param"));
}
param__ = map_.next_value()?;
}
}
}
Ok(coordinate_request::StartCoordinationRequest {
vnode_bitmap: vnode_bitmap__,
param: param__,
})
}
}
deserializer.deserialize_struct("connector_service.CoordinateRequest.StartCoordinationRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for coordinate_request::UpdateVnodeBitmapRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.vnode_bitmap.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.CoordinateRequest.UpdateVnodeBitmapRequest", len)?;
if let Some(v) = self.vnode_bitmap.as_ref() {
struct_ser.serialize_field("vnodeBitmap", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for coordinate_request::UpdateVnodeBitmapRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"vnode_bitmap",
"vnodeBitmap",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
VnodeBitmap,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"vnodeBitmap" | "vnode_bitmap" => Ok(GeneratedField::VnodeBitmap),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = coordinate_request::UpdateVnodeBitmapRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.CoordinateRequest.UpdateVnodeBitmapRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<coordinate_request::UpdateVnodeBitmapRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut vnode_bitmap__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::VnodeBitmap => {
if vnode_bitmap__.is_some() {
return Err(serde::de::Error::duplicate_field("vnodeBitmap"));
}
vnode_bitmap__ = map_.next_value()?;
}
}
}
Ok(coordinate_request::UpdateVnodeBitmapRequest {
vnode_bitmap: vnode_bitmap__,
})
}
}
deserializer.deserialize_struct("connector_service.CoordinateRequest.UpdateVnodeBitmapRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for CoordinateResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.msg.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.CoordinateResponse", len)?;
if let Some(v) = self.msg.as_ref() {
match v {
coordinate_response::Msg::StartResponse(v) => {
struct_ser.serialize_field("startResponse", v)?;
}
coordinate_response::Msg::CommitResponse(v) => {
struct_ser.serialize_field("commitResponse", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for CoordinateResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"start_response",
"startResponse",
"commit_response",
"commitResponse",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
StartResponse,
CommitResponse,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"startResponse" | "start_response" => Ok(GeneratedField::StartResponse),
"commitResponse" | "commit_response" => Ok(GeneratedField::CommitResponse),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = CoordinateResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.CoordinateResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<CoordinateResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut msg__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::StartResponse => {
if msg__.is_some() {
return Err(serde::de::Error::duplicate_field("startResponse"));
}
msg__ = map_.next_value::<::std::option::Option<_>>()?.map(coordinate_response::Msg::StartResponse)
;
}
GeneratedField::CommitResponse => {
if msg__.is_some() {
return Err(serde::de::Error::duplicate_field("commitResponse"));
}
msg__ = map_.next_value::<::std::option::Option<_>>()?.map(coordinate_response::Msg::CommitResponse)
;
}
}
}
Ok(CoordinateResponse {
msg: msg__,
})
}
}
deserializer.deserialize_struct("connector_service.CoordinateResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for coordinate_response::CommitResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.epoch != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.CoordinateResponse.CommitResponse", len)?;
if self.epoch != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("epoch", ToString::to_string(&self.epoch).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for coordinate_response::CommitResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"epoch",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Epoch,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"epoch" => Ok(GeneratedField::Epoch),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = coordinate_response::CommitResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.CoordinateResponse.CommitResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<coordinate_response::CommitResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut epoch__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Epoch => {
if epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("epoch"));
}
epoch__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(coordinate_response::CommitResponse {
epoch: epoch__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.CoordinateResponse.CommitResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for coordinate_response::StartCoordinationResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let len = 0;
let struct_ser = serializer.serialize_struct("connector_service.CoordinateResponse.StartCoordinationResponse", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for coordinate_response::StartCoordinationResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
Err(serde::de::Error::unknown_field(value, FIELDS))
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = coordinate_response::StartCoordinationResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.CoordinateResponse.StartCoordinationResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<coordinate_response::StartCoordinationResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(coordinate_response::StartCoordinationResponse {
})
}
}
deserializer.deserialize_struct("connector_service.CoordinateResponse.StartCoordinationResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for GetEventStreamRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.source_id != 0 {
len += 1;
}
if self.source_type != 0 {
len += 1;
}
if !self.start_offset.is_empty() {
len += 1;
}
if !self.properties.is_empty() {
len += 1;
}
if self.snapshot_done {
len += 1;
}
if self.is_source_job {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.GetEventStreamRequest", len)?;
if self.source_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("sourceId", ToString::to_string(&self.source_id).as_str())?;
}
if self.source_type != 0 {
let v = SourceType::try_from(self.source_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.source_type)))?;
struct_ser.serialize_field("sourceType", &v)?;
}
if !self.start_offset.is_empty() {
struct_ser.serialize_field("startOffset", &self.start_offset)?;
}
if !self.properties.is_empty() {
struct_ser.serialize_field("properties", &self.properties)?;
}
if self.snapshot_done {
struct_ser.serialize_field("snapshotDone", &self.snapshot_done)?;
}
if self.is_source_job {
struct_ser.serialize_field("isSourceJob", &self.is_source_job)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for GetEventStreamRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"source_id",
"sourceId",
"source_type",
"sourceType",
"start_offset",
"startOffset",
"properties",
"snapshot_done",
"snapshotDone",
"is_source_job",
"isSourceJob",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
SourceId,
SourceType,
StartOffset,
Properties,
SnapshotDone,
IsSourceJob,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"sourceId" | "source_id" => Ok(GeneratedField::SourceId),
"sourceType" | "source_type" => Ok(GeneratedField::SourceType),
"startOffset" | "start_offset" => Ok(GeneratedField::StartOffset),
"properties" => Ok(GeneratedField::Properties),
"snapshotDone" | "snapshot_done" => Ok(GeneratedField::SnapshotDone),
"isSourceJob" | "is_source_job" => Ok(GeneratedField::IsSourceJob),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GetEventStreamRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.GetEventStreamRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetEventStreamRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut source_id__ = None;
let mut source_type__ = None;
let mut start_offset__ = None;
let mut properties__ = None;
let mut snapshot_done__ = None;
let mut is_source_job__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::SourceId => {
if source_id__.is_some() {
return Err(serde::de::Error::duplicate_field("sourceId"));
}
source_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SourceType => {
if source_type__.is_some() {
return Err(serde::de::Error::duplicate_field("sourceType"));
}
source_type__ = Some(map_.next_value::<SourceType>()? as i32);
}
GeneratedField::StartOffset => {
if start_offset__.is_some() {
return Err(serde::de::Error::duplicate_field("startOffset"));
}
start_offset__ = Some(map_.next_value()?);
}
GeneratedField::Properties => {
if properties__.is_some() {
return Err(serde::de::Error::duplicate_field("properties"));
}
properties__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::SnapshotDone => {
if snapshot_done__.is_some() {
return Err(serde::de::Error::duplicate_field("snapshotDone"));
}
snapshot_done__ = Some(map_.next_value()?);
}
GeneratedField::IsSourceJob => {
if is_source_job__.is_some() {
return Err(serde::de::Error::duplicate_field("isSourceJob"));
}
is_source_job__ = Some(map_.next_value()?);
}
}
}
Ok(GetEventStreamRequest {
source_id: source_id__.unwrap_or_default(),
source_type: source_type__.unwrap_or_default(),
start_offset: start_offset__.unwrap_or_default(),
properties: properties__.unwrap_or_default(),
snapshot_done: snapshot_done__.unwrap_or_default(),
is_source_job: is_source_job__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.GetEventStreamRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for GetEventStreamResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.source_id != 0 {
len += 1;
}
if !self.events.is_empty() {
len += 1;
}
if self.control.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.GetEventStreamResponse", len)?;
if self.source_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("sourceId", ToString::to_string(&self.source_id).as_str())?;
}
if !self.events.is_empty() {
struct_ser.serialize_field("events", &self.events)?;
}
if let Some(v) = self.control.as_ref() {
struct_ser.serialize_field("control", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for GetEventStreamResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"source_id",
"sourceId",
"events",
"control",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
SourceId,
Events,
Control,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"sourceId" | "source_id" => Ok(GeneratedField::SourceId),
"events" => Ok(GeneratedField::Events),
"control" => Ok(GeneratedField::Control),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GetEventStreamResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.GetEventStreamResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetEventStreamResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut source_id__ = None;
let mut events__ = None;
let mut control__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::SourceId => {
if source_id__.is_some() {
return Err(serde::de::Error::duplicate_field("sourceId"));
}
source_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Events => {
if events__.is_some() {
return Err(serde::de::Error::duplicate_field("events"));
}
events__ = Some(map_.next_value()?);
}
GeneratedField::Control => {
if control__.is_some() {
return Err(serde::de::Error::duplicate_field("control"));
}
control__ = map_.next_value()?;
}
}
}
Ok(GetEventStreamResponse {
source_id: source_id__.unwrap_or_default(),
events: events__.unwrap_or_default(),
control: control__,
})
}
}
deserializer.deserialize_struct("connector_service.GetEventStreamResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for get_event_stream_response::ControlInfo {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.handshake_ok {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.GetEventStreamResponse.ControlInfo", len)?;
if self.handshake_ok {
struct_ser.serialize_field("handshakeOk", &self.handshake_ok)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for get_event_stream_response::ControlInfo {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"handshake_ok",
"handshakeOk",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
HandshakeOk,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"handshakeOk" | "handshake_ok" => Ok(GeneratedField::HandshakeOk),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = get_event_stream_response::ControlInfo;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.GetEventStreamResponse.ControlInfo")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<get_event_stream_response::ControlInfo, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut handshake_ok__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::HandshakeOk => {
if handshake_ok__.is_some() {
return Err(serde::de::Error::duplicate_field("handshakeOk"));
}
handshake_ok__ = Some(map_.next_value()?);
}
}
}
Ok(get_event_stream_response::ControlInfo {
handshake_ok: handshake_ok__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.GetEventStreamResponse.ControlInfo", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SinkCoordinatorStreamRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.request.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkCoordinatorStreamRequest", len)?;
if let Some(v) = self.request.as_ref() {
match v {
sink_coordinator_stream_request::Request::Start(v) => {
struct_ser.serialize_field("start", v)?;
}
sink_coordinator_stream_request::Request::Commit(v) => {
struct_ser.serialize_field("commit", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SinkCoordinatorStreamRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"start",
"commit",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Start,
Commit,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"start" => Ok(GeneratedField::Start),
"commit" => Ok(GeneratedField::Commit),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SinkCoordinatorStreamRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkCoordinatorStreamRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SinkCoordinatorStreamRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut request__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Start => {
if request__.is_some() {
return Err(serde::de::Error::duplicate_field("start"));
}
request__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_coordinator_stream_request::Request::Start)
;
}
GeneratedField::Commit => {
if request__.is_some() {
return Err(serde::de::Error::duplicate_field("commit"));
}
request__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_coordinator_stream_request::Request::Commit)
;
}
}
}
Ok(SinkCoordinatorStreamRequest {
request: request__,
})
}
}
deserializer.deserialize_struct("connector_service.SinkCoordinatorStreamRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_coordinator_stream_request::CommitMetadata {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.epoch != 0 {
len += 1;
}
if !self.metadata.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkCoordinatorStreamRequest.CommitMetadata", len)?;
if self.epoch != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("epoch", ToString::to_string(&self.epoch).as_str())?;
}
if !self.metadata.is_empty() {
struct_ser.serialize_field("metadata", &self.metadata)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_coordinator_stream_request::CommitMetadata {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"epoch",
"metadata",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Epoch,
Metadata,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"epoch" => Ok(GeneratedField::Epoch),
"metadata" => Ok(GeneratedField::Metadata),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_coordinator_stream_request::CommitMetadata;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkCoordinatorStreamRequest.CommitMetadata")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_coordinator_stream_request::CommitMetadata, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut epoch__ = None;
let mut metadata__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Epoch => {
if epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("epoch"));
}
epoch__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Metadata => {
if metadata__.is_some() {
return Err(serde::de::Error::duplicate_field("metadata"));
}
metadata__ = Some(map_.next_value()?);
}
}
}
Ok(sink_coordinator_stream_request::CommitMetadata {
epoch: epoch__.unwrap_or_default(),
metadata: metadata__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.SinkCoordinatorStreamRequest.CommitMetadata", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_coordinator_stream_request::StartCoordinator {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.param.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkCoordinatorStreamRequest.StartCoordinator", len)?;
if let Some(v) = self.param.as_ref() {
struct_ser.serialize_field("param", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_coordinator_stream_request::StartCoordinator {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"param",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Param,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"param" => Ok(GeneratedField::Param),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_coordinator_stream_request::StartCoordinator;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkCoordinatorStreamRequest.StartCoordinator")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_coordinator_stream_request::StartCoordinator, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut param__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Param => {
if param__.is_some() {
return Err(serde::de::Error::duplicate_field("param"));
}
param__ = map_.next_value()?;
}
}
}
Ok(sink_coordinator_stream_request::StartCoordinator {
param: param__,
})
}
}
deserializer.deserialize_struct("connector_service.SinkCoordinatorStreamRequest.StartCoordinator", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SinkCoordinatorStreamResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.response.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkCoordinatorStreamResponse", len)?;
if let Some(v) = self.response.as_ref() {
match v {
sink_coordinator_stream_response::Response::Start(v) => {
struct_ser.serialize_field("start", v)?;
}
sink_coordinator_stream_response::Response::Commit(v) => {
struct_ser.serialize_field("commit", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SinkCoordinatorStreamResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"start",
"commit",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Start,
Commit,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"start" => Ok(GeneratedField::Start),
"commit" => Ok(GeneratedField::Commit),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SinkCoordinatorStreamResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkCoordinatorStreamResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SinkCoordinatorStreamResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut response__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Start => {
if response__.is_some() {
return Err(serde::de::Error::duplicate_field("start"));
}
response__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_coordinator_stream_response::Response::Start)
;
}
GeneratedField::Commit => {
if response__.is_some() {
return Err(serde::de::Error::duplicate_field("commit"));
}
response__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_coordinator_stream_response::Response::Commit)
;
}
}
}
Ok(SinkCoordinatorStreamResponse {
response: response__,
})
}
}
deserializer.deserialize_struct("connector_service.SinkCoordinatorStreamResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_coordinator_stream_response::CommitResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.epoch != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkCoordinatorStreamResponse.CommitResponse", len)?;
if self.epoch != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("epoch", ToString::to_string(&self.epoch).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_coordinator_stream_response::CommitResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"epoch",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Epoch,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"epoch" => Ok(GeneratedField::Epoch),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_coordinator_stream_response::CommitResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkCoordinatorStreamResponse.CommitResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_coordinator_stream_response::CommitResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut epoch__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Epoch => {
if epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("epoch"));
}
epoch__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(sink_coordinator_stream_response::CommitResponse {
epoch: epoch__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.SinkCoordinatorStreamResponse.CommitResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_coordinator_stream_response::StartResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let len = 0;
let struct_ser = serializer.serialize_struct("connector_service.SinkCoordinatorStreamResponse.StartResponse", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_coordinator_stream_response::StartResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
Err(serde::de::Error::unknown_field(value, FIELDS))
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_coordinator_stream_response::StartResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkCoordinatorStreamResponse.StartResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_coordinator_stream_response::StartResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(sink_coordinator_stream_response::StartResponse {
})
}
}
deserializer.deserialize_struct("connector_service.SinkCoordinatorStreamResponse.StartResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SinkMetadata {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.metadata.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkMetadata", len)?;
if let Some(v) = self.metadata.as_ref() {
match v {
sink_metadata::Metadata::Serialized(v) => {
struct_ser.serialize_field("serialized", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SinkMetadata {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"serialized",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Serialized,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"serialized" => Ok(GeneratedField::Serialized),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SinkMetadata;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkMetadata")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SinkMetadata, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut metadata__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Serialized => {
if metadata__.is_some() {
return Err(serde::de::Error::duplicate_field("serialized"));
}
metadata__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_metadata::Metadata::Serialized)
;
}
}
}
Ok(SinkMetadata {
metadata: metadata__,
})
}
}
deserializer.deserialize_struct("connector_service.SinkMetadata", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_metadata::SerializedMetadata {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if !self.metadata.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkMetadata.SerializedMetadata", len)?;
if !self.metadata.is_empty() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("metadata", pbjson::private::base64::encode(&self.metadata).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_metadata::SerializedMetadata {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"metadata",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Metadata,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"metadata" => Ok(GeneratedField::Metadata),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_metadata::SerializedMetadata;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkMetadata.SerializedMetadata")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_metadata::SerializedMetadata, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut metadata__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Metadata => {
if metadata__.is_some() {
return Err(serde::de::Error::duplicate_field("metadata"));
}
metadata__ =
Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
;
}
}
}
Ok(sink_metadata::SerializedMetadata {
metadata: metadata__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.SinkMetadata.SerializedMetadata", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SinkParam {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.sink_id != 0 {
len += 1;
}
if !self.properties.is_empty() {
len += 1;
}
if self.table_schema.is_some() {
len += 1;
}
if self.sink_type != 0 {
len += 1;
}
if !self.db_name.is_empty() {
len += 1;
}
if !self.sink_from_name.is_empty() {
len += 1;
}
if self.format_desc.is_some() {
len += 1;
}
if !self.sink_name.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkParam", len)?;
if self.sink_id != 0 {
struct_ser.serialize_field("sinkId", &self.sink_id)?;
}
if !self.properties.is_empty() {
struct_ser.serialize_field("properties", &self.properties)?;
}
if let Some(v) = self.table_schema.as_ref() {
struct_ser.serialize_field("tableSchema", v)?;
}
if self.sink_type != 0 {
let v = super::catalog::SinkType::try_from(self.sink_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.sink_type)))?;
struct_ser.serialize_field("sinkType", &v)?;
}
if !self.db_name.is_empty() {
struct_ser.serialize_field("dbName", &self.db_name)?;
}
if !self.sink_from_name.is_empty() {
struct_ser.serialize_field("sinkFromName", &self.sink_from_name)?;
}
if let Some(v) = self.format_desc.as_ref() {
struct_ser.serialize_field("formatDesc", v)?;
}
if !self.sink_name.is_empty() {
struct_ser.serialize_field("sinkName", &self.sink_name)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SinkParam {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"sink_id",
"sinkId",
"properties",
"table_schema",
"tableSchema",
"sink_type",
"sinkType",
"db_name",
"dbName",
"sink_from_name",
"sinkFromName",
"format_desc",
"formatDesc",
"sink_name",
"sinkName",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
SinkId,
Properties,
TableSchema,
SinkType,
DbName,
SinkFromName,
FormatDesc,
SinkName,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"sinkId" | "sink_id" => Ok(GeneratedField::SinkId),
"properties" => Ok(GeneratedField::Properties),
"tableSchema" | "table_schema" => Ok(GeneratedField::TableSchema),
"sinkType" | "sink_type" => Ok(GeneratedField::SinkType),
"dbName" | "db_name" => Ok(GeneratedField::DbName),
"sinkFromName" | "sink_from_name" => Ok(GeneratedField::SinkFromName),
"formatDesc" | "format_desc" => Ok(GeneratedField::FormatDesc),
"sinkName" | "sink_name" => Ok(GeneratedField::SinkName),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SinkParam;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkParam")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SinkParam, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut sink_id__ = None;
let mut properties__ = None;
let mut table_schema__ = None;
let mut sink_type__ = None;
let mut db_name__ = None;
let mut sink_from_name__ = None;
let mut format_desc__ = None;
let mut sink_name__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::SinkId => {
if sink_id__.is_some() {
return Err(serde::de::Error::duplicate_field("sinkId"));
}
sink_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Properties => {
if properties__.is_some() {
return Err(serde::de::Error::duplicate_field("properties"));
}
properties__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::TableSchema => {
if table_schema__.is_some() {
return Err(serde::de::Error::duplicate_field("tableSchema"));
}
table_schema__ = map_.next_value()?;
}
GeneratedField::SinkType => {
if sink_type__.is_some() {
return Err(serde::de::Error::duplicate_field("sinkType"));
}
sink_type__ = Some(map_.next_value::<super::catalog::SinkType>()? as i32);
}
GeneratedField::DbName => {
if db_name__.is_some() {
return Err(serde::de::Error::duplicate_field("dbName"));
}
db_name__ = Some(map_.next_value()?);
}
GeneratedField::SinkFromName => {
if sink_from_name__.is_some() {
return Err(serde::de::Error::duplicate_field("sinkFromName"));
}
sink_from_name__ = Some(map_.next_value()?);
}
GeneratedField::FormatDesc => {
if format_desc__.is_some() {
return Err(serde::de::Error::duplicate_field("formatDesc"));
}
format_desc__ = map_.next_value()?;
}
GeneratedField::SinkName => {
if sink_name__.is_some() {
return Err(serde::de::Error::duplicate_field("sinkName"));
}
sink_name__ = Some(map_.next_value()?);
}
}
}
Ok(SinkParam {
sink_id: sink_id__.unwrap_or_default(),
properties: properties__.unwrap_or_default(),
table_schema: table_schema__,
sink_type: sink_type__.unwrap_or_default(),
db_name: db_name__.unwrap_or_default(),
sink_from_name: sink_from_name__.unwrap_or_default(),
format_desc: format_desc__,
sink_name: sink_name__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.SinkParam", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SinkWriterStreamRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.request.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkWriterStreamRequest", len)?;
if let Some(v) = self.request.as_ref() {
match v {
sink_writer_stream_request::Request::Start(v) => {
struct_ser.serialize_field("start", v)?;
}
sink_writer_stream_request::Request::WriteBatch(v) => {
struct_ser.serialize_field("writeBatch", v)?;
}
sink_writer_stream_request::Request::Barrier(v) => {
struct_ser.serialize_field("barrier", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SinkWriterStreamRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"start",
"write_batch",
"writeBatch",
"barrier",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Start,
WriteBatch,
Barrier,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"start" => Ok(GeneratedField::Start),
"writeBatch" | "write_batch" => Ok(GeneratedField::WriteBatch),
"barrier" => Ok(GeneratedField::Barrier),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SinkWriterStreamRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkWriterStreamRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SinkWriterStreamRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut request__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Start => {
if request__.is_some() {
return Err(serde::de::Error::duplicate_field("start"));
}
request__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_writer_stream_request::Request::Start)
;
}
GeneratedField::WriteBatch => {
if request__.is_some() {
return Err(serde::de::Error::duplicate_field("writeBatch"));
}
request__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_writer_stream_request::Request::WriteBatch)
;
}
GeneratedField::Barrier => {
if request__.is_some() {
return Err(serde::de::Error::duplicate_field("barrier"));
}
request__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_writer_stream_request::Request::Barrier)
;
}
}
}
Ok(SinkWriterStreamRequest {
request: request__,
})
}
}
deserializer.deserialize_struct("connector_service.SinkWriterStreamRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_writer_stream_request::Barrier {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.epoch != 0 {
len += 1;
}
if self.is_checkpoint {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkWriterStreamRequest.Barrier", len)?;
if self.epoch != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("epoch", ToString::to_string(&self.epoch).as_str())?;
}
if self.is_checkpoint {
struct_ser.serialize_field("isCheckpoint", &self.is_checkpoint)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_writer_stream_request::Barrier {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"epoch",
"is_checkpoint",
"isCheckpoint",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Epoch,
IsCheckpoint,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"epoch" => Ok(GeneratedField::Epoch),
"isCheckpoint" | "is_checkpoint" => Ok(GeneratedField::IsCheckpoint),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_writer_stream_request::Barrier;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkWriterStreamRequest.Barrier")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_writer_stream_request::Barrier, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut epoch__ = None;
let mut is_checkpoint__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Epoch => {
if epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("epoch"));
}
epoch__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::IsCheckpoint => {
if is_checkpoint__.is_some() {
return Err(serde::de::Error::duplicate_field("isCheckpoint"));
}
is_checkpoint__ = Some(map_.next_value()?);
}
}
}
Ok(sink_writer_stream_request::Barrier {
epoch: epoch__.unwrap_or_default(),
is_checkpoint: is_checkpoint__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.SinkWriterStreamRequest.Barrier", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_writer_stream_request::StartSink {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.sink_param.is_some() {
len += 1;
}
if self.payload_schema.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkWriterStreamRequest.StartSink", len)?;
if let Some(v) = self.sink_param.as_ref() {
struct_ser.serialize_field("sinkParam", v)?;
}
if let Some(v) = self.payload_schema.as_ref() {
struct_ser.serialize_field("payloadSchema", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_writer_stream_request::StartSink {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"sink_param",
"sinkParam",
"payload_schema",
"payloadSchema",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
SinkParam,
PayloadSchema,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"sinkParam" | "sink_param" => Ok(GeneratedField::SinkParam),
"payloadSchema" | "payload_schema" => Ok(GeneratedField::PayloadSchema),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_writer_stream_request::StartSink;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkWriterStreamRequest.StartSink")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_writer_stream_request::StartSink, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut sink_param__ = None;
let mut payload_schema__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::SinkParam => {
if sink_param__.is_some() {
return Err(serde::de::Error::duplicate_field("sinkParam"));
}
sink_param__ = map_.next_value()?;
}
GeneratedField::PayloadSchema => {
if payload_schema__.is_some() {
return Err(serde::de::Error::duplicate_field("payloadSchema"));
}
payload_schema__ = map_.next_value()?;
}
}
}
Ok(sink_writer_stream_request::StartSink {
sink_param: sink_param__,
payload_schema: payload_schema__,
})
}
}
deserializer.deserialize_struct("connector_service.SinkWriterStreamRequest.StartSink", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_writer_stream_request::WriteBatch {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.batch_id != 0 {
len += 1;
}
if self.epoch != 0 {
len += 1;
}
if self.payload.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkWriterStreamRequest.WriteBatch", len)?;
if self.batch_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("batchId", ToString::to_string(&self.batch_id).as_str())?;
}
if self.epoch != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("epoch", ToString::to_string(&self.epoch).as_str())?;
}
if let Some(v) = self.payload.as_ref() {
match v {
sink_writer_stream_request::write_batch::Payload::StreamChunkPayload(v) => {
struct_ser.serialize_field("streamChunkPayload", v)?;
}
sink_writer_stream_request::write_batch::Payload::StreamChunkRefPointer(v) => {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("streamChunkRefPointer", ToString::to_string(&v).as_str())?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_writer_stream_request::WriteBatch {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"batch_id",
"batchId",
"epoch",
"stream_chunk_payload",
"streamChunkPayload",
"stream_chunk_ref_pointer",
"streamChunkRefPointer",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
BatchId,
Epoch,
StreamChunkPayload,
StreamChunkRefPointer,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"batchId" | "batch_id" => Ok(GeneratedField::BatchId),
"epoch" => Ok(GeneratedField::Epoch),
"streamChunkPayload" | "stream_chunk_payload" => Ok(GeneratedField::StreamChunkPayload),
"streamChunkRefPointer" | "stream_chunk_ref_pointer" => Ok(GeneratedField::StreamChunkRefPointer),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_writer_stream_request::WriteBatch;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkWriterStreamRequest.WriteBatch")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_writer_stream_request::WriteBatch, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut batch_id__ = None;
let mut epoch__ = None;
let mut payload__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::BatchId => {
if batch_id__.is_some() {
return Err(serde::de::Error::duplicate_field("batchId"));
}
batch_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Epoch => {
if epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("epoch"));
}
epoch__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::StreamChunkPayload => {
if payload__.is_some() {
return Err(serde::de::Error::duplicate_field("streamChunkPayload"));
}
payload__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_writer_stream_request::write_batch::Payload::StreamChunkPayload)
;
}
GeneratedField::StreamChunkRefPointer => {
if payload__.is_some() {
return Err(serde::de::Error::duplicate_field("streamChunkRefPointer"));
}
payload__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| sink_writer_stream_request::write_batch::Payload::StreamChunkRefPointer(x.0));
}
}
}
Ok(sink_writer_stream_request::WriteBatch {
batch_id: batch_id__.unwrap_or_default(),
epoch: epoch__.unwrap_or_default(),
payload: payload__,
})
}
}
deserializer.deserialize_struct("connector_service.SinkWriterStreamRequest.WriteBatch", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_writer_stream_request::write_batch::StreamChunkPayload {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if !self.binary_data.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkWriterStreamRequest.WriteBatch.StreamChunkPayload", len)?;
if !self.binary_data.is_empty() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("binaryData", pbjson::private::base64::encode(&self.binary_data).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_writer_stream_request::write_batch::StreamChunkPayload {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"binary_data",
"binaryData",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
BinaryData,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"binaryData" | "binary_data" => Ok(GeneratedField::BinaryData),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_writer_stream_request::write_batch::StreamChunkPayload;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkWriterStreamRequest.WriteBatch.StreamChunkPayload")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_writer_stream_request::write_batch::StreamChunkPayload, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut binary_data__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::BinaryData => {
if binary_data__.is_some() {
return Err(serde::de::Error::duplicate_field("binaryData"));
}
binary_data__ =
Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
;
}
}
}
Ok(sink_writer_stream_request::write_batch::StreamChunkPayload {
binary_data: binary_data__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.SinkWriterStreamRequest.WriteBatch.StreamChunkPayload", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SinkWriterStreamResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.response.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkWriterStreamResponse", len)?;
if let Some(v) = self.response.as_ref() {
match v {
sink_writer_stream_response::Response::Start(v) => {
struct_ser.serialize_field("start", v)?;
}
sink_writer_stream_response::Response::Commit(v) => {
struct_ser.serialize_field("commit", v)?;
}
sink_writer_stream_response::Response::Batch(v) => {
struct_ser.serialize_field("batch", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SinkWriterStreamResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"start",
"commit",
"batch",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Start,
Commit,
Batch,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"start" => Ok(GeneratedField::Start),
"commit" => Ok(GeneratedField::Commit),
"batch" => Ok(GeneratedField::Batch),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SinkWriterStreamResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkWriterStreamResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SinkWriterStreamResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut response__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Start => {
if response__.is_some() {
return Err(serde::de::Error::duplicate_field("start"));
}
response__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_writer_stream_response::Response::Start)
;
}
GeneratedField::Commit => {
if response__.is_some() {
return Err(serde::de::Error::duplicate_field("commit"));
}
response__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_writer_stream_response::Response::Commit)
;
}
GeneratedField::Batch => {
if response__.is_some() {
return Err(serde::de::Error::duplicate_field("batch"));
}
response__ = map_.next_value::<::std::option::Option<_>>()?.map(sink_writer_stream_response::Response::Batch)
;
}
}
}
Ok(SinkWriterStreamResponse {
response: response__,
})
}
}
deserializer.deserialize_struct("connector_service.SinkWriterStreamResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_writer_stream_response::BatchWrittenResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.epoch != 0 {
len += 1;
}
if self.batch_id != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkWriterStreamResponse.BatchWrittenResponse", len)?;
if self.epoch != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("epoch", ToString::to_string(&self.epoch).as_str())?;
}
if self.batch_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("batchId", ToString::to_string(&self.batch_id).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_writer_stream_response::BatchWrittenResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"epoch",
"batch_id",
"batchId",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Epoch,
BatchId,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"epoch" => Ok(GeneratedField::Epoch),
"batchId" | "batch_id" => Ok(GeneratedField::BatchId),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_writer_stream_response::BatchWrittenResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkWriterStreamResponse.BatchWrittenResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_writer_stream_response::BatchWrittenResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut epoch__ = None;
let mut batch_id__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Epoch => {
if epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("epoch"));
}
epoch__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::BatchId => {
if batch_id__.is_some() {
return Err(serde::de::Error::duplicate_field("batchId"));
}
batch_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(sink_writer_stream_response::BatchWrittenResponse {
epoch: epoch__.unwrap_or_default(),
batch_id: batch_id__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.SinkWriterStreamResponse.BatchWrittenResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_writer_stream_response::CommitResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.epoch != 0 {
len += 1;
}
if self.metadata.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.SinkWriterStreamResponse.CommitResponse", len)?;
if self.epoch != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("epoch", ToString::to_string(&self.epoch).as_str())?;
}
if let Some(v) = self.metadata.as_ref() {
struct_ser.serialize_field("metadata", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_writer_stream_response::CommitResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"epoch",
"metadata",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Epoch,
Metadata,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"epoch" => Ok(GeneratedField::Epoch),
"metadata" => Ok(GeneratedField::Metadata),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_writer_stream_response::CommitResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkWriterStreamResponse.CommitResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_writer_stream_response::CommitResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut epoch__ = None;
let mut metadata__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Epoch => {
if epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("epoch"));
}
epoch__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Metadata => {
if metadata__.is_some() {
return Err(serde::de::Error::duplicate_field("metadata"));
}
metadata__ = map_.next_value()?;
}
}
}
Ok(sink_writer_stream_response::CommitResponse {
epoch: epoch__.unwrap_or_default(),
metadata: metadata__,
})
}
}
deserializer.deserialize_struct("connector_service.SinkWriterStreamResponse.CommitResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for sink_writer_stream_response::StartResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let len = 0;
let struct_ser = serializer.serialize_struct("connector_service.SinkWriterStreamResponse.StartResponse", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for sink_writer_stream_response::StartResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
Err(serde::de::Error::unknown_field(value, FIELDS))
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = sink_writer_stream_response::StartResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.SinkWriterStreamResponse.StartResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<sink_writer_stream_response::StartResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(sink_writer_stream_response::StartResponse {
})
}
}
deserializer.deserialize_struct("connector_service.SinkWriterStreamResponse.StartResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SourceType {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "UNSPECIFIED",
Self::Mysql => "MYSQL",
Self::Postgres => "POSTGRES",
Self::Citus => "CITUS",
Self::Mongodb => "MONGODB",
Self::SqlServer => "SQL_SERVER",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for SourceType {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"UNSPECIFIED",
"MYSQL",
"POSTGRES",
"CITUS",
"MONGODB",
"SQL_SERVER",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SourceType;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"UNSPECIFIED" => Ok(SourceType::Unspecified),
"MYSQL" => Ok(SourceType::Mysql),
"POSTGRES" => Ok(SourceType::Postgres),
"CITUS" => Ok(SourceType::Citus),
"MONGODB" => Ok(SourceType::Mongodb),
"SQL_SERVER" => Ok(SourceType::SqlServer),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for TableSchema {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if !self.columns.is_empty() {
len += 1;
}
if !self.pk_indices.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.TableSchema", len)?;
if !self.columns.is_empty() {
struct_ser.serialize_field("columns", &self.columns)?;
}
if !self.pk_indices.is_empty() {
struct_ser.serialize_field("pkIndices", &self.pk_indices)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for TableSchema {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"columns",
"pk_indices",
"pkIndices",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Columns,
PkIndices,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"columns" => Ok(GeneratedField::Columns),
"pkIndices" | "pk_indices" => Ok(GeneratedField::PkIndices),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = TableSchema;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.TableSchema")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<TableSchema, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut columns__ = None;
let mut pk_indices__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Columns => {
if columns__.is_some() {
return Err(serde::de::Error::duplicate_field("columns"));
}
columns__ = Some(map_.next_value()?);
}
GeneratedField::PkIndices => {
if pk_indices__.is_some() {
return Err(serde::de::Error::duplicate_field("pkIndices"));
}
pk_indices__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
}
}
Ok(TableSchema {
columns: columns__.unwrap_or_default(),
pk_indices: pk_indices__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.TableSchema", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for ValidateSinkRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.sink_param.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.ValidateSinkRequest", len)?;
if let Some(v) = self.sink_param.as_ref() {
struct_ser.serialize_field("sinkParam", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ValidateSinkRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"sink_param",
"sinkParam",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
SinkParam,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"sinkParam" | "sink_param" => Ok(GeneratedField::SinkParam),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ValidateSinkRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.ValidateSinkRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ValidateSinkRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut sink_param__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::SinkParam => {
if sink_param__.is_some() {
return Err(serde::de::Error::duplicate_field("sinkParam"));
}
sink_param__ = map_.next_value()?;
}
}
}
Ok(ValidateSinkRequest {
sink_param: sink_param__,
})
}
}
deserializer.deserialize_struct("connector_service.ValidateSinkRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for ValidateSinkResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.error.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.ValidateSinkResponse", len)?;
if let Some(v) = self.error.as_ref() {
struct_ser.serialize_field("error", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ValidateSinkResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"error",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Error,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"error" => Ok(GeneratedField::Error),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ValidateSinkResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.ValidateSinkResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ValidateSinkResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut error__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Error => {
if error__.is_some() {
return Err(serde::de::Error::duplicate_field("error"));
}
error__ = map_.next_value()?;
}
}
}
Ok(ValidateSinkResponse {
error: error__,
})
}
}
deserializer.deserialize_struct("connector_service.ValidateSinkResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for ValidateSourceRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.source_id != 0 {
len += 1;
}
if self.source_type != 0 {
len += 1;
}
if !self.properties.is_empty() {
len += 1;
}
if self.table_schema.is_some() {
len += 1;
}
if self.is_source_job {
len += 1;
}
if self.is_backfill_table {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.ValidateSourceRequest", len)?;
if self.source_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("sourceId", ToString::to_string(&self.source_id).as_str())?;
}
if self.source_type != 0 {
let v = SourceType::try_from(self.source_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.source_type)))?;
struct_ser.serialize_field("sourceType", &v)?;
}
if !self.properties.is_empty() {
struct_ser.serialize_field("properties", &self.properties)?;
}
if let Some(v) = self.table_schema.as_ref() {
struct_ser.serialize_field("tableSchema", v)?;
}
if self.is_source_job {
struct_ser.serialize_field("isSourceJob", &self.is_source_job)?;
}
if self.is_backfill_table {
struct_ser.serialize_field("isBackfillTable", &self.is_backfill_table)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ValidateSourceRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"source_id",
"sourceId",
"source_type",
"sourceType",
"properties",
"table_schema",
"tableSchema",
"is_source_job",
"isSourceJob",
"is_backfill_table",
"isBackfillTable",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
SourceId,
SourceType,
Properties,
TableSchema,
IsSourceJob,
IsBackfillTable,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"sourceId" | "source_id" => Ok(GeneratedField::SourceId),
"sourceType" | "source_type" => Ok(GeneratedField::SourceType),
"properties" => Ok(GeneratedField::Properties),
"tableSchema" | "table_schema" => Ok(GeneratedField::TableSchema),
"isSourceJob" | "is_source_job" => Ok(GeneratedField::IsSourceJob),
"isBackfillTable" | "is_backfill_table" => Ok(GeneratedField::IsBackfillTable),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ValidateSourceRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.ValidateSourceRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ValidateSourceRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut source_id__ = None;
let mut source_type__ = None;
let mut properties__ = None;
let mut table_schema__ = None;
let mut is_source_job__ = None;
let mut is_backfill_table__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::SourceId => {
if source_id__.is_some() {
return Err(serde::de::Error::duplicate_field("sourceId"));
}
source_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SourceType => {
if source_type__.is_some() {
return Err(serde::de::Error::duplicate_field("sourceType"));
}
source_type__ = Some(map_.next_value::<SourceType>()? as i32);
}
GeneratedField::Properties => {
if properties__.is_some() {
return Err(serde::de::Error::duplicate_field("properties"));
}
properties__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::TableSchema => {
if table_schema__.is_some() {
return Err(serde::de::Error::duplicate_field("tableSchema"));
}
table_schema__ = map_.next_value()?;
}
GeneratedField::IsSourceJob => {
if is_source_job__.is_some() {
return Err(serde::de::Error::duplicate_field("isSourceJob"));
}
is_source_job__ = Some(map_.next_value()?);
}
GeneratedField::IsBackfillTable => {
if is_backfill_table__.is_some() {
return Err(serde::de::Error::duplicate_field("isBackfillTable"));
}
is_backfill_table__ = Some(map_.next_value()?);
}
}
}
Ok(ValidateSourceRequest {
source_id: source_id__.unwrap_or_default(),
source_type: source_type__.unwrap_or_default(),
properties: properties__.unwrap_or_default(),
table_schema: table_schema__,
is_source_job: is_source_job__.unwrap_or_default(),
is_backfill_table: is_backfill_table__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.ValidateSourceRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for ValidateSourceResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.error.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.ValidateSourceResponse", len)?;
if let Some(v) = self.error.as_ref() {
struct_ser.serialize_field("error", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ValidateSourceResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"error",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Error,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"error" => Ok(GeneratedField::Error),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ValidateSourceResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.ValidateSourceResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ValidateSourceResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut error__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Error => {
if error__.is_some() {
return Err(serde::de::Error::duplicate_field("error"));
}
error__ = map_.next_value()?;
}
}
}
Ok(ValidateSourceResponse {
error: error__,
})
}
}
deserializer.deserialize_struct("connector_service.ValidateSourceResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for ValidationError {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if !self.error_message.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("connector_service.ValidationError", len)?;
if !self.error_message.is_empty() {
struct_ser.serialize_field("errorMessage", &self.error_message)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ValidationError {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"error_message",
"errorMessage",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
ErrorMessage,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"errorMessage" | "error_message" => Ok(GeneratedField::ErrorMessage),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ValidationError;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct connector_service.ValidationError")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ValidationError, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut error_message__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::ErrorMessage => {
if error_message__.is_some() {
return Err(serde::de::Error::duplicate_field("errorMessage"));
}
error_message__ = Some(map_.next_value()?);
}
}
}
Ok(ValidationError {
error_message: error_message__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("connector_service.ValidationError", FIELDS, GeneratedVisitor)
}
}