use crate::telemetry::*;
impl serde::Serialize for CompactorReport {
#[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.base.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.CompactorReport", len)?;
if let Some(v) = self.base.as_ref() {
struct_ser.serialize_field("base", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for CompactorReport {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"base",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Base,
}
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 {
"base" => Ok(GeneratedField::Base),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = CompactorReport;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.CompactorReport")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<CompactorReport, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut base__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Base => {
if base__.is_some() {
return Err(serde::de::Error::duplicate_field("base"));
}
base__ = map_.next_value()?;
}
}
}
Ok(CompactorReport {
base: base__,
})
}
}
deserializer.deserialize_struct("telemetry.CompactorReport", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for ComputeReport {
#[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.base.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.ComputeReport", len)?;
if let Some(v) = self.base.as_ref() {
struct_ser.serialize_field("base", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ComputeReport {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"base",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Base,
}
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 {
"base" => Ok(GeneratedField::Base),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ComputeReport;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.ComputeReport")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ComputeReport, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut base__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Base => {
if base__.is_some() {
return Err(serde::de::Error::duplicate_field("base"));
}
base__ = map_.next_value()?;
}
}
}
Ok(ComputeReport {
base: base__,
})
}
}
deserializer.deserialize_struct("telemetry.ComputeReport", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for EventMessage {
#[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.tracking_id.is_empty() {
len += 1;
}
if self.event_time_sec != 0 {
len += 1;
}
if self.event_stage != 0 {
len += 1;
}
if !self.event_name.is_empty() {
len += 1;
}
if self.connector_name.is_some() {
len += 1;
}
if self.object.is_some() {
len += 1;
}
if self.catalog_id != 0 {
len += 1;
}
if self.attributes.is_some() {
len += 1;
}
if !self.node.is_empty() {
len += 1;
}
if self.is_test {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.EventMessage", len)?;
if !self.tracking_id.is_empty() {
struct_ser.serialize_field("trackingId", &self.tracking_id)?;
}
if self.event_time_sec != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("eventTimeSec", ToString::to_string(&self.event_time_sec).as_str())?;
}
if self.event_stage != 0 {
let v = TelemetryEventStage::try_from(self.event_stage)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.event_stage)))?;
struct_ser.serialize_field("eventStage", &v)?;
}
if !self.event_name.is_empty() {
struct_ser.serialize_field("eventName", &self.event_name)?;
}
if let Some(v) = self.connector_name.as_ref() {
struct_ser.serialize_field("connectorName", v)?;
}
if let Some(v) = self.object.as_ref() {
let v = TelemetryDatabaseObject::try_from(*v)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
struct_ser.serialize_field("object", &v)?;
}
if self.catalog_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("catalogId", ToString::to_string(&self.catalog_id).as_str())?;
}
if let Some(v) = self.attributes.as_ref() {
struct_ser.serialize_field("attributes", v)?;
}
if !self.node.is_empty() {
struct_ser.serialize_field("node", &self.node)?;
}
if self.is_test {
struct_ser.serialize_field("isTest", &self.is_test)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for EventMessage {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"tracking_id",
"trackingId",
"event_time_sec",
"eventTimeSec",
"event_stage",
"eventStage",
"event_name",
"eventName",
"connector_name",
"connectorName",
"object",
"catalog_id",
"catalogId",
"attributes",
"node",
"is_test",
"isTest",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
TrackingId,
EventTimeSec,
EventStage,
EventName,
ConnectorName,
Object,
CatalogId,
Attributes,
Node,
IsTest,
}
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 {
"trackingId" | "tracking_id" => Ok(GeneratedField::TrackingId),
"eventTimeSec" | "event_time_sec" => Ok(GeneratedField::EventTimeSec),
"eventStage" | "event_stage" => Ok(GeneratedField::EventStage),
"eventName" | "event_name" => Ok(GeneratedField::EventName),
"connectorName" | "connector_name" => Ok(GeneratedField::ConnectorName),
"object" => Ok(GeneratedField::Object),
"catalogId" | "catalog_id" => Ok(GeneratedField::CatalogId),
"attributes" => Ok(GeneratedField::Attributes),
"node" => Ok(GeneratedField::Node),
"isTest" | "is_test" => Ok(GeneratedField::IsTest),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = EventMessage;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.EventMessage")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<EventMessage, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut tracking_id__ = None;
let mut event_time_sec__ = None;
let mut event_stage__ = None;
let mut event_name__ = None;
let mut connector_name__ = None;
let mut object__ = None;
let mut catalog_id__ = None;
let mut attributes__ = None;
let mut node__ = None;
let mut is_test__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::TrackingId => {
if tracking_id__.is_some() {
return Err(serde::de::Error::duplicate_field("trackingId"));
}
tracking_id__ = Some(map_.next_value()?);
}
GeneratedField::EventTimeSec => {
if event_time_sec__.is_some() {
return Err(serde::de::Error::duplicate_field("eventTimeSec"));
}
event_time_sec__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::EventStage => {
if event_stage__.is_some() {
return Err(serde::de::Error::duplicate_field("eventStage"));
}
event_stage__ = Some(map_.next_value::<TelemetryEventStage>()? as i32);
}
GeneratedField::EventName => {
if event_name__.is_some() {
return Err(serde::de::Error::duplicate_field("eventName"));
}
event_name__ = Some(map_.next_value()?);
}
GeneratedField::ConnectorName => {
if connector_name__.is_some() {
return Err(serde::de::Error::duplicate_field("connectorName"));
}
connector_name__ = map_.next_value()?;
}
GeneratedField::Object => {
if object__.is_some() {
return Err(serde::de::Error::duplicate_field("object"));
}
object__ = map_.next_value::<::std::option::Option<TelemetryDatabaseObject>>()?.map(|x| x as i32);
}
GeneratedField::CatalogId => {
if catalog_id__.is_some() {
return Err(serde::de::Error::duplicate_field("catalogId"));
}
catalog_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Attributes => {
if attributes__.is_some() {
return Err(serde::de::Error::duplicate_field("attributes"));
}
attributes__ = map_.next_value()?;
}
GeneratedField::Node => {
if node__.is_some() {
return Err(serde::de::Error::duplicate_field("node"));
}
node__ = Some(map_.next_value()?);
}
GeneratedField::IsTest => {
if is_test__.is_some() {
return Err(serde::de::Error::duplicate_field("isTest"));
}
is_test__ = Some(map_.next_value()?);
}
}
}
Ok(EventMessage {
tracking_id: tracking_id__.unwrap_or_default(),
event_time_sec: event_time_sec__.unwrap_or_default(),
event_stage: event_stage__.unwrap_or_default(),
event_name: event_name__.unwrap_or_default(),
connector_name: connector_name__,
object: object__,
catalog_id: catalog_id__.unwrap_or_default(),
attributes: attributes__,
node: node__.unwrap_or_default(),
is_test: is_test__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("telemetry.EventMessage", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for FrontendReport {
#[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.base.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.FrontendReport", len)?;
if let Some(v) = self.base.as_ref() {
struct_ser.serialize_field("base", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for FrontendReport {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"base",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Base,
}
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 {
"base" => Ok(GeneratedField::Base),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = FrontendReport;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.FrontendReport")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<FrontendReport, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut base__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Base => {
if base__.is_some() {
return Err(serde::de::Error::duplicate_field("base"));
}
base__ = map_.next_value()?;
}
}
}
Ok(FrontendReport {
base: base__,
})
}
}
deserializer.deserialize_struct("telemetry.FrontendReport", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for MetaBackend {
#[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 => "META_BACKEND_UNSPECIFIED",
Self::Memory => "META_BACKEND_MEMORY",
Self::Rdb => "META_BACKEND_RDB",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for MetaBackend {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"META_BACKEND_UNSPECIFIED",
"META_BACKEND_MEMORY",
"META_BACKEND_RDB",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = MetaBackend;
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 {
"META_BACKEND_UNSPECIFIED" => Ok(MetaBackend::Unspecified),
"META_BACKEND_MEMORY" => Ok(MetaBackend::Memory),
"META_BACKEND_RDB" => Ok(MetaBackend::Rdb),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for MetaReport {
#[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.base.is_some() {
len += 1;
}
if self.meta_backend != 0 {
len += 1;
}
if self.node_count.is_some() {
len += 1;
}
if self.rw_version.is_some() {
len += 1;
}
if self.stream_job_count != 0 {
len += 1;
}
if !self.stream_jobs.is_empty() {
len += 1;
}
if self.cluster_type != 0 {
len += 1;
}
if !self.object_store_media_type.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.MetaReport", len)?;
if let Some(v) = self.base.as_ref() {
struct_ser.serialize_field("base", v)?;
}
if self.meta_backend != 0 {
let v = MetaBackend::try_from(self.meta_backend)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.meta_backend)))?;
struct_ser.serialize_field("metaBackend", &v)?;
}
if let Some(v) = self.node_count.as_ref() {
struct_ser.serialize_field("nodeCount", v)?;
}
if let Some(v) = self.rw_version.as_ref() {
struct_ser.serialize_field("rwVersion", v)?;
}
if self.stream_job_count != 0 {
struct_ser.serialize_field("streamJobCount", &self.stream_job_count)?;
}
if !self.stream_jobs.is_empty() {
struct_ser.serialize_field("streamJobs", &self.stream_jobs)?;
}
if self.cluster_type != 0 {
let v = TelemetryClusterType::try_from(self.cluster_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.cluster_type)))?;
struct_ser.serialize_field("clusterType", &v)?;
}
if !self.object_store_media_type.is_empty() {
struct_ser.serialize_field("objectStoreMediaType", &self.object_store_media_type)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for MetaReport {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"base",
"meta_backend",
"metaBackend",
"node_count",
"nodeCount",
"rw_version",
"rwVersion",
"stream_job_count",
"streamJobCount",
"stream_jobs",
"streamJobs",
"cluster_type",
"clusterType",
"object_store_media_type",
"objectStoreMediaType",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Base,
MetaBackend,
NodeCount,
RwVersion,
StreamJobCount,
StreamJobs,
ClusterType,
ObjectStoreMediaType,
}
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 {
"base" => Ok(GeneratedField::Base),
"metaBackend" | "meta_backend" => Ok(GeneratedField::MetaBackend),
"nodeCount" | "node_count" => Ok(GeneratedField::NodeCount),
"rwVersion" | "rw_version" => Ok(GeneratedField::RwVersion),
"streamJobCount" | "stream_job_count" => Ok(GeneratedField::StreamJobCount),
"streamJobs" | "stream_jobs" => Ok(GeneratedField::StreamJobs),
"clusterType" | "cluster_type" => Ok(GeneratedField::ClusterType),
"objectStoreMediaType" | "object_store_media_type" => Ok(GeneratedField::ObjectStoreMediaType),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = MetaReport;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.MetaReport")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<MetaReport, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut base__ = None;
let mut meta_backend__ = None;
let mut node_count__ = None;
let mut rw_version__ = None;
let mut stream_job_count__ = None;
let mut stream_jobs__ = None;
let mut cluster_type__ = None;
let mut object_store_media_type__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Base => {
if base__.is_some() {
return Err(serde::de::Error::duplicate_field("base"));
}
base__ = map_.next_value()?;
}
GeneratedField::MetaBackend => {
if meta_backend__.is_some() {
return Err(serde::de::Error::duplicate_field("metaBackend"));
}
meta_backend__ = Some(map_.next_value::<MetaBackend>()? as i32);
}
GeneratedField::NodeCount => {
if node_count__.is_some() {
return Err(serde::de::Error::duplicate_field("nodeCount"));
}
node_count__ = map_.next_value()?;
}
GeneratedField::RwVersion => {
if rw_version__.is_some() {
return Err(serde::de::Error::duplicate_field("rwVersion"));
}
rw_version__ = map_.next_value()?;
}
GeneratedField::StreamJobCount => {
if stream_job_count__.is_some() {
return Err(serde::de::Error::duplicate_field("streamJobCount"));
}
stream_job_count__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::StreamJobs => {
if stream_jobs__.is_some() {
return Err(serde::de::Error::duplicate_field("streamJobs"));
}
stream_jobs__ = Some(map_.next_value()?);
}
GeneratedField::ClusterType => {
if cluster_type__.is_some() {
return Err(serde::de::Error::duplicate_field("clusterType"));
}
cluster_type__ = Some(map_.next_value::<TelemetryClusterType>()? as i32);
}
GeneratedField::ObjectStoreMediaType => {
if object_store_media_type__.is_some() {
return Err(serde::de::Error::duplicate_field("objectStoreMediaType"));
}
object_store_media_type__ = Some(map_.next_value()?);
}
}
}
Ok(MetaReport {
base: base__,
meta_backend: meta_backend__.unwrap_or_default(),
node_count: node_count__,
rw_version: rw_version__,
stream_job_count: stream_job_count__.unwrap_or_default(),
stream_jobs: stream_jobs__.unwrap_or_default(),
cluster_type: cluster_type__.unwrap_or_default(),
object_store_media_type: object_store_media_type__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("telemetry.MetaReport", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for NodeCount {
#[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.meta != 0 {
len += 1;
}
if self.compute != 0 {
len += 1;
}
if self.frontend != 0 {
len += 1;
}
if self.compactor != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.NodeCount", len)?;
if self.meta != 0 {
struct_ser.serialize_field("meta", &self.meta)?;
}
if self.compute != 0 {
struct_ser.serialize_field("compute", &self.compute)?;
}
if self.frontend != 0 {
struct_ser.serialize_field("frontend", &self.frontend)?;
}
if self.compactor != 0 {
struct_ser.serialize_field("compactor", &self.compactor)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for NodeCount {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"meta",
"compute",
"frontend",
"compactor",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Meta,
Compute,
Frontend,
Compactor,
}
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 {
"meta" => Ok(GeneratedField::Meta),
"compute" => Ok(GeneratedField::Compute),
"frontend" => Ok(GeneratedField::Frontend),
"compactor" => Ok(GeneratedField::Compactor),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = NodeCount;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.NodeCount")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<NodeCount, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut meta__ = None;
let mut compute__ = None;
let mut frontend__ = None;
let mut compactor__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Meta => {
if meta__.is_some() {
return Err(serde::de::Error::duplicate_field("meta"));
}
meta__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Compute => {
if compute__.is_some() {
return Err(serde::de::Error::duplicate_field("compute"));
}
compute__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Frontend => {
if frontend__.is_some() {
return Err(serde::de::Error::duplicate_field("frontend"));
}
frontend__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Compactor => {
if compactor__.is_some() {
return Err(serde::de::Error::duplicate_field("compactor"));
}
compactor__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(NodeCount {
meta: meta__.unwrap_or_default(),
compute: compute__.unwrap_or_default(),
frontend: frontend__.unwrap_or_default(),
compactor: compactor__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("telemetry.NodeCount", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for PlanOptimization {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::TableOptimizationUnspecified => "TABLE_OPTIMIZATION_UNSPECIFIED",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for PlanOptimization {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"TABLE_OPTIMIZATION_UNSPECIFIED",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = PlanOptimization;
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 {
"TABLE_OPTIMIZATION_UNSPECIFIED" => Ok(PlanOptimization::TableOptimizationUnspecified),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for ReportBase {
#[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.tracking_id.is_empty() {
len += 1;
}
if !self.session_id.is_empty() {
len += 1;
}
if self.system_data.is_some() {
len += 1;
}
if self.up_time != 0 {
len += 1;
}
if self.report_time != 0 {
len += 1;
}
if self.node_type != 0 {
len += 1;
}
if self.is_test {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.ReportBase", len)?;
if !self.tracking_id.is_empty() {
struct_ser.serialize_field("trackingId", &self.tracking_id)?;
}
if !self.session_id.is_empty() {
struct_ser.serialize_field("sessionId", &self.session_id)?;
}
if let Some(v) = self.system_data.as_ref() {
struct_ser.serialize_field("systemData", v)?;
}
if self.up_time != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("upTime", ToString::to_string(&self.up_time).as_str())?;
}
if self.report_time != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("reportTime", ToString::to_string(&self.report_time).as_str())?;
}
if self.node_type != 0 {
let v = TelemetryNodeType::try_from(self.node_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.node_type)))?;
struct_ser.serialize_field("nodeType", &v)?;
}
if self.is_test {
struct_ser.serialize_field("isTest", &self.is_test)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ReportBase {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"tracking_id",
"trackingId",
"session_id",
"sessionId",
"system_data",
"systemData",
"up_time",
"upTime",
"report_time",
"reportTime",
"node_type",
"nodeType",
"is_test",
"isTest",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
TrackingId,
SessionId,
SystemData,
UpTime,
ReportTime,
NodeType,
IsTest,
}
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 {
"trackingId" | "tracking_id" => Ok(GeneratedField::TrackingId),
"sessionId" | "session_id" => Ok(GeneratedField::SessionId),
"systemData" | "system_data" => Ok(GeneratedField::SystemData),
"upTime" | "up_time" => Ok(GeneratedField::UpTime),
"reportTime" | "report_time" => Ok(GeneratedField::ReportTime),
"nodeType" | "node_type" => Ok(GeneratedField::NodeType),
"isTest" | "is_test" => Ok(GeneratedField::IsTest),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ReportBase;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.ReportBase")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ReportBase, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut tracking_id__ = None;
let mut session_id__ = None;
let mut system_data__ = None;
let mut up_time__ = None;
let mut report_time__ = None;
let mut node_type__ = None;
let mut is_test__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::TrackingId => {
if tracking_id__.is_some() {
return Err(serde::de::Error::duplicate_field("trackingId"));
}
tracking_id__ = Some(map_.next_value()?);
}
GeneratedField::SessionId => {
if session_id__.is_some() {
return Err(serde::de::Error::duplicate_field("sessionId"));
}
session_id__ = Some(map_.next_value()?);
}
GeneratedField::SystemData => {
if system_data__.is_some() {
return Err(serde::de::Error::duplicate_field("systemData"));
}
system_data__ = map_.next_value()?;
}
GeneratedField::UpTime => {
if up_time__.is_some() {
return Err(serde::de::Error::duplicate_field("upTime"));
}
up_time__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::ReportTime => {
if report_time__.is_some() {
return Err(serde::de::Error::duplicate_field("reportTime"));
}
report_time__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::NodeType => {
if node_type__.is_some() {
return Err(serde::de::Error::duplicate_field("nodeType"));
}
node_type__ = Some(map_.next_value::<TelemetryNodeType>()? as i32);
}
GeneratedField::IsTest => {
if is_test__.is_some() {
return Err(serde::de::Error::duplicate_field("isTest"));
}
is_test__ = Some(map_.next_value()?);
}
}
}
Ok(ReportBase {
tracking_id: tracking_id__.unwrap_or_default(),
session_id: session_id__.unwrap_or_default(),
system_data: system_data__,
up_time: up_time__.unwrap_or_default(),
report_time: report_time__.unwrap_or_default(),
node_type: node_type__.unwrap_or_default(),
is_test: is_test__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("telemetry.ReportBase", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for RwVersion {
#[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.rw_version.is_empty() {
len += 1;
}
if !self.git_sha.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.RwVersion", len)?;
if !self.rw_version.is_empty() {
struct_ser.serialize_field("rwVersion", &self.rw_version)?;
}
if !self.git_sha.is_empty() {
struct_ser.serialize_field("gitSha", &self.git_sha)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for RwVersion {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"rw_version",
"rwVersion",
"git_sha",
"gitSha",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
RwVersion,
GitSha,
}
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 {
"rwVersion" | "rw_version" => Ok(GeneratedField::RwVersion),
"gitSha" | "git_sha" => Ok(GeneratedField::GitSha),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = RwVersion;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.RwVersion")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<RwVersion, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut rw_version__ = None;
let mut git_sha__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::RwVersion => {
if rw_version__.is_some() {
return Err(serde::de::Error::duplicate_field("rwVersion"));
}
rw_version__ = Some(map_.next_value()?);
}
GeneratedField::GitSha => {
if git_sha__.is_some() {
return Err(serde::de::Error::duplicate_field("gitSha"));
}
git_sha__ = Some(map_.next_value()?);
}
}
}
Ok(RwVersion {
rw_version: rw_version__.unwrap_or_default(),
git_sha: git_sha__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("telemetry.RwVersion", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for StreamJobDesc {
#[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.table_id != 0 {
len += 1;
}
if self.connector_name.is_some() {
len += 1;
}
if !self.plan_optimizations.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.StreamJobDesc", len)?;
if self.table_id != 0 {
struct_ser.serialize_field("tableId", &self.table_id)?;
}
if let Some(v) = self.connector_name.as_ref() {
struct_ser.serialize_field("connectorName", v)?;
}
if !self.plan_optimizations.is_empty() {
let v = self.plan_optimizations.iter().cloned().map(|v| {
PlanOptimization::try_from(v)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", v)))
}).collect::<std::result::Result<Vec<_>, _>>()?;
struct_ser.serialize_field("planOptimizations", &v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for StreamJobDesc {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"table_id",
"tableId",
"connector_name",
"connectorName",
"plan_optimizations",
"planOptimizations",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
TableId,
ConnectorName,
PlanOptimizations,
}
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 {
"tableId" | "table_id" => Ok(GeneratedField::TableId),
"connectorName" | "connector_name" => Ok(GeneratedField::ConnectorName),
"planOptimizations" | "plan_optimizations" => Ok(GeneratedField::PlanOptimizations),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = StreamJobDesc;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.StreamJobDesc")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<StreamJobDesc, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut table_id__ = None;
let mut connector_name__ = None;
let mut plan_optimizations__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::TableId => {
if table_id__.is_some() {
return Err(serde::de::Error::duplicate_field("tableId"));
}
table_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::ConnectorName => {
if connector_name__.is_some() {
return Err(serde::de::Error::duplicate_field("connectorName"));
}
connector_name__ = map_.next_value()?;
}
GeneratedField::PlanOptimizations => {
if plan_optimizations__.is_some() {
return Err(serde::de::Error::duplicate_field("planOptimizations"));
}
plan_optimizations__ = Some(map_.next_value::<Vec<PlanOptimization>>()?.into_iter().map(|x| x as i32).collect());
}
}
}
Ok(StreamJobDesc {
table_id: table_id__.unwrap_or_default(),
connector_name: connector_name__,
plan_optimizations: plan_optimizations__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("telemetry.StreamJobDesc", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SystemCpu {
#[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.available != 0. {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.SystemCpu", len)?;
if self.available != 0. {
struct_ser.serialize_field("available", &self.available)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SystemCpu {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"available",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Available,
}
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 {
"available" => Ok(GeneratedField::Available),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SystemCpu;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.SystemCpu")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SystemCpu, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut available__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Available => {
if available__.is_some() {
return Err(serde::de::Error::duplicate_field("available"));
}
available__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(SystemCpu {
available: available__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("telemetry.SystemCpu", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SystemData {
#[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.memory.is_some() {
len += 1;
}
if self.os.is_some() {
len += 1;
}
if self.cpu.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.SystemData", len)?;
if let Some(v) = self.memory.as_ref() {
struct_ser.serialize_field("memory", v)?;
}
if let Some(v) = self.os.as_ref() {
struct_ser.serialize_field("os", v)?;
}
if let Some(v) = self.cpu.as_ref() {
struct_ser.serialize_field("cpu", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SystemData {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"memory",
"os",
"cpu",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Memory,
Os,
Cpu,
}
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 {
"memory" => Ok(GeneratedField::Memory),
"os" => Ok(GeneratedField::Os),
"cpu" => Ok(GeneratedField::Cpu),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SystemData;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.SystemData")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SystemData, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut memory__ = None;
let mut os__ = None;
let mut cpu__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Memory => {
if memory__.is_some() {
return Err(serde::de::Error::duplicate_field("memory"));
}
memory__ = map_.next_value()?;
}
GeneratedField::Os => {
if os__.is_some() {
return Err(serde::de::Error::duplicate_field("os"));
}
os__ = map_.next_value()?;
}
GeneratedField::Cpu => {
if cpu__.is_some() {
return Err(serde::de::Error::duplicate_field("cpu"));
}
cpu__ = map_.next_value()?;
}
}
}
Ok(SystemData {
memory: memory__,
os: os__,
cpu: cpu__,
})
}
}
deserializer.deserialize_struct("telemetry.SystemData", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SystemMemory {
#[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.used != 0 {
len += 1;
}
if self.total != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.SystemMemory", len)?;
if self.used != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("used", ToString::to_string(&self.used).as_str())?;
}
if self.total != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("total", ToString::to_string(&self.total).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SystemMemory {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"used",
"total",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Used,
Total,
}
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 {
"used" => Ok(GeneratedField::Used),
"total" => Ok(GeneratedField::Total),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SystemMemory;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.SystemMemory")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SystemMemory, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut used__ = None;
let mut total__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Used => {
if used__.is_some() {
return Err(serde::de::Error::duplicate_field("used"));
}
used__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Total => {
if total__.is_some() {
return Err(serde::de::Error::duplicate_field("total"));
}
total__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(SystemMemory {
used: used__.unwrap_or_default(),
total: total__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("telemetry.SystemMemory", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SystemOs {
#[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.name.is_empty() {
len += 1;
}
if !self.version.is_empty() {
len += 1;
}
if !self.kernel_version.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("telemetry.SystemOs", len)?;
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if !self.version.is_empty() {
struct_ser.serialize_field("version", &self.version)?;
}
if !self.kernel_version.is_empty() {
struct_ser.serialize_field("kernelVersion", &self.kernel_version)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SystemOs {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"name",
"version",
"kernel_version",
"kernelVersion",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Name,
Version,
KernelVersion,
}
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 {
"name" => Ok(GeneratedField::Name),
"version" => Ok(GeneratedField::Version),
"kernelVersion" | "kernel_version" => Ok(GeneratedField::KernelVersion),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SystemOs;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct telemetry.SystemOs")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SystemOs, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut name__ = None;
let mut version__ = None;
let mut kernel_version__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Version => {
if version__.is_some() {
return Err(serde::de::Error::duplicate_field("version"));
}
version__ = Some(map_.next_value()?);
}
GeneratedField::KernelVersion => {
if kernel_version__.is_some() {
return Err(serde::de::Error::duplicate_field("kernelVersion"));
}
kernel_version__ = Some(map_.next_value()?);
}
}
}
Ok(SystemOs {
name: name__.unwrap_or_default(),
version: version__.unwrap_or_default(),
kernel_version: kernel_version__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("telemetry.SystemOs", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for TelemetryClusterType {
#[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 => "TELEMETRY_CLUSTER_TYPE_UNSPECIFIED",
Self::SingleNode => "TELEMETRY_CLUSTER_TYPE_SINGLE_NODE",
Self::DockerCompose => "TELEMETRY_CLUSTER_TYPE_DOCKER_COMPOSE",
Self::Kubernetes => "TELEMETRY_CLUSTER_TYPE_KUBERNETES",
Self::CloudHosted => "TELEMETRY_CLUSTER_TYPE_CLOUD_HOSTED",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for TelemetryClusterType {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"TELEMETRY_CLUSTER_TYPE_UNSPECIFIED",
"TELEMETRY_CLUSTER_TYPE_SINGLE_NODE",
"TELEMETRY_CLUSTER_TYPE_DOCKER_COMPOSE",
"TELEMETRY_CLUSTER_TYPE_KUBERNETES",
"TELEMETRY_CLUSTER_TYPE_CLOUD_HOSTED",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = TelemetryClusterType;
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 {
"TELEMETRY_CLUSTER_TYPE_UNSPECIFIED" => Ok(TelemetryClusterType::Unspecified),
"TELEMETRY_CLUSTER_TYPE_SINGLE_NODE" => Ok(TelemetryClusterType::SingleNode),
"TELEMETRY_CLUSTER_TYPE_DOCKER_COMPOSE" => Ok(TelemetryClusterType::DockerCompose),
"TELEMETRY_CLUSTER_TYPE_KUBERNETES" => Ok(TelemetryClusterType::Kubernetes),
"TELEMETRY_CLUSTER_TYPE_CLOUD_HOSTED" => Ok(TelemetryClusterType::CloudHosted),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for TelemetryDatabaseObject {
#[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 => "TELEMETRY_DATABASE_OBJECT_UNSPECIFIED",
Self::Source => "TELEMETRY_DATABASE_OBJECT_SOURCE",
Self::Mv => "TELEMETRY_DATABASE_OBJECT_MV",
Self::Table => "TELEMETRY_DATABASE_OBJECT_TABLE",
Self::Sink => "TELEMETRY_DATABASE_OBJECT_SINK",
Self::Index => "TELEMETRY_DATABASE_OBJECT_INDEX",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for TelemetryDatabaseObject {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"TELEMETRY_DATABASE_OBJECT_UNSPECIFIED",
"TELEMETRY_DATABASE_OBJECT_SOURCE",
"TELEMETRY_DATABASE_OBJECT_MV",
"TELEMETRY_DATABASE_OBJECT_TABLE",
"TELEMETRY_DATABASE_OBJECT_SINK",
"TELEMETRY_DATABASE_OBJECT_INDEX",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = TelemetryDatabaseObject;
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 {
"TELEMETRY_DATABASE_OBJECT_UNSPECIFIED" => Ok(TelemetryDatabaseObject::Unspecified),
"TELEMETRY_DATABASE_OBJECT_SOURCE" => Ok(TelemetryDatabaseObject::Source),
"TELEMETRY_DATABASE_OBJECT_MV" => Ok(TelemetryDatabaseObject::Mv),
"TELEMETRY_DATABASE_OBJECT_TABLE" => Ok(TelemetryDatabaseObject::Table),
"TELEMETRY_DATABASE_OBJECT_SINK" => Ok(TelemetryDatabaseObject::Sink),
"TELEMETRY_DATABASE_OBJECT_INDEX" => Ok(TelemetryDatabaseObject::Index),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for TelemetryEventStage {
#[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 => "TELEMETRY_EVENT_STAGE_UNSPECIFIED",
Self::CreateStreamJob => "TELEMETRY_EVENT_STAGE_CREATE_STREAM_JOB",
Self::UpdateStreamJob => "TELEMETRY_EVENT_STAGE_UPDATE_STREAM_JOB",
Self::DropStreamJob => "TELEMETRY_EVENT_STAGE_DROP_STREAM_JOB",
Self::Query => "TELEMETRY_EVENT_STAGE_QUERY",
Self::Recovery => "TELEMETRY_EVENT_STAGE_RECOVERY",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for TelemetryEventStage {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"TELEMETRY_EVENT_STAGE_UNSPECIFIED",
"TELEMETRY_EVENT_STAGE_CREATE_STREAM_JOB",
"TELEMETRY_EVENT_STAGE_UPDATE_STREAM_JOB",
"TELEMETRY_EVENT_STAGE_DROP_STREAM_JOB",
"TELEMETRY_EVENT_STAGE_QUERY",
"TELEMETRY_EVENT_STAGE_RECOVERY",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = TelemetryEventStage;
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 {
"TELEMETRY_EVENT_STAGE_UNSPECIFIED" => Ok(TelemetryEventStage::Unspecified),
"TELEMETRY_EVENT_STAGE_CREATE_STREAM_JOB" => Ok(TelemetryEventStage::CreateStreamJob),
"TELEMETRY_EVENT_STAGE_UPDATE_STREAM_JOB" => Ok(TelemetryEventStage::UpdateStreamJob),
"TELEMETRY_EVENT_STAGE_DROP_STREAM_JOB" => Ok(TelemetryEventStage::DropStreamJob),
"TELEMETRY_EVENT_STAGE_QUERY" => Ok(TelemetryEventStage::Query),
"TELEMETRY_EVENT_STAGE_RECOVERY" => Ok(TelemetryEventStage::Recovery),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for TelemetryNodeType {
#[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 => "TELEMETRY_NODE_TYPE_UNSPECIFIED",
Self::Meta => "TELEMETRY_NODE_TYPE_META",
Self::Compute => "TELEMETRY_NODE_TYPE_COMPUTE",
Self::Frontend => "TELEMETRY_NODE_TYPE_FRONTEND",
Self::Compactor => "TELEMETRY_NODE_TYPE_COMPACTOR",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for TelemetryNodeType {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"TELEMETRY_NODE_TYPE_UNSPECIFIED",
"TELEMETRY_NODE_TYPE_META",
"TELEMETRY_NODE_TYPE_COMPUTE",
"TELEMETRY_NODE_TYPE_FRONTEND",
"TELEMETRY_NODE_TYPE_COMPACTOR",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = TelemetryNodeType;
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 {
"TELEMETRY_NODE_TYPE_UNSPECIFIED" => Ok(TelemetryNodeType::Unspecified),
"TELEMETRY_NODE_TYPE_META" => Ok(TelemetryNodeType::Meta),
"TELEMETRY_NODE_TYPE_COMPUTE" => Ok(TelemetryNodeType::Compute),
"TELEMETRY_NODE_TYPE_FRONTEND" => Ok(TelemetryNodeType::Frontend),
"TELEMETRY_NODE_TYPE_COMPACTOR" => Ok(TelemetryNodeType::Compactor),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}