risingwave_pb/
common.serde.rs

1use crate::common::*;
2impl serde::Serialize for ActorInfo {
3    #[allow(deprecated)]
4    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5    where
6        S: serde::Serializer,
7    {
8        use serde::ser::SerializeStruct;
9        let mut len = 0;
10        if self.actor_id != 0 {
11            len += 1;
12        }
13        if self.host.is_some() {
14            len += 1;
15        }
16        let mut struct_ser = serializer.serialize_struct("common.ActorInfo", len)?;
17        if self.actor_id != 0 {
18            struct_ser.serialize_field("actorId", &self.actor_id)?;
19        }
20        if let Some(v) = self.host.as_ref() {
21            struct_ser.serialize_field("host", v)?;
22        }
23        struct_ser.end()
24    }
25}
26impl<'de> serde::Deserialize<'de> for ActorInfo {
27    #[allow(deprecated)]
28    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29    where
30        D: serde::Deserializer<'de>,
31    {
32        const FIELDS: &[&str] = &[
33            "actor_id",
34            "actorId",
35            "host",
36        ];
37
38        #[allow(clippy::enum_variant_names)]
39        enum GeneratedField {
40            ActorId,
41            Host,
42        }
43        impl<'de> serde::Deserialize<'de> for GeneratedField {
44            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
45            where
46                D: serde::Deserializer<'de>,
47            {
48                struct GeneratedVisitor;
49
50                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
51                    type Value = GeneratedField;
52
53                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
54                        write!(formatter, "expected one of: {:?}", &FIELDS)
55                    }
56
57                    #[allow(unused_variables)]
58                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
59                    where
60                        E: serde::de::Error,
61                    {
62                        match value {
63                            "actorId" | "actor_id" => Ok(GeneratedField::ActorId),
64                            "host" => Ok(GeneratedField::Host),
65                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
66                        }
67                    }
68                }
69                deserializer.deserialize_identifier(GeneratedVisitor)
70            }
71        }
72        struct GeneratedVisitor;
73        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
74            type Value = ActorInfo;
75
76            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
77                formatter.write_str("struct common.ActorInfo")
78            }
79
80            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ActorInfo, V::Error>
81                where
82                    V: serde::de::MapAccess<'de>,
83            {
84                let mut actor_id__ = None;
85                let mut host__ = None;
86                while let Some(k) = map_.next_key()? {
87                    match k {
88                        GeneratedField::ActorId => {
89                            if actor_id__.is_some() {
90                                return Err(serde::de::Error::duplicate_field("actorId"));
91                            }
92                            actor_id__ = 
93                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
94                            ;
95                        }
96                        GeneratedField::Host => {
97                            if host__.is_some() {
98                                return Err(serde::de::Error::duplicate_field("host"));
99                            }
100                            host__ = map_.next_value()?;
101                        }
102                    }
103                }
104                Ok(ActorInfo {
105                    actor_id: actor_id__.unwrap_or_default(),
106                    host: host__,
107                })
108            }
109        }
110        deserializer.deserialize_struct("common.ActorInfo", FIELDS, GeneratedVisitor)
111    }
112}
113impl serde::Serialize for ActorLocation {
114    #[allow(deprecated)]
115    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
116    where
117        S: serde::Serializer,
118    {
119        use serde::ser::SerializeStruct;
120        let mut len = 0;
121        if self.worker_node_id != 0 {
122            len += 1;
123        }
124        let mut struct_ser = serializer.serialize_struct("common.ActorLocation", len)?;
125        if self.worker_node_id != 0 {
126            struct_ser.serialize_field("workerNodeId", &self.worker_node_id)?;
127        }
128        struct_ser.end()
129    }
130}
131impl<'de> serde::Deserialize<'de> for ActorLocation {
132    #[allow(deprecated)]
133    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
134    where
135        D: serde::Deserializer<'de>,
136    {
137        const FIELDS: &[&str] = &[
138            "worker_node_id",
139            "workerNodeId",
140        ];
141
142        #[allow(clippy::enum_variant_names)]
143        enum GeneratedField {
144            WorkerNodeId,
145        }
146        impl<'de> serde::Deserialize<'de> for GeneratedField {
147            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
148            where
149                D: serde::Deserializer<'de>,
150            {
151                struct GeneratedVisitor;
152
153                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
154                    type Value = GeneratedField;
155
156                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
157                        write!(formatter, "expected one of: {:?}", &FIELDS)
158                    }
159
160                    #[allow(unused_variables)]
161                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
162                    where
163                        E: serde::de::Error,
164                    {
165                        match value {
166                            "workerNodeId" | "worker_node_id" => Ok(GeneratedField::WorkerNodeId),
167                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
168                        }
169                    }
170                }
171                deserializer.deserialize_identifier(GeneratedVisitor)
172            }
173        }
174        struct GeneratedVisitor;
175        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
176            type Value = ActorLocation;
177
178            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
179                formatter.write_str("struct common.ActorLocation")
180            }
181
182            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ActorLocation, V::Error>
183                where
184                    V: serde::de::MapAccess<'de>,
185            {
186                let mut worker_node_id__ = None;
187                while let Some(k) = map_.next_key()? {
188                    match k {
189                        GeneratedField::WorkerNodeId => {
190                            if worker_node_id__.is_some() {
191                                return Err(serde::de::Error::duplicate_field("workerNodeId"));
192                            }
193                            worker_node_id__ = 
194                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
195                            ;
196                        }
197                    }
198                }
199                Ok(ActorLocation {
200                    worker_node_id: worker_node_id__.unwrap_or_default(),
201                })
202            }
203        }
204        deserializer.deserialize_struct("common.ActorLocation", FIELDS, GeneratedVisitor)
205    }
206}
207impl serde::Serialize for BatchQueryCommittedEpoch {
208    #[allow(deprecated)]
209    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
210    where
211        S: serde::Serializer,
212    {
213        use serde::ser::SerializeStruct;
214        let mut len = 0;
215        if self.epoch != 0 {
216            len += 1;
217        }
218        if self.hummock_version_id != 0 {
219            len += 1;
220        }
221        let mut struct_ser = serializer.serialize_struct("common.BatchQueryCommittedEpoch", len)?;
222        if self.epoch != 0 {
223            #[allow(clippy::needless_borrow)]
224            #[allow(clippy::needless_borrows_for_generic_args)]
225            struct_ser.serialize_field("epoch", ToString::to_string(&self.epoch).as_str())?;
226        }
227        if self.hummock_version_id != 0 {
228            #[allow(clippy::needless_borrow)]
229            #[allow(clippy::needless_borrows_for_generic_args)]
230            struct_ser.serialize_field("hummockVersionId", ToString::to_string(&self.hummock_version_id).as_str())?;
231        }
232        struct_ser.end()
233    }
234}
235impl<'de> serde::Deserialize<'de> for BatchQueryCommittedEpoch {
236    #[allow(deprecated)]
237    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
238    where
239        D: serde::Deserializer<'de>,
240    {
241        const FIELDS: &[&str] = &[
242            "epoch",
243            "hummock_version_id",
244            "hummockVersionId",
245        ];
246
247        #[allow(clippy::enum_variant_names)]
248        enum GeneratedField {
249            Epoch,
250            HummockVersionId,
251        }
252        impl<'de> serde::Deserialize<'de> for GeneratedField {
253            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
254            where
255                D: serde::Deserializer<'de>,
256            {
257                struct GeneratedVisitor;
258
259                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
260                    type Value = GeneratedField;
261
262                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
263                        write!(formatter, "expected one of: {:?}", &FIELDS)
264                    }
265
266                    #[allow(unused_variables)]
267                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
268                    where
269                        E: serde::de::Error,
270                    {
271                        match value {
272                            "epoch" => Ok(GeneratedField::Epoch),
273                            "hummockVersionId" | "hummock_version_id" => Ok(GeneratedField::HummockVersionId),
274                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
275                        }
276                    }
277                }
278                deserializer.deserialize_identifier(GeneratedVisitor)
279            }
280        }
281        struct GeneratedVisitor;
282        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
283            type Value = BatchQueryCommittedEpoch;
284
285            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
286                formatter.write_str("struct common.BatchQueryCommittedEpoch")
287            }
288
289            fn visit_map<V>(self, mut map_: V) -> std::result::Result<BatchQueryCommittedEpoch, V::Error>
290                where
291                    V: serde::de::MapAccess<'de>,
292            {
293                let mut epoch__ = None;
294                let mut hummock_version_id__ = None;
295                while let Some(k) = map_.next_key()? {
296                    match k {
297                        GeneratedField::Epoch => {
298                            if epoch__.is_some() {
299                                return Err(serde::de::Error::duplicate_field("epoch"));
300                            }
301                            epoch__ = 
302                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
303                            ;
304                        }
305                        GeneratedField::HummockVersionId => {
306                            if hummock_version_id__.is_some() {
307                                return Err(serde::de::Error::duplicate_field("hummockVersionId"));
308                            }
309                            hummock_version_id__ = 
310                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
311                            ;
312                        }
313                    }
314                }
315                Ok(BatchQueryCommittedEpoch {
316                    epoch: epoch__.unwrap_or_default(),
317                    hummock_version_id: hummock_version_id__.unwrap_or_default(),
318                })
319            }
320        }
321        deserializer.deserialize_struct("common.BatchQueryCommittedEpoch", FIELDS, GeneratedVisitor)
322    }
323}
324impl serde::Serialize for BatchQueryEpoch {
325    #[allow(deprecated)]
326    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
327    where
328        S: serde::Serializer,
329    {
330        use serde::ser::SerializeStruct;
331        let mut len = 0;
332        if self.epoch.is_some() {
333            len += 1;
334        }
335        let mut struct_ser = serializer.serialize_struct("common.BatchQueryEpoch", len)?;
336        if let Some(v) = self.epoch.as_ref() {
337            match v {
338                batch_query_epoch::Epoch::Committed(v) => {
339                    struct_ser.serialize_field("committed", v)?;
340                }
341                batch_query_epoch::Epoch::Current(v) => {
342                    #[allow(clippy::needless_borrow)]
343                    #[allow(clippy::needless_borrows_for_generic_args)]
344                    struct_ser.serialize_field("current", ToString::to_string(&v).as_str())?;
345                }
346                batch_query_epoch::Epoch::Backup(v) => {
347                    #[allow(clippy::needless_borrow)]
348                    #[allow(clippy::needless_borrows_for_generic_args)]
349                    struct_ser.serialize_field("backup", ToString::to_string(&v).as_str())?;
350                }
351                batch_query_epoch::Epoch::TimeTravel(v) => {
352                    #[allow(clippy::needless_borrow)]
353                    #[allow(clippy::needless_borrows_for_generic_args)]
354                    struct_ser.serialize_field("timeTravel", ToString::to_string(&v).as_str())?;
355                }
356            }
357        }
358        struct_ser.end()
359    }
360}
361impl<'de> serde::Deserialize<'de> for BatchQueryEpoch {
362    #[allow(deprecated)]
363    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
364    where
365        D: serde::Deserializer<'de>,
366    {
367        const FIELDS: &[&str] = &[
368            "committed",
369            "current",
370            "backup",
371            "time_travel",
372            "timeTravel",
373        ];
374
375        #[allow(clippy::enum_variant_names)]
376        enum GeneratedField {
377            Committed,
378            Current,
379            Backup,
380            TimeTravel,
381        }
382        impl<'de> serde::Deserialize<'de> for GeneratedField {
383            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
384            where
385                D: serde::Deserializer<'de>,
386            {
387                struct GeneratedVisitor;
388
389                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
390                    type Value = GeneratedField;
391
392                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
393                        write!(formatter, "expected one of: {:?}", &FIELDS)
394                    }
395
396                    #[allow(unused_variables)]
397                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
398                    where
399                        E: serde::de::Error,
400                    {
401                        match value {
402                            "committed" => Ok(GeneratedField::Committed),
403                            "current" => Ok(GeneratedField::Current),
404                            "backup" => Ok(GeneratedField::Backup),
405                            "timeTravel" | "time_travel" => Ok(GeneratedField::TimeTravel),
406                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
407                        }
408                    }
409                }
410                deserializer.deserialize_identifier(GeneratedVisitor)
411            }
412        }
413        struct GeneratedVisitor;
414        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
415            type Value = BatchQueryEpoch;
416
417            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
418                formatter.write_str("struct common.BatchQueryEpoch")
419            }
420
421            fn visit_map<V>(self, mut map_: V) -> std::result::Result<BatchQueryEpoch, V::Error>
422                where
423                    V: serde::de::MapAccess<'de>,
424            {
425                let mut epoch__ = None;
426                while let Some(k) = map_.next_key()? {
427                    match k {
428                        GeneratedField::Committed => {
429                            if epoch__.is_some() {
430                                return Err(serde::de::Error::duplicate_field("committed"));
431                            }
432                            epoch__ = map_.next_value::<::std::option::Option<_>>()?.map(batch_query_epoch::Epoch::Committed)
433;
434                        }
435                        GeneratedField::Current => {
436                            if epoch__.is_some() {
437                                return Err(serde::de::Error::duplicate_field("current"));
438                            }
439                            epoch__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| batch_query_epoch::Epoch::Current(x.0));
440                        }
441                        GeneratedField::Backup => {
442                            if epoch__.is_some() {
443                                return Err(serde::de::Error::duplicate_field("backup"));
444                            }
445                            epoch__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| batch_query_epoch::Epoch::Backup(x.0));
446                        }
447                        GeneratedField::TimeTravel => {
448                            if epoch__.is_some() {
449                                return Err(serde::de::Error::duplicate_field("timeTravel"));
450                            }
451                            epoch__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| batch_query_epoch::Epoch::TimeTravel(x.0));
452                        }
453                    }
454                }
455                Ok(BatchQueryEpoch {
456                    epoch: epoch__,
457                })
458            }
459        }
460        deserializer.deserialize_struct("common.BatchQueryEpoch", FIELDS, GeneratedVisitor)
461    }
462}
463impl serde::Serialize for Buffer {
464    #[allow(deprecated)]
465    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
466    where
467        S: serde::Serializer,
468    {
469        use serde::ser::SerializeStruct;
470        let mut len = 0;
471        if self.compression != 0 {
472            len += 1;
473        }
474        if !self.body.is_empty() {
475            len += 1;
476        }
477        let mut struct_ser = serializer.serialize_struct("common.Buffer", len)?;
478        if self.compression != 0 {
479            let v = buffer::CompressionType::try_from(self.compression)
480                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.compression)))?;
481            struct_ser.serialize_field("compression", &v)?;
482        }
483        if !self.body.is_empty() {
484            #[allow(clippy::needless_borrow)]
485            #[allow(clippy::needless_borrows_for_generic_args)]
486            struct_ser.serialize_field("body", pbjson::private::base64::encode(&self.body).as_str())?;
487        }
488        struct_ser.end()
489    }
490}
491impl<'de> serde::Deserialize<'de> for Buffer {
492    #[allow(deprecated)]
493    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
494    where
495        D: serde::Deserializer<'de>,
496    {
497        const FIELDS: &[&str] = &[
498            "compression",
499            "body",
500        ];
501
502        #[allow(clippy::enum_variant_names)]
503        enum GeneratedField {
504            Compression,
505            Body,
506        }
507        impl<'de> serde::Deserialize<'de> for GeneratedField {
508            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
509            where
510                D: serde::Deserializer<'de>,
511            {
512                struct GeneratedVisitor;
513
514                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
515                    type Value = GeneratedField;
516
517                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
518                        write!(formatter, "expected one of: {:?}", &FIELDS)
519                    }
520
521                    #[allow(unused_variables)]
522                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
523                    where
524                        E: serde::de::Error,
525                    {
526                        match value {
527                            "compression" => Ok(GeneratedField::Compression),
528                            "body" => Ok(GeneratedField::Body),
529                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
530                        }
531                    }
532                }
533                deserializer.deserialize_identifier(GeneratedVisitor)
534            }
535        }
536        struct GeneratedVisitor;
537        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
538            type Value = Buffer;
539
540            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
541                formatter.write_str("struct common.Buffer")
542            }
543
544            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Buffer, V::Error>
545                where
546                    V: serde::de::MapAccess<'de>,
547            {
548                let mut compression__ = None;
549                let mut body__ = None;
550                while let Some(k) = map_.next_key()? {
551                    match k {
552                        GeneratedField::Compression => {
553                            if compression__.is_some() {
554                                return Err(serde::de::Error::duplicate_field("compression"));
555                            }
556                            compression__ = Some(map_.next_value::<buffer::CompressionType>()? as i32);
557                        }
558                        GeneratedField::Body => {
559                            if body__.is_some() {
560                                return Err(serde::de::Error::duplicate_field("body"));
561                            }
562                            body__ = 
563                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
564                            ;
565                        }
566                    }
567                }
568                Ok(Buffer {
569                    compression: compression__.unwrap_or_default(),
570                    body: body__.unwrap_or_default(),
571                })
572            }
573        }
574        deserializer.deserialize_struct("common.Buffer", FIELDS, GeneratedVisitor)
575    }
576}
577impl serde::Serialize for buffer::CompressionType {
578    #[allow(deprecated)]
579    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
580    where
581        S: serde::Serializer,
582    {
583        let variant = match self {
584            Self::Unspecified => "UNSPECIFIED",
585            Self::None => "NONE",
586        };
587        serializer.serialize_str(variant)
588    }
589}
590impl<'de> serde::Deserialize<'de> for buffer::CompressionType {
591    #[allow(deprecated)]
592    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
593    where
594        D: serde::Deserializer<'de>,
595    {
596        const FIELDS: &[&str] = &[
597            "UNSPECIFIED",
598            "NONE",
599        ];
600
601        struct GeneratedVisitor;
602
603        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
604            type Value = buffer::CompressionType;
605
606            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
607                write!(formatter, "expected one of: {:?}", &FIELDS)
608            }
609
610            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
611            where
612                E: serde::de::Error,
613            {
614                i32::try_from(v)
615                    .ok()
616                    .and_then(|x| x.try_into().ok())
617                    .ok_or_else(|| {
618                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
619                    })
620            }
621
622            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
623            where
624                E: serde::de::Error,
625            {
626                i32::try_from(v)
627                    .ok()
628                    .and_then(|x| x.try_into().ok())
629                    .ok_or_else(|| {
630                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
631                    })
632            }
633
634            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
635            where
636                E: serde::de::Error,
637            {
638                match value {
639                    "UNSPECIFIED" => Ok(buffer::CompressionType::Unspecified),
640                    "NONE" => Ok(buffer::CompressionType::None),
641                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
642                }
643            }
644        }
645        deserializer.deserialize_any(GeneratedVisitor)
646    }
647}
648impl serde::Serialize for ColumnOrder {
649    #[allow(deprecated)]
650    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
651    where
652        S: serde::Serializer,
653    {
654        use serde::ser::SerializeStruct;
655        let mut len = 0;
656        if self.column_index != 0 {
657            len += 1;
658        }
659        if self.order_type.is_some() {
660            len += 1;
661        }
662        let mut struct_ser = serializer.serialize_struct("common.ColumnOrder", len)?;
663        if self.column_index != 0 {
664            struct_ser.serialize_field("columnIndex", &self.column_index)?;
665        }
666        if let Some(v) = self.order_type.as_ref() {
667            struct_ser.serialize_field("orderType", v)?;
668        }
669        struct_ser.end()
670    }
671}
672impl<'de> serde::Deserialize<'de> for ColumnOrder {
673    #[allow(deprecated)]
674    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
675    where
676        D: serde::Deserializer<'de>,
677    {
678        const FIELDS: &[&str] = &[
679            "column_index",
680            "columnIndex",
681            "order_type",
682            "orderType",
683        ];
684
685        #[allow(clippy::enum_variant_names)]
686        enum GeneratedField {
687            ColumnIndex,
688            OrderType,
689        }
690        impl<'de> serde::Deserialize<'de> for GeneratedField {
691            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
692            where
693                D: serde::Deserializer<'de>,
694            {
695                struct GeneratedVisitor;
696
697                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
698                    type Value = GeneratedField;
699
700                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
701                        write!(formatter, "expected one of: {:?}", &FIELDS)
702                    }
703
704                    #[allow(unused_variables)]
705                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
706                    where
707                        E: serde::de::Error,
708                    {
709                        match value {
710                            "columnIndex" | "column_index" => Ok(GeneratedField::ColumnIndex),
711                            "orderType" | "order_type" => Ok(GeneratedField::OrderType),
712                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
713                        }
714                    }
715                }
716                deserializer.deserialize_identifier(GeneratedVisitor)
717            }
718        }
719        struct GeneratedVisitor;
720        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
721            type Value = ColumnOrder;
722
723            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
724                formatter.write_str("struct common.ColumnOrder")
725            }
726
727            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ColumnOrder, V::Error>
728                where
729                    V: serde::de::MapAccess<'de>,
730            {
731                let mut column_index__ = None;
732                let mut order_type__ = None;
733                while let Some(k) = map_.next_key()? {
734                    match k {
735                        GeneratedField::ColumnIndex => {
736                            if column_index__.is_some() {
737                                return Err(serde::de::Error::duplicate_field("columnIndex"));
738                            }
739                            column_index__ = 
740                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
741                            ;
742                        }
743                        GeneratedField::OrderType => {
744                            if order_type__.is_some() {
745                                return Err(serde::de::Error::duplicate_field("orderType"));
746                            }
747                            order_type__ = map_.next_value()?;
748                        }
749                    }
750                }
751                Ok(ColumnOrder {
752                    column_index: column_index__.unwrap_or_default(),
753                    order_type: order_type__,
754                })
755            }
756        }
757        deserializer.deserialize_struct("common.ColumnOrder", FIELDS, GeneratedVisitor)
758    }
759}
760impl serde::Serialize for Direction {
761    #[allow(deprecated)]
762    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
763    where
764        S: serde::Serializer,
765    {
766        let variant = match self {
767            Self::Unspecified => "DIRECTION_UNSPECIFIED",
768            Self::Ascending => "DIRECTION_ASCENDING",
769            Self::Descending => "DIRECTION_DESCENDING",
770        };
771        serializer.serialize_str(variant)
772    }
773}
774impl<'de> serde::Deserialize<'de> for Direction {
775    #[allow(deprecated)]
776    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
777    where
778        D: serde::Deserializer<'de>,
779    {
780        const FIELDS: &[&str] = &[
781            "DIRECTION_UNSPECIFIED",
782            "DIRECTION_ASCENDING",
783            "DIRECTION_DESCENDING",
784        ];
785
786        struct GeneratedVisitor;
787
788        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
789            type Value = Direction;
790
791            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
792                write!(formatter, "expected one of: {:?}", &FIELDS)
793            }
794
795            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
796            where
797                E: serde::de::Error,
798            {
799                i32::try_from(v)
800                    .ok()
801                    .and_then(|x| x.try_into().ok())
802                    .ok_or_else(|| {
803                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
804                    })
805            }
806
807            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
808            where
809                E: serde::de::Error,
810            {
811                i32::try_from(v)
812                    .ok()
813                    .and_then(|x| x.try_into().ok())
814                    .ok_or_else(|| {
815                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
816                    })
817            }
818
819            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
820            where
821                E: serde::de::Error,
822            {
823                match value {
824                    "DIRECTION_UNSPECIFIED" => Ok(Direction::Unspecified),
825                    "DIRECTION_ASCENDING" => Ok(Direction::Ascending),
826                    "DIRECTION_DESCENDING" => Ok(Direction::Descending),
827                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
828                }
829            }
830        }
831        deserializer.deserialize_any(GeneratedVisitor)
832    }
833}
834impl serde::Serialize for HostAddress {
835    #[allow(deprecated)]
836    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
837    where
838        S: serde::Serializer,
839    {
840        use serde::ser::SerializeStruct;
841        let mut len = 0;
842        if !self.host.is_empty() {
843            len += 1;
844        }
845        if self.port != 0 {
846            len += 1;
847        }
848        let mut struct_ser = serializer.serialize_struct("common.HostAddress", len)?;
849        if !self.host.is_empty() {
850            struct_ser.serialize_field("host", &self.host)?;
851        }
852        if self.port != 0 {
853            struct_ser.serialize_field("port", &self.port)?;
854        }
855        struct_ser.end()
856    }
857}
858impl<'de> serde::Deserialize<'de> for HostAddress {
859    #[allow(deprecated)]
860    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
861    where
862        D: serde::Deserializer<'de>,
863    {
864        const FIELDS: &[&str] = &[
865            "host",
866            "port",
867        ];
868
869        #[allow(clippy::enum_variant_names)]
870        enum GeneratedField {
871            Host,
872            Port,
873        }
874        impl<'de> serde::Deserialize<'de> for GeneratedField {
875            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
876            where
877                D: serde::Deserializer<'de>,
878            {
879                struct GeneratedVisitor;
880
881                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
882                    type Value = GeneratedField;
883
884                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
885                        write!(formatter, "expected one of: {:?}", &FIELDS)
886                    }
887
888                    #[allow(unused_variables)]
889                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
890                    where
891                        E: serde::de::Error,
892                    {
893                        match value {
894                            "host" => Ok(GeneratedField::Host),
895                            "port" => Ok(GeneratedField::Port),
896                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
897                        }
898                    }
899                }
900                deserializer.deserialize_identifier(GeneratedVisitor)
901            }
902        }
903        struct GeneratedVisitor;
904        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
905            type Value = HostAddress;
906
907            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
908                formatter.write_str("struct common.HostAddress")
909            }
910
911            fn visit_map<V>(self, mut map_: V) -> std::result::Result<HostAddress, V::Error>
912                where
913                    V: serde::de::MapAccess<'de>,
914            {
915                let mut host__ = None;
916                let mut port__ = None;
917                while let Some(k) = map_.next_key()? {
918                    match k {
919                        GeneratedField::Host => {
920                            if host__.is_some() {
921                                return Err(serde::de::Error::duplicate_field("host"));
922                            }
923                            host__ = Some(map_.next_value()?);
924                        }
925                        GeneratedField::Port => {
926                            if port__.is_some() {
927                                return Err(serde::de::Error::duplicate_field("port"));
928                            }
929                            port__ = 
930                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
931                            ;
932                        }
933                    }
934                }
935                Ok(HostAddress {
936                    host: host__.unwrap_or_default(),
937                    port: port__.unwrap_or_default(),
938                })
939            }
940        }
941        deserializer.deserialize_struct("common.HostAddress", FIELDS, GeneratedVisitor)
942    }
943}
944impl serde::Serialize for NullsAre {
945    #[allow(deprecated)]
946    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
947    where
948        S: serde::Serializer,
949    {
950        let variant = match self {
951            Self::Unspecified => "NULLS_ARE_UNSPECIFIED",
952            Self::Largest => "NULLS_ARE_LARGEST",
953            Self::Smallest => "NULLS_ARE_SMALLEST",
954        };
955        serializer.serialize_str(variant)
956    }
957}
958impl<'de> serde::Deserialize<'de> for NullsAre {
959    #[allow(deprecated)]
960    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
961    where
962        D: serde::Deserializer<'de>,
963    {
964        const FIELDS: &[&str] = &[
965            "NULLS_ARE_UNSPECIFIED",
966            "NULLS_ARE_LARGEST",
967            "NULLS_ARE_SMALLEST",
968        ];
969
970        struct GeneratedVisitor;
971
972        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
973            type Value = NullsAre;
974
975            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
976                write!(formatter, "expected one of: {:?}", &FIELDS)
977            }
978
979            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
980            where
981                E: serde::de::Error,
982            {
983                i32::try_from(v)
984                    .ok()
985                    .and_then(|x| x.try_into().ok())
986                    .ok_or_else(|| {
987                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
988                    })
989            }
990
991            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
992            where
993                E: serde::de::Error,
994            {
995                i32::try_from(v)
996                    .ok()
997                    .and_then(|x| x.try_into().ok())
998                    .ok_or_else(|| {
999                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
1000                    })
1001            }
1002
1003            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1004            where
1005                E: serde::de::Error,
1006            {
1007                match value {
1008                    "NULLS_ARE_UNSPECIFIED" => Ok(NullsAre::Unspecified),
1009                    "NULLS_ARE_LARGEST" => Ok(NullsAre::Largest),
1010                    "NULLS_ARE_SMALLEST" => Ok(NullsAre::Smallest),
1011                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
1012                }
1013            }
1014        }
1015        deserializer.deserialize_any(GeneratedVisitor)
1016    }
1017}
1018impl serde::Serialize for OrderType {
1019    #[allow(deprecated)]
1020    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1021    where
1022        S: serde::Serializer,
1023    {
1024        use serde::ser::SerializeStruct;
1025        let mut len = 0;
1026        if self.direction != 0 {
1027            len += 1;
1028        }
1029        if self.nulls_are != 0 {
1030            len += 1;
1031        }
1032        let mut struct_ser = serializer.serialize_struct("common.OrderType", len)?;
1033        if self.direction != 0 {
1034            let v = Direction::try_from(self.direction)
1035                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.direction)))?;
1036            struct_ser.serialize_field("direction", &v)?;
1037        }
1038        if self.nulls_are != 0 {
1039            let v = NullsAre::try_from(self.nulls_are)
1040                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.nulls_are)))?;
1041            struct_ser.serialize_field("nullsAre", &v)?;
1042        }
1043        struct_ser.end()
1044    }
1045}
1046impl<'de> serde::Deserialize<'de> for OrderType {
1047    #[allow(deprecated)]
1048    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1049    where
1050        D: serde::Deserializer<'de>,
1051    {
1052        const FIELDS: &[&str] = &[
1053            "direction",
1054            "nulls_are",
1055            "nullsAre",
1056        ];
1057
1058        #[allow(clippy::enum_variant_names)]
1059        enum GeneratedField {
1060            Direction,
1061            NullsAre,
1062        }
1063        impl<'de> serde::Deserialize<'de> for GeneratedField {
1064            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1065            where
1066                D: serde::Deserializer<'de>,
1067            {
1068                struct GeneratedVisitor;
1069
1070                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1071                    type Value = GeneratedField;
1072
1073                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1074                        write!(formatter, "expected one of: {:?}", &FIELDS)
1075                    }
1076
1077                    #[allow(unused_variables)]
1078                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1079                    where
1080                        E: serde::de::Error,
1081                    {
1082                        match value {
1083                            "direction" => Ok(GeneratedField::Direction),
1084                            "nullsAre" | "nulls_are" => Ok(GeneratedField::NullsAre),
1085                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1086                        }
1087                    }
1088                }
1089                deserializer.deserialize_identifier(GeneratedVisitor)
1090            }
1091        }
1092        struct GeneratedVisitor;
1093        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1094            type Value = OrderType;
1095
1096            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1097                formatter.write_str("struct common.OrderType")
1098            }
1099
1100            fn visit_map<V>(self, mut map_: V) -> std::result::Result<OrderType, V::Error>
1101                where
1102                    V: serde::de::MapAccess<'de>,
1103            {
1104                let mut direction__ = None;
1105                let mut nulls_are__ = None;
1106                while let Some(k) = map_.next_key()? {
1107                    match k {
1108                        GeneratedField::Direction => {
1109                            if direction__.is_some() {
1110                                return Err(serde::de::Error::duplicate_field("direction"));
1111                            }
1112                            direction__ = Some(map_.next_value::<Direction>()? as i32);
1113                        }
1114                        GeneratedField::NullsAre => {
1115                            if nulls_are__.is_some() {
1116                                return Err(serde::de::Error::duplicate_field("nullsAre"));
1117                            }
1118                            nulls_are__ = Some(map_.next_value::<NullsAre>()? as i32);
1119                        }
1120                    }
1121                }
1122                Ok(OrderType {
1123                    direction: direction__.unwrap_or_default(),
1124                    nulls_are: nulls_are__.unwrap_or_default(),
1125                })
1126            }
1127        }
1128        deserializer.deserialize_struct("common.OrderType", FIELDS, GeneratedVisitor)
1129    }
1130}
1131impl serde::Serialize for Status {
1132    #[allow(deprecated)]
1133    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1134    where
1135        S: serde::Serializer,
1136    {
1137        use serde::ser::SerializeStruct;
1138        let mut len = 0;
1139        if self.code != 0 {
1140            len += 1;
1141        }
1142        if !self.message.is_empty() {
1143            len += 1;
1144        }
1145        let mut struct_ser = serializer.serialize_struct("common.Status", len)?;
1146        if self.code != 0 {
1147            let v = status::Code::try_from(self.code)
1148                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.code)))?;
1149            struct_ser.serialize_field("code", &v)?;
1150        }
1151        if !self.message.is_empty() {
1152            struct_ser.serialize_field("message", &self.message)?;
1153        }
1154        struct_ser.end()
1155    }
1156}
1157impl<'de> serde::Deserialize<'de> for Status {
1158    #[allow(deprecated)]
1159    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1160    where
1161        D: serde::Deserializer<'de>,
1162    {
1163        const FIELDS: &[&str] = &[
1164            "code",
1165            "message",
1166        ];
1167
1168        #[allow(clippy::enum_variant_names)]
1169        enum GeneratedField {
1170            Code,
1171            Message,
1172        }
1173        impl<'de> serde::Deserialize<'de> for GeneratedField {
1174            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1175            where
1176                D: serde::Deserializer<'de>,
1177            {
1178                struct GeneratedVisitor;
1179
1180                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1181                    type Value = GeneratedField;
1182
1183                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1184                        write!(formatter, "expected one of: {:?}", &FIELDS)
1185                    }
1186
1187                    #[allow(unused_variables)]
1188                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1189                    where
1190                        E: serde::de::Error,
1191                    {
1192                        match value {
1193                            "code" => Ok(GeneratedField::Code),
1194                            "message" => Ok(GeneratedField::Message),
1195                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1196                        }
1197                    }
1198                }
1199                deserializer.deserialize_identifier(GeneratedVisitor)
1200            }
1201        }
1202        struct GeneratedVisitor;
1203        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1204            type Value = Status;
1205
1206            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1207                formatter.write_str("struct common.Status")
1208            }
1209
1210            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Status, V::Error>
1211                where
1212                    V: serde::de::MapAccess<'de>,
1213            {
1214                let mut code__ = None;
1215                let mut message__ = None;
1216                while let Some(k) = map_.next_key()? {
1217                    match k {
1218                        GeneratedField::Code => {
1219                            if code__.is_some() {
1220                                return Err(serde::de::Error::duplicate_field("code"));
1221                            }
1222                            code__ = Some(map_.next_value::<status::Code>()? as i32);
1223                        }
1224                        GeneratedField::Message => {
1225                            if message__.is_some() {
1226                                return Err(serde::de::Error::duplicate_field("message"));
1227                            }
1228                            message__ = Some(map_.next_value()?);
1229                        }
1230                    }
1231                }
1232                Ok(Status {
1233                    code: code__.unwrap_or_default(),
1234                    message: message__.unwrap_or_default(),
1235                })
1236            }
1237        }
1238        deserializer.deserialize_struct("common.Status", FIELDS, GeneratedVisitor)
1239    }
1240}
1241impl serde::Serialize for status::Code {
1242    #[allow(deprecated)]
1243    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1244    where
1245        S: serde::Serializer,
1246    {
1247        let variant = match self {
1248            Self::Unspecified => "UNSPECIFIED",
1249            Self::Ok => "OK",
1250            Self::UnknownWorker => "UNKNOWN_WORKER",
1251        };
1252        serializer.serialize_str(variant)
1253    }
1254}
1255impl<'de> serde::Deserialize<'de> for status::Code {
1256    #[allow(deprecated)]
1257    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1258    where
1259        D: serde::Deserializer<'de>,
1260    {
1261        const FIELDS: &[&str] = &[
1262            "UNSPECIFIED",
1263            "OK",
1264            "UNKNOWN_WORKER",
1265        ];
1266
1267        struct GeneratedVisitor;
1268
1269        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1270            type Value = status::Code;
1271
1272            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1273                write!(formatter, "expected one of: {:?}", &FIELDS)
1274            }
1275
1276            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
1277            where
1278                E: serde::de::Error,
1279            {
1280                i32::try_from(v)
1281                    .ok()
1282                    .and_then(|x| x.try_into().ok())
1283                    .ok_or_else(|| {
1284                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
1285                    })
1286            }
1287
1288            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
1289            where
1290                E: serde::de::Error,
1291            {
1292                i32::try_from(v)
1293                    .ok()
1294                    .and_then(|x| x.try_into().ok())
1295                    .ok_or_else(|| {
1296                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
1297                    })
1298            }
1299
1300            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1301            where
1302                E: serde::de::Error,
1303            {
1304                match value {
1305                    "UNSPECIFIED" => Ok(status::Code::Unspecified),
1306                    "OK" => Ok(status::Code::Ok),
1307                    "UNKNOWN_WORKER" => Ok(status::Code::UnknownWorker),
1308                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
1309                }
1310            }
1311        }
1312        deserializer.deserialize_any(GeneratedVisitor)
1313    }
1314}
1315impl serde::Serialize for WorkerNode {
1316    #[allow(deprecated)]
1317    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1318    where
1319        S: serde::Serializer,
1320    {
1321        use serde::ser::SerializeStruct;
1322        let mut len = 0;
1323        if self.id != 0 {
1324            len += 1;
1325        }
1326        if self.r#type != 0 {
1327            len += 1;
1328        }
1329        if self.host.is_some() {
1330            len += 1;
1331        }
1332        if self.state != 0 {
1333            len += 1;
1334        }
1335        if self.property.is_some() {
1336            len += 1;
1337        }
1338        if self.transactional_id.is_some() {
1339            len += 1;
1340        }
1341        if self.resource.is_some() {
1342            len += 1;
1343        }
1344        if self.started_at.is_some() {
1345            len += 1;
1346        }
1347        let mut struct_ser = serializer.serialize_struct("common.WorkerNode", len)?;
1348        if self.id != 0 {
1349            struct_ser.serialize_field("id", &self.id)?;
1350        }
1351        if self.r#type != 0 {
1352            let v = WorkerType::try_from(self.r#type)
1353                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.r#type)))?;
1354            struct_ser.serialize_field("type", &v)?;
1355        }
1356        if let Some(v) = self.host.as_ref() {
1357            struct_ser.serialize_field("host", v)?;
1358        }
1359        if self.state != 0 {
1360            let v = worker_node::State::try_from(self.state)
1361                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.state)))?;
1362            struct_ser.serialize_field("state", &v)?;
1363        }
1364        if let Some(v) = self.property.as_ref() {
1365            struct_ser.serialize_field("property", v)?;
1366        }
1367        if let Some(v) = self.transactional_id.as_ref() {
1368            struct_ser.serialize_field("transactionalId", v)?;
1369        }
1370        if let Some(v) = self.resource.as_ref() {
1371            struct_ser.serialize_field("resource", v)?;
1372        }
1373        if let Some(v) = self.started_at.as_ref() {
1374            #[allow(clippy::needless_borrow)]
1375            #[allow(clippy::needless_borrows_for_generic_args)]
1376            struct_ser.serialize_field("startedAt", ToString::to_string(&v).as_str())?;
1377        }
1378        struct_ser.end()
1379    }
1380}
1381impl<'de> serde::Deserialize<'de> for WorkerNode {
1382    #[allow(deprecated)]
1383    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1384    where
1385        D: serde::Deserializer<'de>,
1386    {
1387        const FIELDS: &[&str] = &[
1388            "id",
1389            "type",
1390            "host",
1391            "state",
1392            "property",
1393            "transactional_id",
1394            "transactionalId",
1395            "resource",
1396            "started_at",
1397            "startedAt",
1398        ];
1399
1400        #[allow(clippy::enum_variant_names)]
1401        enum GeneratedField {
1402            Id,
1403            Type,
1404            Host,
1405            State,
1406            Property,
1407            TransactionalId,
1408            Resource,
1409            StartedAt,
1410        }
1411        impl<'de> serde::Deserialize<'de> for GeneratedField {
1412            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1413            where
1414                D: serde::Deserializer<'de>,
1415            {
1416                struct GeneratedVisitor;
1417
1418                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1419                    type Value = GeneratedField;
1420
1421                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1422                        write!(formatter, "expected one of: {:?}", &FIELDS)
1423                    }
1424
1425                    #[allow(unused_variables)]
1426                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1427                    where
1428                        E: serde::de::Error,
1429                    {
1430                        match value {
1431                            "id" => Ok(GeneratedField::Id),
1432                            "type" => Ok(GeneratedField::Type),
1433                            "host" => Ok(GeneratedField::Host),
1434                            "state" => Ok(GeneratedField::State),
1435                            "property" => Ok(GeneratedField::Property),
1436                            "transactionalId" | "transactional_id" => Ok(GeneratedField::TransactionalId),
1437                            "resource" => Ok(GeneratedField::Resource),
1438                            "startedAt" | "started_at" => Ok(GeneratedField::StartedAt),
1439                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1440                        }
1441                    }
1442                }
1443                deserializer.deserialize_identifier(GeneratedVisitor)
1444            }
1445        }
1446        struct GeneratedVisitor;
1447        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1448            type Value = WorkerNode;
1449
1450            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1451                formatter.write_str("struct common.WorkerNode")
1452            }
1453
1454            fn visit_map<V>(self, mut map_: V) -> std::result::Result<WorkerNode, V::Error>
1455                where
1456                    V: serde::de::MapAccess<'de>,
1457            {
1458                let mut id__ = None;
1459                let mut r#type__ = None;
1460                let mut host__ = None;
1461                let mut state__ = None;
1462                let mut property__ = None;
1463                let mut transactional_id__ = None;
1464                let mut resource__ = None;
1465                let mut started_at__ = None;
1466                while let Some(k) = map_.next_key()? {
1467                    match k {
1468                        GeneratedField::Id => {
1469                            if id__.is_some() {
1470                                return Err(serde::de::Error::duplicate_field("id"));
1471                            }
1472                            id__ = 
1473                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1474                            ;
1475                        }
1476                        GeneratedField::Type => {
1477                            if r#type__.is_some() {
1478                                return Err(serde::de::Error::duplicate_field("type"));
1479                            }
1480                            r#type__ = Some(map_.next_value::<WorkerType>()? as i32);
1481                        }
1482                        GeneratedField::Host => {
1483                            if host__.is_some() {
1484                                return Err(serde::de::Error::duplicate_field("host"));
1485                            }
1486                            host__ = map_.next_value()?;
1487                        }
1488                        GeneratedField::State => {
1489                            if state__.is_some() {
1490                                return Err(serde::de::Error::duplicate_field("state"));
1491                            }
1492                            state__ = Some(map_.next_value::<worker_node::State>()? as i32);
1493                        }
1494                        GeneratedField::Property => {
1495                            if property__.is_some() {
1496                                return Err(serde::de::Error::duplicate_field("property"));
1497                            }
1498                            property__ = map_.next_value()?;
1499                        }
1500                        GeneratedField::TransactionalId => {
1501                            if transactional_id__.is_some() {
1502                                return Err(serde::de::Error::duplicate_field("transactionalId"));
1503                            }
1504                            transactional_id__ = 
1505                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
1506                            ;
1507                        }
1508                        GeneratedField::Resource => {
1509                            if resource__.is_some() {
1510                                return Err(serde::de::Error::duplicate_field("resource"));
1511                            }
1512                            resource__ = map_.next_value()?;
1513                        }
1514                        GeneratedField::StartedAt => {
1515                            if started_at__.is_some() {
1516                                return Err(serde::de::Error::duplicate_field("startedAt"));
1517                            }
1518                            started_at__ = 
1519                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
1520                            ;
1521                        }
1522                    }
1523                }
1524                Ok(WorkerNode {
1525                    id: id__.unwrap_or_default(),
1526                    r#type: r#type__.unwrap_or_default(),
1527                    host: host__,
1528                    state: state__.unwrap_or_default(),
1529                    property: property__,
1530                    transactional_id: transactional_id__,
1531                    resource: resource__,
1532                    started_at: started_at__,
1533                })
1534            }
1535        }
1536        deserializer.deserialize_struct("common.WorkerNode", FIELDS, GeneratedVisitor)
1537    }
1538}
1539impl serde::Serialize for worker_node::Property {
1540    #[allow(deprecated)]
1541    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1542    where
1543        S: serde::Serializer,
1544    {
1545        use serde::ser::SerializeStruct;
1546        let mut len = 0;
1547        if self.is_streaming {
1548            len += 1;
1549        }
1550        if self.is_serving {
1551            len += 1;
1552        }
1553        if self.is_unschedulable {
1554            len += 1;
1555        }
1556        if !self.internal_rpc_host_addr.is_empty() {
1557            len += 1;
1558        }
1559        if self.parallelism != 0 {
1560            len += 1;
1561        }
1562        if self.resource_group.is_some() {
1563            len += 1;
1564        }
1565        let mut struct_ser = serializer.serialize_struct("common.WorkerNode.Property", len)?;
1566        if self.is_streaming {
1567            struct_ser.serialize_field("isStreaming", &self.is_streaming)?;
1568        }
1569        if self.is_serving {
1570            struct_ser.serialize_field("isServing", &self.is_serving)?;
1571        }
1572        if self.is_unschedulable {
1573            struct_ser.serialize_field("isUnschedulable", &self.is_unschedulable)?;
1574        }
1575        if !self.internal_rpc_host_addr.is_empty() {
1576            struct_ser.serialize_field("internalRpcHostAddr", &self.internal_rpc_host_addr)?;
1577        }
1578        if self.parallelism != 0 {
1579            struct_ser.serialize_field("parallelism", &self.parallelism)?;
1580        }
1581        if let Some(v) = self.resource_group.as_ref() {
1582            struct_ser.serialize_field("resourceGroup", v)?;
1583        }
1584        struct_ser.end()
1585    }
1586}
1587impl<'de> serde::Deserialize<'de> for worker_node::Property {
1588    #[allow(deprecated)]
1589    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1590    where
1591        D: serde::Deserializer<'de>,
1592    {
1593        const FIELDS: &[&str] = &[
1594            "is_streaming",
1595            "isStreaming",
1596            "is_serving",
1597            "isServing",
1598            "is_unschedulable",
1599            "isUnschedulable",
1600            "internal_rpc_host_addr",
1601            "internalRpcHostAddr",
1602            "parallelism",
1603            "resource_group",
1604            "resourceGroup",
1605        ];
1606
1607        #[allow(clippy::enum_variant_names)]
1608        enum GeneratedField {
1609            IsStreaming,
1610            IsServing,
1611            IsUnschedulable,
1612            InternalRpcHostAddr,
1613            Parallelism,
1614            ResourceGroup,
1615        }
1616        impl<'de> serde::Deserialize<'de> for GeneratedField {
1617            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1618            where
1619                D: serde::Deserializer<'de>,
1620            {
1621                struct GeneratedVisitor;
1622
1623                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1624                    type Value = GeneratedField;
1625
1626                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1627                        write!(formatter, "expected one of: {:?}", &FIELDS)
1628                    }
1629
1630                    #[allow(unused_variables)]
1631                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1632                    where
1633                        E: serde::de::Error,
1634                    {
1635                        match value {
1636                            "isStreaming" | "is_streaming" => Ok(GeneratedField::IsStreaming),
1637                            "isServing" | "is_serving" => Ok(GeneratedField::IsServing),
1638                            "isUnschedulable" | "is_unschedulable" => Ok(GeneratedField::IsUnschedulable),
1639                            "internalRpcHostAddr" | "internal_rpc_host_addr" => Ok(GeneratedField::InternalRpcHostAddr),
1640                            "parallelism" => Ok(GeneratedField::Parallelism),
1641                            "resourceGroup" | "resource_group" => Ok(GeneratedField::ResourceGroup),
1642                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1643                        }
1644                    }
1645                }
1646                deserializer.deserialize_identifier(GeneratedVisitor)
1647            }
1648        }
1649        struct GeneratedVisitor;
1650        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1651            type Value = worker_node::Property;
1652
1653            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1654                formatter.write_str("struct common.WorkerNode.Property")
1655            }
1656
1657            fn visit_map<V>(self, mut map_: V) -> std::result::Result<worker_node::Property, V::Error>
1658                where
1659                    V: serde::de::MapAccess<'de>,
1660            {
1661                let mut is_streaming__ = None;
1662                let mut is_serving__ = None;
1663                let mut is_unschedulable__ = None;
1664                let mut internal_rpc_host_addr__ = None;
1665                let mut parallelism__ = None;
1666                let mut resource_group__ = None;
1667                while let Some(k) = map_.next_key()? {
1668                    match k {
1669                        GeneratedField::IsStreaming => {
1670                            if is_streaming__.is_some() {
1671                                return Err(serde::de::Error::duplicate_field("isStreaming"));
1672                            }
1673                            is_streaming__ = Some(map_.next_value()?);
1674                        }
1675                        GeneratedField::IsServing => {
1676                            if is_serving__.is_some() {
1677                                return Err(serde::de::Error::duplicate_field("isServing"));
1678                            }
1679                            is_serving__ = Some(map_.next_value()?);
1680                        }
1681                        GeneratedField::IsUnschedulable => {
1682                            if is_unschedulable__.is_some() {
1683                                return Err(serde::de::Error::duplicate_field("isUnschedulable"));
1684                            }
1685                            is_unschedulable__ = Some(map_.next_value()?);
1686                        }
1687                        GeneratedField::InternalRpcHostAddr => {
1688                            if internal_rpc_host_addr__.is_some() {
1689                                return Err(serde::de::Error::duplicate_field("internalRpcHostAddr"));
1690                            }
1691                            internal_rpc_host_addr__ = Some(map_.next_value()?);
1692                        }
1693                        GeneratedField::Parallelism => {
1694                            if parallelism__.is_some() {
1695                                return Err(serde::de::Error::duplicate_field("parallelism"));
1696                            }
1697                            parallelism__ = 
1698                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1699                            ;
1700                        }
1701                        GeneratedField::ResourceGroup => {
1702                            if resource_group__.is_some() {
1703                                return Err(serde::de::Error::duplicate_field("resourceGroup"));
1704                            }
1705                            resource_group__ = map_.next_value()?;
1706                        }
1707                    }
1708                }
1709                Ok(worker_node::Property {
1710                    is_streaming: is_streaming__.unwrap_or_default(),
1711                    is_serving: is_serving__.unwrap_or_default(),
1712                    is_unschedulable: is_unschedulable__.unwrap_or_default(),
1713                    internal_rpc_host_addr: internal_rpc_host_addr__.unwrap_or_default(),
1714                    parallelism: parallelism__.unwrap_or_default(),
1715                    resource_group: resource_group__,
1716                })
1717            }
1718        }
1719        deserializer.deserialize_struct("common.WorkerNode.Property", FIELDS, GeneratedVisitor)
1720    }
1721}
1722impl serde::Serialize for worker_node::Resource {
1723    #[allow(deprecated)]
1724    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1725    where
1726        S: serde::Serializer,
1727    {
1728        use serde::ser::SerializeStruct;
1729        let mut len = 0;
1730        if !self.rw_version.is_empty() {
1731            len += 1;
1732        }
1733        if self.total_memory_bytes != 0 {
1734            len += 1;
1735        }
1736        if self.total_cpu_cores != 0 {
1737            len += 1;
1738        }
1739        let mut struct_ser = serializer.serialize_struct("common.WorkerNode.Resource", len)?;
1740        if !self.rw_version.is_empty() {
1741            struct_ser.serialize_field("rwVersion", &self.rw_version)?;
1742        }
1743        if self.total_memory_bytes != 0 {
1744            #[allow(clippy::needless_borrow)]
1745            #[allow(clippy::needless_borrows_for_generic_args)]
1746            struct_ser.serialize_field("totalMemoryBytes", ToString::to_string(&self.total_memory_bytes).as_str())?;
1747        }
1748        if self.total_cpu_cores != 0 {
1749            #[allow(clippy::needless_borrow)]
1750            #[allow(clippy::needless_borrows_for_generic_args)]
1751            struct_ser.serialize_field("totalCpuCores", ToString::to_string(&self.total_cpu_cores).as_str())?;
1752        }
1753        struct_ser.end()
1754    }
1755}
1756impl<'de> serde::Deserialize<'de> for worker_node::Resource {
1757    #[allow(deprecated)]
1758    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1759    where
1760        D: serde::Deserializer<'de>,
1761    {
1762        const FIELDS: &[&str] = &[
1763            "rw_version",
1764            "rwVersion",
1765            "total_memory_bytes",
1766            "totalMemoryBytes",
1767            "total_cpu_cores",
1768            "totalCpuCores",
1769        ];
1770
1771        #[allow(clippy::enum_variant_names)]
1772        enum GeneratedField {
1773            RwVersion,
1774            TotalMemoryBytes,
1775            TotalCpuCores,
1776        }
1777        impl<'de> serde::Deserialize<'de> for GeneratedField {
1778            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1779            where
1780                D: serde::Deserializer<'de>,
1781            {
1782                struct GeneratedVisitor;
1783
1784                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1785                    type Value = GeneratedField;
1786
1787                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1788                        write!(formatter, "expected one of: {:?}", &FIELDS)
1789                    }
1790
1791                    #[allow(unused_variables)]
1792                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1793                    where
1794                        E: serde::de::Error,
1795                    {
1796                        match value {
1797                            "rwVersion" | "rw_version" => Ok(GeneratedField::RwVersion),
1798                            "totalMemoryBytes" | "total_memory_bytes" => Ok(GeneratedField::TotalMemoryBytes),
1799                            "totalCpuCores" | "total_cpu_cores" => Ok(GeneratedField::TotalCpuCores),
1800                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1801                        }
1802                    }
1803                }
1804                deserializer.deserialize_identifier(GeneratedVisitor)
1805            }
1806        }
1807        struct GeneratedVisitor;
1808        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1809            type Value = worker_node::Resource;
1810
1811            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1812                formatter.write_str("struct common.WorkerNode.Resource")
1813            }
1814
1815            fn visit_map<V>(self, mut map_: V) -> std::result::Result<worker_node::Resource, V::Error>
1816                where
1817                    V: serde::de::MapAccess<'de>,
1818            {
1819                let mut rw_version__ = None;
1820                let mut total_memory_bytes__ = None;
1821                let mut total_cpu_cores__ = None;
1822                while let Some(k) = map_.next_key()? {
1823                    match k {
1824                        GeneratedField::RwVersion => {
1825                            if rw_version__.is_some() {
1826                                return Err(serde::de::Error::duplicate_field("rwVersion"));
1827                            }
1828                            rw_version__ = Some(map_.next_value()?);
1829                        }
1830                        GeneratedField::TotalMemoryBytes => {
1831                            if total_memory_bytes__.is_some() {
1832                                return Err(serde::de::Error::duplicate_field("totalMemoryBytes"));
1833                            }
1834                            total_memory_bytes__ = 
1835                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1836                            ;
1837                        }
1838                        GeneratedField::TotalCpuCores => {
1839                            if total_cpu_cores__.is_some() {
1840                                return Err(serde::de::Error::duplicate_field("totalCpuCores"));
1841                            }
1842                            total_cpu_cores__ = 
1843                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1844                            ;
1845                        }
1846                    }
1847                }
1848                Ok(worker_node::Resource {
1849                    rw_version: rw_version__.unwrap_or_default(),
1850                    total_memory_bytes: total_memory_bytes__.unwrap_or_default(),
1851                    total_cpu_cores: total_cpu_cores__.unwrap_or_default(),
1852                })
1853            }
1854        }
1855        deserializer.deserialize_struct("common.WorkerNode.Resource", FIELDS, GeneratedVisitor)
1856    }
1857}
1858impl serde::Serialize for worker_node::State {
1859    #[allow(deprecated)]
1860    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1861    where
1862        S: serde::Serializer,
1863    {
1864        let variant = match self {
1865            Self::Unspecified => "UNSPECIFIED",
1866            Self::Starting => "STARTING",
1867            Self::Running => "RUNNING",
1868        };
1869        serializer.serialize_str(variant)
1870    }
1871}
1872impl<'de> serde::Deserialize<'de> for worker_node::State {
1873    #[allow(deprecated)]
1874    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1875    where
1876        D: serde::Deserializer<'de>,
1877    {
1878        const FIELDS: &[&str] = &[
1879            "UNSPECIFIED",
1880            "STARTING",
1881            "RUNNING",
1882        ];
1883
1884        struct GeneratedVisitor;
1885
1886        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1887            type Value = worker_node::State;
1888
1889            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1890                write!(formatter, "expected one of: {:?}", &FIELDS)
1891            }
1892
1893            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
1894            where
1895                E: serde::de::Error,
1896            {
1897                i32::try_from(v)
1898                    .ok()
1899                    .and_then(|x| x.try_into().ok())
1900                    .ok_or_else(|| {
1901                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
1902                    })
1903            }
1904
1905            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
1906            where
1907                E: serde::de::Error,
1908            {
1909                i32::try_from(v)
1910                    .ok()
1911                    .and_then(|x| x.try_into().ok())
1912                    .ok_or_else(|| {
1913                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
1914                    })
1915            }
1916
1917            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1918            where
1919                E: serde::de::Error,
1920            {
1921                match value {
1922                    "UNSPECIFIED" => Ok(worker_node::State::Unspecified),
1923                    "STARTING" => Ok(worker_node::State::Starting),
1924                    "RUNNING" => Ok(worker_node::State::Running),
1925                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
1926                }
1927            }
1928        }
1929        deserializer.deserialize_any(GeneratedVisitor)
1930    }
1931}
1932impl serde::Serialize for WorkerSlotMapping {
1933    #[allow(deprecated)]
1934    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1935    where
1936        S: serde::Serializer,
1937    {
1938        use serde::ser::SerializeStruct;
1939        let mut len = 0;
1940        if !self.original_indices.is_empty() {
1941            len += 1;
1942        }
1943        if !self.data.is_empty() {
1944            len += 1;
1945        }
1946        let mut struct_ser = serializer.serialize_struct("common.WorkerSlotMapping", len)?;
1947        if !self.original_indices.is_empty() {
1948            struct_ser.serialize_field("originalIndices", &self.original_indices)?;
1949        }
1950        if !self.data.is_empty() {
1951            struct_ser.serialize_field("data", &self.data.iter().map(ToString::to_string).collect::<Vec<_>>())?;
1952        }
1953        struct_ser.end()
1954    }
1955}
1956impl<'de> serde::Deserialize<'de> for WorkerSlotMapping {
1957    #[allow(deprecated)]
1958    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1959    where
1960        D: serde::Deserializer<'de>,
1961    {
1962        const FIELDS: &[&str] = &[
1963            "original_indices",
1964            "originalIndices",
1965            "data",
1966        ];
1967
1968        #[allow(clippy::enum_variant_names)]
1969        enum GeneratedField {
1970            OriginalIndices,
1971            Data,
1972        }
1973        impl<'de> serde::Deserialize<'de> for GeneratedField {
1974            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1975            where
1976                D: serde::Deserializer<'de>,
1977            {
1978                struct GeneratedVisitor;
1979
1980                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1981                    type Value = GeneratedField;
1982
1983                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1984                        write!(formatter, "expected one of: {:?}", &FIELDS)
1985                    }
1986
1987                    #[allow(unused_variables)]
1988                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1989                    where
1990                        E: serde::de::Error,
1991                    {
1992                        match value {
1993                            "originalIndices" | "original_indices" => Ok(GeneratedField::OriginalIndices),
1994                            "data" => Ok(GeneratedField::Data),
1995                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1996                        }
1997                    }
1998                }
1999                deserializer.deserialize_identifier(GeneratedVisitor)
2000            }
2001        }
2002        struct GeneratedVisitor;
2003        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2004            type Value = WorkerSlotMapping;
2005
2006            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2007                formatter.write_str("struct common.WorkerSlotMapping")
2008            }
2009
2010            fn visit_map<V>(self, mut map_: V) -> std::result::Result<WorkerSlotMapping, V::Error>
2011                where
2012                    V: serde::de::MapAccess<'de>,
2013            {
2014                let mut original_indices__ = None;
2015                let mut data__ = None;
2016                while let Some(k) = map_.next_key()? {
2017                    match k {
2018                        GeneratedField::OriginalIndices => {
2019                            if original_indices__.is_some() {
2020                                return Err(serde::de::Error::duplicate_field("originalIndices"));
2021                            }
2022                            original_indices__ = 
2023                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
2024                                    .into_iter().map(|x| x.0).collect())
2025                            ;
2026                        }
2027                        GeneratedField::Data => {
2028                            if data__.is_some() {
2029                                return Err(serde::de::Error::duplicate_field("data"));
2030                            }
2031                            data__ = 
2032                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
2033                                    .into_iter().map(|x| x.0).collect())
2034                            ;
2035                        }
2036                    }
2037                }
2038                Ok(WorkerSlotMapping {
2039                    original_indices: original_indices__.unwrap_or_default(),
2040                    data: data__.unwrap_or_default(),
2041                })
2042            }
2043        }
2044        deserializer.deserialize_struct("common.WorkerSlotMapping", FIELDS, GeneratedVisitor)
2045    }
2046}
2047impl serde::Serialize for WorkerType {
2048    #[allow(deprecated)]
2049    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2050    where
2051        S: serde::Serializer,
2052    {
2053        let variant = match self {
2054            Self::Unspecified => "WORKER_TYPE_UNSPECIFIED",
2055            Self::Frontend => "WORKER_TYPE_FRONTEND",
2056            Self::ComputeNode => "WORKER_TYPE_COMPUTE_NODE",
2057            Self::RiseCtl => "WORKER_TYPE_RISE_CTL",
2058            Self::Compactor => "WORKER_TYPE_COMPACTOR",
2059            Self::Meta => "WORKER_TYPE_META",
2060        };
2061        serializer.serialize_str(variant)
2062    }
2063}
2064impl<'de> serde::Deserialize<'de> for WorkerType {
2065    #[allow(deprecated)]
2066    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2067    where
2068        D: serde::Deserializer<'de>,
2069    {
2070        const FIELDS: &[&str] = &[
2071            "WORKER_TYPE_UNSPECIFIED",
2072            "WORKER_TYPE_FRONTEND",
2073            "WORKER_TYPE_COMPUTE_NODE",
2074            "WORKER_TYPE_RISE_CTL",
2075            "WORKER_TYPE_COMPACTOR",
2076            "WORKER_TYPE_META",
2077        ];
2078
2079        struct GeneratedVisitor;
2080
2081        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2082            type Value = WorkerType;
2083
2084            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2085                write!(formatter, "expected one of: {:?}", &FIELDS)
2086            }
2087
2088            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
2089            where
2090                E: serde::de::Error,
2091            {
2092                i32::try_from(v)
2093                    .ok()
2094                    .and_then(|x| x.try_into().ok())
2095                    .ok_or_else(|| {
2096                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
2097                    })
2098            }
2099
2100            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
2101            where
2102                E: serde::de::Error,
2103            {
2104                i32::try_from(v)
2105                    .ok()
2106                    .and_then(|x| x.try_into().ok())
2107                    .ok_or_else(|| {
2108                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
2109                    })
2110            }
2111
2112            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2113            where
2114                E: serde::de::Error,
2115            {
2116                match value {
2117                    "WORKER_TYPE_UNSPECIFIED" => Ok(WorkerType::Unspecified),
2118                    "WORKER_TYPE_FRONTEND" => Ok(WorkerType::Frontend),
2119                    "WORKER_TYPE_COMPUTE_NODE" => Ok(WorkerType::ComputeNode),
2120                    "WORKER_TYPE_RISE_CTL" => Ok(WorkerType::RiseCtl),
2121                    "WORKER_TYPE_COMPACTOR" => Ok(WorkerType::Compactor),
2122                    "WORKER_TYPE_META" => Ok(WorkerType::Meta),
2123                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
2124                }
2125            }
2126        }
2127        deserializer.deserialize_any(GeneratedVisitor)
2128    }
2129}