use crate::compactor::*;
impl serde::Serialize for DispatchCompactionTaskRequest {
#[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.tables.is_empty() {
len += 1;
}
if !self.output_object_ids.is_empty() {
len += 1;
}
if self.task.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("compactor.DispatchCompactionTaskRequest", len)?;
if !self.tables.is_empty() {
struct_ser.serialize_field("tables", &self.tables)?;
}
if !self.output_object_ids.is_empty() {
struct_ser.serialize_field("outputObjectIds", &self.output_object_ids.iter().map(ToString::to_string).collect::<Vec<_>>())?;
}
if let Some(v) = self.task.as_ref() {
match v {
dispatch_compaction_task_request::Task::CompactTask(v) => {
struct_ser.serialize_field("compactTask", v)?;
}
dispatch_compaction_task_request::Task::VacuumTask(v) => {
struct_ser.serialize_field("vacuumTask", v)?;
}
dispatch_compaction_task_request::Task::FullScanTask(v) => {
struct_ser.serialize_field("fullScanTask", v)?;
}
dispatch_compaction_task_request::Task::ValidationTask(v) => {
struct_ser.serialize_field("validationTask", v)?;
}
dispatch_compaction_task_request::Task::CancelCompactTask(v) => {
struct_ser.serialize_field("cancelCompactTask", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for DispatchCompactionTaskRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"tables",
"output_object_ids",
"outputObjectIds",
"compact_task",
"compactTask",
"vacuum_task",
"vacuumTask",
"full_scan_task",
"fullScanTask",
"validation_task",
"validationTask",
"cancel_compact_task",
"cancelCompactTask",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Tables,
OutputObjectIds,
CompactTask,
VacuumTask,
FullScanTask,
ValidationTask,
CancelCompactTask,
}
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 {
"tables" => Ok(GeneratedField::Tables),
"outputObjectIds" | "output_object_ids" => Ok(GeneratedField::OutputObjectIds),
"compactTask" | "compact_task" => Ok(GeneratedField::CompactTask),
"vacuumTask" | "vacuum_task" => Ok(GeneratedField::VacuumTask),
"fullScanTask" | "full_scan_task" => Ok(GeneratedField::FullScanTask),
"validationTask" | "validation_task" => Ok(GeneratedField::ValidationTask),
"cancelCompactTask" | "cancel_compact_task" => Ok(GeneratedField::CancelCompactTask),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = DispatchCompactionTaskRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct compactor.DispatchCompactionTaskRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<DispatchCompactionTaskRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut tables__ = None;
let mut output_object_ids__ = None;
let mut task__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Tables => {
if tables__.is_some() {
return Err(serde::de::Error::duplicate_field("tables"));
}
tables__ = Some(map_.next_value()?);
}
GeneratedField::OutputObjectIds => {
if output_object_ids__.is_some() {
return Err(serde::de::Error::duplicate_field("outputObjectIds"));
}
output_object_ids__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::CompactTask => {
if task__.is_some() {
return Err(serde::de::Error::duplicate_field("compactTask"));
}
task__ = map_.next_value::<::std::option::Option<_>>()?.map(dispatch_compaction_task_request::Task::CompactTask)
;
}
GeneratedField::VacuumTask => {
if task__.is_some() {
return Err(serde::de::Error::duplicate_field("vacuumTask"));
}
task__ = map_.next_value::<::std::option::Option<_>>()?.map(dispatch_compaction_task_request::Task::VacuumTask)
;
}
GeneratedField::FullScanTask => {
if task__.is_some() {
return Err(serde::de::Error::duplicate_field("fullScanTask"));
}
task__ = map_.next_value::<::std::option::Option<_>>()?.map(dispatch_compaction_task_request::Task::FullScanTask)
;
}
GeneratedField::ValidationTask => {
if task__.is_some() {
return Err(serde::de::Error::duplicate_field("validationTask"));
}
task__ = map_.next_value::<::std::option::Option<_>>()?.map(dispatch_compaction_task_request::Task::ValidationTask)
;
}
GeneratedField::CancelCompactTask => {
if task__.is_some() {
return Err(serde::de::Error::duplicate_field("cancelCompactTask"));
}
task__ = map_.next_value::<::std::option::Option<_>>()?.map(dispatch_compaction_task_request::Task::CancelCompactTask)
;
}
}
}
Ok(DispatchCompactionTaskRequest {
tables: tables__.unwrap_or_default(),
output_object_ids: output_object_ids__.unwrap_or_default(),
task: task__,
})
}
}
deserializer.deserialize_struct("compactor.DispatchCompactionTaskRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for DispatchCompactionTaskResponse {
#[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.status.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("compactor.DispatchCompactionTaskResponse", len)?;
if let Some(v) = self.status.as_ref() {
struct_ser.serialize_field("status", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for DispatchCompactionTaskResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"status",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Status,
}
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 {
"status" => Ok(GeneratedField::Status),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = DispatchCompactionTaskResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct compactor.DispatchCompactionTaskResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<DispatchCompactionTaskResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut status__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Status => {
if status__.is_some() {
return Err(serde::de::Error::duplicate_field("status"));
}
status__ = map_.next_value()?;
}
}
}
Ok(DispatchCompactionTaskResponse {
status: status__,
})
}
}
deserializer.deserialize_struct("compactor.DispatchCompactionTaskResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for EchoRequest {
#[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("compactor.EchoRequest", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for EchoRequest {
#[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 = EchoRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct compactor.EchoRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<EchoRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(EchoRequest {
})
}
}
deserializer.deserialize_struct("compactor.EchoRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for EchoResponse {
#[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("compactor.EchoResponse", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for EchoResponse {
#[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 = EchoResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct compactor.EchoResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<EchoResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(EchoResponse {
})
}
}
deserializer.deserialize_struct("compactor.EchoResponse", FIELDS, GeneratedVisitor)
}
}