1use crate::backup_service::*;
2impl serde::Serialize for BackupJobStatus {
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 let variant = match self {
9 Self::Unspecified => "UNSPECIFIED",
10 Self::Running => "RUNNING",
11 Self::Succeeded => "SUCCEEDED",
12 Self::NotFound => "NOT_FOUND",
13 Self::Failed => "FAILED",
14 };
15 serializer.serialize_str(variant)
16 }
17}
18impl<'de> serde::Deserialize<'de> for BackupJobStatus {
19 #[allow(deprecated)]
20 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21 where
22 D: serde::Deserializer<'de>,
23 {
24 const FIELDS: &[&str] = &[
25 "UNSPECIFIED",
26 "RUNNING",
27 "SUCCEEDED",
28 "NOT_FOUND",
29 "FAILED",
30 ];
31
32 struct GeneratedVisitor;
33
34 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
35 type Value = BackupJobStatus;
36
37 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38 write!(formatter, "expected one of: {:?}", &FIELDS)
39 }
40
41 fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
42 where
43 E: serde::de::Error,
44 {
45 i32::try_from(v)
46 .ok()
47 .and_then(|x| x.try_into().ok())
48 .ok_or_else(|| {
49 serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
50 })
51 }
52
53 fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
54 where
55 E: serde::de::Error,
56 {
57 i32::try_from(v)
58 .ok()
59 .and_then(|x| x.try_into().ok())
60 .ok_or_else(|| {
61 serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
62 })
63 }
64
65 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
66 where
67 E: serde::de::Error,
68 {
69 match value {
70 "UNSPECIFIED" => Ok(BackupJobStatus::Unspecified),
71 "RUNNING" => Ok(BackupJobStatus::Running),
72 "SUCCEEDED" => Ok(BackupJobStatus::Succeeded),
73 "NOT_FOUND" => Ok(BackupJobStatus::NotFound),
74 "FAILED" => Ok(BackupJobStatus::Failed),
75 _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
76 }
77 }
78 }
79 deserializer.deserialize_any(GeneratedVisitor)
80 }
81}
82impl serde::Serialize for BackupMetaRequest {
83 #[allow(deprecated)]
84 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
85 where
86 S: serde::Serializer,
87 {
88 use serde::ser::SerializeStruct;
89 let mut len = 0;
90 if self.remarks.is_some() {
91 len += 1;
92 }
93 let mut struct_ser = serializer.serialize_struct("backup_service.BackupMetaRequest", len)?;
94 if let Some(v) = self.remarks.as_ref() {
95 struct_ser.serialize_field("remarks", v)?;
96 }
97 struct_ser.end()
98 }
99}
100impl<'de> serde::Deserialize<'de> for BackupMetaRequest {
101 #[allow(deprecated)]
102 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
103 where
104 D: serde::Deserializer<'de>,
105 {
106 const FIELDS: &[&str] = &[
107 "remarks",
108 ];
109
110 #[allow(clippy::enum_variant_names)]
111 enum GeneratedField {
112 Remarks,
113 }
114 impl<'de> serde::Deserialize<'de> for GeneratedField {
115 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
116 where
117 D: serde::Deserializer<'de>,
118 {
119 struct GeneratedVisitor;
120
121 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
122 type Value = GeneratedField;
123
124 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
125 write!(formatter, "expected one of: {:?}", &FIELDS)
126 }
127
128 #[allow(unused_variables)]
129 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
130 where
131 E: serde::de::Error,
132 {
133 match value {
134 "remarks" => Ok(GeneratedField::Remarks),
135 _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
136 }
137 }
138 }
139 deserializer.deserialize_identifier(GeneratedVisitor)
140 }
141 }
142 struct GeneratedVisitor;
143 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
144 type Value = BackupMetaRequest;
145
146 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
147 formatter.write_str("struct backup_service.BackupMetaRequest")
148 }
149
150 fn visit_map<V>(self, mut map_: V) -> std::result::Result<BackupMetaRequest, V::Error>
151 where
152 V: serde::de::MapAccess<'de>,
153 {
154 let mut remarks__ = None;
155 while let Some(k) = map_.next_key()? {
156 match k {
157 GeneratedField::Remarks => {
158 if remarks__.is_some() {
159 return Err(serde::de::Error::duplicate_field("remarks"));
160 }
161 remarks__ = map_.next_value()?;
162 }
163 }
164 }
165 Ok(BackupMetaRequest {
166 remarks: remarks__,
167 })
168 }
169 }
170 deserializer.deserialize_struct("backup_service.BackupMetaRequest", FIELDS, GeneratedVisitor)
171 }
172}
173impl serde::Serialize for BackupMetaResponse {
174 #[allow(deprecated)]
175 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
176 where
177 S: serde::Serializer,
178 {
179 use serde::ser::SerializeStruct;
180 let mut len = 0;
181 if self.job_id != 0 {
182 len += 1;
183 }
184 let mut struct_ser = serializer.serialize_struct("backup_service.BackupMetaResponse", len)?;
185 if self.job_id != 0 {
186 #[allow(clippy::needless_borrow)]
187 #[allow(clippy::needless_borrows_for_generic_args)]
188 struct_ser.serialize_field("jobId", ToString::to_string(&self.job_id).as_str())?;
189 }
190 struct_ser.end()
191 }
192}
193impl<'de> serde::Deserialize<'de> for BackupMetaResponse {
194 #[allow(deprecated)]
195 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
196 where
197 D: serde::Deserializer<'de>,
198 {
199 const FIELDS: &[&str] = &[
200 "job_id",
201 "jobId",
202 ];
203
204 #[allow(clippy::enum_variant_names)]
205 enum GeneratedField {
206 JobId,
207 }
208 impl<'de> serde::Deserialize<'de> for GeneratedField {
209 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
210 where
211 D: serde::Deserializer<'de>,
212 {
213 struct GeneratedVisitor;
214
215 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
216 type Value = GeneratedField;
217
218 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
219 write!(formatter, "expected one of: {:?}", &FIELDS)
220 }
221
222 #[allow(unused_variables)]
223 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
224 where
225 E: serde::de::Error,
226 {
227 match value {
228 "jobId" | "job_id" => Ok(GeneratedField::JobId),
229 _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
230 }
231 }
232 }
233 deserializer.deserialize_identifier(GeneratedVisitor)
234 }
235 }
236 struct GeneratedVisitor;
237 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
238 type Value = BackupMetaResponse;
239
240 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
241 formatter.write_str("struct backup_service.BackupMetaResponse")
242 }
243
244 fn visit_map<V>(self, mut map_: V) -> std::result::Result<BackupMetaResponse, V::Error>
245 where
246 V: serde::de::MapAccess<'de>,
247 {
248 let mut job_id__ = None;
249 while let Some(k) = map_.next_key()? {
250 match k {
251 GeneratedField::JobId => {
252 if job_id__.is_some() {
253 return Err(serde::de::Error::duplicate_field("jobId"));
254 }
255 job_id__ =
256 Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
257 ;
258 }
259 }
260 }
261 Ok(BackupMetaResponse {
262 job_id: job_id__.unwrap_or_default(),
263 })
264 }
265 }
266 deserializer.deserialize_struct("backup_service.BackupMetaResponse", FIELDS, GeneratedVisitor)
267 }
268}
269impl serde::Serialize for DeleteMetaSnapshotRequest {
270 #[allow(deprecated)]
271 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
272 where
273 S: serde::Serializer,
274 {
275 use serde::ser::SerializeStruct;
276 let mut len = 0;
277 if !self.snapshot_ids.is_empty() {
278 len += 1;
279 }
280 let mut struct_ser = serializer.serialize_struct("backup_service.DeleteMetaSnapshotRequest", len)?;
281 if !self.snapshot_ids.is_empty() {
282 struct_ser.serialize_field("snapshotIds", &self.snapshot_ids.iter().map(ToString::to_string).collect::<Vec<_>>())?;
283 }
284 struct_ser.end()
285 }
286}
287impl<'de> serde::Deserialize<'de> for DeleteMetaSnapshotRequest {
288 #[allow(deprecated)]
289 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
290 where
291 D: serde::Deserializer<'de>,
292 {
293 const FIELDS: &[&str] = &[
294 "snapshot_ids",
295 "snapshotIds",
296 ];
297
298 #[allow(clippy::enum_variant_names)]
299 enum GeneratedField {
300 SnapshotIds,
301 }
302 impl<'de> serde::Deserialize<'de> for GeneratedField {
303 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
304 where
305 D: serde::Deserializer<'de>,
306 {
307 struct GeneratedVisitor;
308
309 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
310 type Value = GeneratedField;
311
312 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
313 write!(formatter, "expected one of: {:?}", &FIELDS)
314 }
315
316 #[allow(unused_variables)]
317 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
318 where
319 E: serde::de::Error,
320 {
321 match value {
322 "snapshotIds" | "snapshot_ids" => Ok(GeneratedField::SnapshotIds),
323 _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
324 }
325 }
326 }
327 deserializer.deserialize_identifier(GeneratedVisitor)
328 }
329 }
330 struct GeneratedVisitor;
331 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
332 type Value = DeleteMetaSnapshotRequest;
333
334 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
335 formatter.write_str("struct backup_service.DeleteMetaSnapshotRequest")
336 }
337
338 fn visit_map<V>(self, mut map_: V) -> std::result::Result<DeleteMetaSnapshotRequest, V::Error>
339 where
340 V: serde::de::MapAccess<'de>,
341 {
342 let mut snapshot_ids__ = None;
343 while let Some(k) = map_.next_key()? {
344 match k {
345 GeneratedField::SnapshotIds => {
346 if snapshot_ids__.is_some() {
347 return Err(serde::de::Error::duplicate_field("snapshotIds"));
348 }
349 snapshot_ids__ =
350 Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
351 .into_iter().map(|x| x.0).collect())
352 ;
353 }
354 }
355 }
356 Ok(DeleteMetaSnapshotRequest {
357 snapshot_ids: snapshot_ids__.unwrap_or_default(),
358 })
359 }
360 }
361 deserializer.deserialize_struct("backup_service.DeleteMetaSnapshotRequest", FIELDS, GeneratedVisitor)
362 }
363}
364impl serde::Serialize for DeleteMetaSnapshotResponse {
365 #[allow(deprecated)]
366 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
367 where
368 S: serde::Serializer,
369 {
370 use serde::ser::SerializeStruct;
371 let len = 0;
372 let struct_ser = serializer.serialize_struct("backup_service.DeleteMetaSnapshotResponse", len)?;
373 struct_ser.end()
374 }
375}
376impl<'de> serde::Deserialize<'de> for DeleteMetaSnapshotResponse {
377 #[allow(deprecated)]
378 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
379 where
380 D: serde::Deserializer<'de>,
381 {
382 const FIELDS: &[&str] = &[
383 ];
384
385 #[allow(clippy::enum_variant_names)]
386 enum GeneratedField {
387 }
388 impl<'de> serde::Deserialize<'de> for GeneratedField {
389 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
390 where
391 D: serde::Deserializer<'de>,
392 {
393 struct GeneratedVisitor;
394
395 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
396 type Value = GeneratedField;
397
398 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
399 write!(formatter, "expected one of: {:?}", &FIELDS)
400 }
401
402 #[allow(unused_variables)]
403 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
404 where
405 E: serde::de::Error,
406 {
407 Err(serde::de::Error::unknown_field(value, FIELDS))
408 }
409 }
410 deserializer.deserialize_identifier(GeneratedVisitor)
411 }
412 }
413 struct GeneratedVisitor;
414 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
415 type Value = DeleteMetaSnapshotResponse;
416
417 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
418 formatter.write_str("struct backup_service.DeleteMetaSnapshotResponse")
419 }
420
421 fn visit_map<V>(self, mut map_: V) -> std::result::Result<DeleteMetaSnapshotResponse, V::Error>
422 where
423 V: serde::de::MapAccess<'de>,
424 {
425 while map_.next_key::<GeneratedField>()?.is_some() {
426 let _ = map_.next_value::<serde::de::IgnoredAny>()?;
427 }
428 Ok(DeleteMetaSnapshotResponse {
429 })
430 }
431 }
432 deserializer.deserialize_struct("backup_service.DeleteMetaSnapshotResponse", FIELDS, GeneratedVisitor)
433 }
434}
435impl serde::Serialize for GetBackupJobStatusRequest {
436 #[allow(deprecated)]
437 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
438 where
439 S: serde::Serializer,
440 {
441 use serde::ser::SerializeStruct;
442 let mut len = 0;
443 if self.job_id != 0 {
444 len += 1;
445 }
446 let mut struct_ser = serializer.serialize_struct("backup_service.GetBackupJobStatusRequest", len)?;
447 if self.job_id != 0 {
448 #[allow(clippy::needless_borrow)]
449 #[allow(clippy::needless_borrows_for_generic_args)]
450 struct_ser.serialize_field("jobId", ToString::to_string(&self.job_id).as_str())?;
451 }
452 struct_ser.end()
453 }
454}
455impl<'de> serde::Deserialize<'de> for GetBackupJobStatusRequest {
456 #[allow(deprecated)]
457 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
458 where
459 D: serde::Deserializer<'de>,
460 {
461 const FIELDS: &[&str] = &[
462 "job_id",
463 "jobId",
464 ];
465
466 #[allow(clippy::enum_variant_names)]
467 enum GeneratedField {
468 JobId,
469 }
470 impl<'de> serde::Deserialize<'de> for GeneratedField {
471 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
472 where
473 D: serde::Deserializer<'de>,
474 {
475 struct GeneratedVisitor;
476
477 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
478 type Value = GeneratedField;
479
480 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
481 write!(formatter, "expected one of: {:?}", &FIELDS)
482 }
483
484 #[allow(unused_variables)]
485 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
486 where
487 E: serde::de::Error,
488 {
489 match value {
490 "jobId" | "job_id" => Ok(GeneratedField::JobId),
491 _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
492 }
493 }
494 }
495 deserializer.deserialize_identifier(GeneratedVisitor)
496 }
497 }
498 struct GeneratedVisitor;
499 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
500 type Value = GetBackupJobStatusRequest;
501
502 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
503 formatter.write_str("struct backup_service.GetBackupJobStatusRequest")
504 }
505
506 fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetBackupJobStatusRequest, V::Error>
507 where
508 V: serde::de::MapAccess<'de>,
509 {
510 let mut job_id__ = None;
511 while let Some(k) = map_.next_key()? {
512 match k {
513 GeneratedField::JobId => {
514 if job_id__.is_some() {
515 return Err(serde::de::Error::duplicate_field("jobId"));
516 }
517 job_id__ =
518 Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
519 ;
520 }
521 }
522 }
523 Ok(GetBackupJobStatusRequest {
524 job_id: job_id__.unwrap_or_default(),
525 })
526 }
527 }
528 deserializer.deserialize_struct("backup_service.GetBackupJobStatusRequest", FIELDS, GeneratedVisitor)
529 }
530}
531impl serde::Serialize for GetBackupJobStatusResponse {
532 #[allow(deprecated)]
533 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
534 where
535 S: serde::Serializer,
536 {
537 use serde::ser::SerializeStruct;
538 let mut len = 0;
539 if self.job_id != 0 {
540 len += 1;
541 }
542 if self.job_status != 0 {
543 len += 1;
544 }
545 if !self.message.is_empty() {
546 len += 1;
547 }
548 let mut struct_ser = serializer.serialize_struct("backup_service.GetBackupJobStatusResponse", len)?;
549 if self.job_id != 0 {
550 #[allow(clippy::needless_borrow)]
551 #[allow(clippy::needless_borrows_for_generic_args)]
552 struct_ser.serialize_field("jobId", ToString::to_string(&self.job_id).as_str())?;
553 }
554 if self.job_status != 0 {
555 let v = BackupJobStatus::try_from(self.job_status)
556 .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.job_status)))?;
557 struct_ser.serialize_field("jobStatus", &v)?;
558 }
559 if !self.message.is_empty() {
560 struct_ser.serialize_field("message", &self.message)?;
561 }
562 struct_ser.end()
563 }
564}
565impl<'de> serde::Deserialize<'de> for GetBackupJobStatusResponse {
566 #[allow(deprecated)]
567 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
568 where
569 D: serde::Deserializer<'de>,
570 {
571 const FIELDS: &[&str] = &[
572 "job_id",
573 "jobId",
574 "job_status",
575 "jobStatus",
576 "message",
577 ];
578
579 #[allow(clippy::enum_variant_names)]
580 enum GeneratedField {
581 JobId,
582 JobStatus,
583 Message,
584 }
585 impl<'de> serde::Deserialize<'de> for GeneratedField {
586 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
587 where
588 D: serde::Deserializer<'de>,
589 {
590 struct GeneratedVisitor;
591
592 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
593 type Value = GeneratedField;
594
595 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
596 write!(formatter, "expected one of: {:?}", &FIELDS)
597 }
598
599 #[allow(unused_variables)]
600 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
601 where
602 E: serde::de::Error,
603 {
604 match value {
605 "jobId" | "job_id" => Ok(GeneratedField::JobId),
606 "jobStatus" | "job_status" => Ok(GeneratedField::JobStatus),
607 "message" => Ok(GeneratedField::Message),
608 _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
609 }
610 }
611 }
612 deserializer.deserialize_identifier(GeneratedVisitor)
613 }
614 }
615 struct GeneratedVisitor;
616 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
617 type Value = GetBackupJobStatusResponse;
618
619 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
620 formatter.write_str("struct backup_service.GetBackupJobStatusResponse")
621 }
622
623 fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetBackupJobStatusResponse, V::Error>
624 where
625 V: serde::de::MapAccess<'de>,
626 {
627 let mut job_id__ = None;
628 let mut job_status__ = None;
629 let mut message__ = None;
630 while let Some(k) = map_.next_key()? {
631 match k {
632 GeneratedField::JobId => {
633 if job_id__.is_some() {
634 return Err(serde::de::Error::duplicate_field("jobId"));
635 }
636 job_id__ =
637 Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
638 ;
639 }
640 GeneratedField::JobStatus => {
641 if job_status__.is_some() {
642 return Err(serde::de::Error::duplicate_field("jobStatus"));
643 }
644 job_status__ = Some(map_.next_value::<BackupJobStatus>()? as i32);
645 }
646 GeneratedField::Message => {
647 if message__.is_some() {
648 return Err(serde::de::Error::duplicate_field("message"));
649 }
650 message__ = Some(map_.next_value()?);
651 }
652 }
653 }
654 Ok(GetBackupJobStatusResponse {
655 job_id: job_id__.unwrap_or_default(),
656 job_status: job_status__.unwrap_or_default(),
657 message: message__.unwrap_or_default(),
658 })
659 }
660 }
661 deserializer.deserialize_struct("backup_service.GetBackupJobStatusResponse", FIELDS, GeneratedVisitor)
662 }
663}
664impl serde::Serialize for GetMetaSnapshotManifestRequest {
665 #[allow(deprecated)]
666 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
667 where
668 S: serde::Serializer,
669 {
670 use serde::ser::SerializeStruct;
671 let len = 0;
672 let struct_ser = serializer.serialize_struct("backup_service.GetMetaSnapshotManifestRequest", len)?;
673 struct_ser.end()
674 }
675}
676impl<'de> serde::Deserialize<'de> for GetMetaSnapshotManifestRequest {
677 #[allow(deprecated)]
678 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
679 where
680 D: serde::Deserializer<'de>,
681 {
682 const FIELDS: &[&str] = &[
683 ];
684
685 #[allow(clippy::enum_variant_names)]
686 enum GeneratedField {
687 }
688 impl<'de> serde::Deserialize<'de> for GeneratedField {
689 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
690 where
691 D: serde::Deserializer<'de>,
692 {
693 struct GeneratedVisitor;
694
695 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
696 type Value = GeneratedField;
697
698 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
699 write!(formatter, "expected one of: {:?}", &FIELDS)
700 }
701
702 #[allow(unused_variables)]
703 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
704 where
705 E: serde::de::Error,
706 {
707 Err(serde::de::Error::unknown_field(value, FIELDS))
708 }
709 }
710 deserializer.deserialize_identifier(GeneratedVisitor)
711 }
712 }
713 struct GeneratedVisitor;
714 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
715 type Value = GetMetaSnapshotManifestRequest;
716
717 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
718 formatter.write_str("struct backup_service.GetMetaSnapshotManifestRequest")
719 }
720
721 fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetMetaSnapshotManifestRequest, V::Error>
722 where
723 V: serde::de::MapAccess<'de>,
724 {
725 while map_.next_key::<GeneratedField>()?.is_some() {
726 let _ = map_.next_value::<serde::de::IgnoredAny>()?;
727 }
728 Ok(GetMetaSnapshotManifestRequest {
729 })
730 }
731 }
732 deserializer.deserialize_struct("backup_service.GetMetaSnapshotManifestRequest", FIELDS, GeneratedVisitor)
733 }
734}
735impl serde::Serialize for GetMetaSnapshotManifestResponse {
736 #[allow(deprecated)]
737 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
738 where
739 S: serde::Serializer,
740 {
741 use serde::ser::SerializeStruct;
742 let mut len = 0;
743 if self.manifest.is_some() {
744 len += 1;
745 }
746 let mut struct_ser = serializer.serialize_struct("backup_service.GetMetaSnapshotManifestResponse", len)?;
747 if let Some(v) = self.manifest.as_ref() {
748 struct_ser.serialize_field("manifest", v)?;
749 }
750 struct_ser.end()
751 }
752}
753impl<'de> serde::Deserialize<'de> for GetMetaSnapshotManifestResponse {
754 #[allow(deprecated)]
755 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
756 where
757 D: serde::Deserializer<'de>,
758 {
759 const FIELDS: &[&str] = &[
760 "manifest",
761 ];
762
763 #[allow(clippy::enum_variant_names)]
764 enum GeneratedField {
765 Manifest,
766 }
767 impl<'de> serde::Deserialize<'de> for GeneratedField {
768 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
769 where
770 D: serde::Deserializer<'de>,
771 {
772 struct GeneratedVisitor;
773
774 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
775 type Value = GeneratedField;
776
777 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
778 write!(formatter, "expected one of: {:?}", &FIELDS)
779 }
780
781 #[allow(unused_variables)]
782 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
783 where
784 E: serde::de::Error,
785 {
786 match value {
787 "manifest" => Ok(GeneratedField::Manifest),
788 _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
789 }
790 }
791 }
792 deserializer.deserialize_identifier(GeneratedVisitor)
793 }
794 }
795 struct GeneratedVisitor;
796 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
797 type Value = GetMetaSnapshotManifestResponse;
798
799 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
800 formatter.write_str("struct backup_service.GetMetaSnapshotManifestResponse")
801 }
802
803 fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetMetaSnapshotManifestResponse, V::Error>
804 where
805 V: serde::de::MapAccess<'de>,
806 {
807 let mut manifest__ = None;
808 while let Some(k) = map_.next_key()? {
809 match k {
810 GeneratedField::Manifest => {
811 if manifest__.is_some() {
812 return Err(serde::de::Error::duplicate_field("manifest"));
813 }
814 manifest__ = map_.next_value()?;
815 }
816 }
817 }
818 Ok(GetMetaSnapshotManifestResponse {
819 manifest: manifest__,
820 })
821 }
822 }
823 deserializer.deserialize_struct("backup_service.GetMetaSnapshotManifestResponse", FIELDS, GeneratedVisitor)
824 }
825}
826impl serde::Serialize for MetaBackupManifestId {
827 #[allow(deprecated)]
828 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
829 where
830 S: serde::Serializer,
831 {
832 use serde::ser::SerializeStruct;
833 let mut len = 0;
834 if self.id != 0 {
835 len += 1;
836 }
837 let mut struct_ser = serializer.serialize_struct("backup_service.MetaBackupManifestId", len)?;
838 if self.id != 0 {
839 #[allow(clippy::needless_borrow)]
840 #[allow(clippy::needless_borrows_for_generic_args)]
841 struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?;
842 }
843 struct_ser.end()
844 }
845}
846impl<'de> serde::Deserialize<'de> for MetaBackupManifestId {
847 #[allow(deprecated)]
848 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
849 where
850 D: serde::Deserializer<'de>,
851 {
852 const FIELDS: &[&str] = &[
853 "id",
854 ];
855
856 #[allow(clippy::enum_variant_names)]
857 enum GeneratedField {
858 Id,
859 }
860 impl<'de> serde::Deserialize<'de> for GeneratedField {
861 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
862 where
863 D: serde::Deserializer<'de>,
864 {
865 struct GeneratedVisitor;
866
867 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
868 type Value = GeneratedField;
869
870 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
871 write!(formatter, "expected one of: {:?}", &FIELDS)
872 }
873
874 #[allow(unused_variables)]
875 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
876 where
877 E: serde::de::Error,
878 {
879 match value {
880 "id" => Ok(GeneratedField::Id),
881 _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
882 }
883 }
884 }
885 deserializer.deserialize_identifier(GeneratedVisitor)
886 }
887 }
888 struct GeneratedVisitor;
889 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
890 type Value = MetaBackupManifestId;
891
892 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
893 formatter.write_str("struct backup_service.MetaBackupManifestId")
894 }
895
896 fn visit_map<V>(self, mut map_: V) -> std::result::Result<MetaBackupManifestId, V::Error>
897 where
898 V: serde::de::MapAccess<'de>,
899 {
900 let mut id__ = None;
901 while let Some(k) = map_.next_key()? {
902 match k {
903 GeneratedField::Id => {
904 if id__.is_some() {
905 return Err(serde::de::Error::duplicate_field("id"));
906 }
907 id__ =
908 Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
909 ;
910 }
911 }
912 }
913 Ok(MetaBackupManifestId {
914 id: id__.unwrap_or_default(),
915 })
916 }
917 }
918 deserializer.deserialize_struct("backup_service.MetaBackupManifestId", FIELDS, GeneratedVisitor)
919 }
920}
921impl serde::Serialize for MetaSnapshotManifest {
922 #[allow(deprecated)]
923 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
924 where
925 S: serde::Serializer,
926 {
927 use serde::ser::SerializeStruct;
928 let mut len = 0;
929 if self.manifest_id != 0 {
930 len += 1;
931 }
932 if !self.snapshot_metadata.is_empty() {
933 len += 1;
934 }
935 let mut struct_ser = serializer.serialize_struct("backup_service.MetaSnapshotManifest", len)?;
936 if self.manifest_id != 0 {
937 #[allow(clippy::needless_borrow)]
938 #[allow(clippy::needless_borrows_for_generic_args)]
939 struct_ser.serialize_field("manifestId", ToString::to_string(&self.manifest_id).as_str())?;
940 }
941 if !self.snapshot_metadata.is_empty() {
942 struct_ser.serialize_field("snapshotMetadata", &self.snapshot_metadata)?;
943 }
944 struct_ser.end()
945 }
946}
947impl<'de> serde::Deserialize<'de> for MetaSnapshotManifest {
948 #[allow(deprecated)]
949 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
950 where
951 D: serde::Deserializer<'de>,
952 {
953 const FIELDS: &[&str] = &[
954 "manifest_id",
955 "manifestId",
956 "snapshot_metadata",
957 "snapshotMetadata",
958 ];
959
960 #[allow(clippy::enum_variant_names)]
961 enum GeneratedField {
962 ManifestId,
963 SnapshotMetadata,
964 }
965 impl<'de> serde::Deserialize<'de> for GeneratedField {
966 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
967 where
968 D: serde::Deserializer<'de>,
969 {
970 struct GeneratedVisitor;
971
972 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
973 type Value = GeneratedField;
974
975 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
976 write!(formatter, "expected one of: {:?}", &FIELDS)
977 }
978
979 #[allow(unused_variables)]
980 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
981 where
982 E: serde::de::Error,
983 {
984 match value {
985 "manifestId" | "manifest_id" => Ok(GeneratedField::ManifestId),
986 "snapshotMetadata" | "snapshot_metadata" => Ok(GeneratedField::SnapshotMetadata),
987 _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
988 }
989 }
990 }
991 deserializer.deserialize_identifier(GeneratedVisitor)
992 }
993 }
994 struct GeneratedVisitor;
995 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
996 type Value = MetaSnapshotManifest;
997
998 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
999 formatter.write_str("struct backup_service.MetaSnapshotManifest")
1000 }
1001
1002 fn visit_map<V>(self, mut map_: V) -> std::result::Result<MetaSnapshotManifest, V::Error>
1003 where
1004 V: serde::de::MapAccess<'de>,
1005 {
1006 let mut manifest_id__ = None;
1007 let mut snapshot_metadata__ = None;
1008 while let Some(k) = map_.next_key()? {
1009 match k {
1010 GeneratedField::ManifestId => {
1011 if manifest_id__.is_some() {
1012 return Err(serde::de::Error::duplicate_field("manifestId"));
1013 }
1014 manifest_id__ =
1015 Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1016 ;
1017 }
1018 GeneratedField::SnapshotMetadata => {
1019 if snapshot_metadata__.is_some() {
1020 return Err(serde::de::Error::duplicate_field("snapshotMetadata"));
1021 }
1022 snapshot_metadata__ = Some(map_.next_value()?);
1023 }
1024 }
1025 }
1026 Ok(MetaSnapshotManifest {
1027 manifest_id: manifest_id__.unwrap_or_default(),
1028 snapshot_metadata: snapshot_metadata__.unwrap_or_default(),
1029 })
1030 }
1031 }
1032 deserializer.deserialize_struct("backup_service.MetaSnapshotManifest", FIELDS, GeneratedVisitor)
1033 }
1034}
1035impl serde::Serialize for MetaSnapshotMetadata {
1036 #[allow(deprecated)]
1037 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1038 where
1039 S: serde::Serializer,
1040 {
1041 use serde::ser::SerializeStruct;
1042 let mut len = 0;
1043 if self.id != 0 {
1044 len += 1;
1045 }
1046 if self.hummock_version_id != 0 {
1047 len += 1;
1048 }
1049 if self.format_version.is_some() {
1050 len += 1;
1051 }
1052 if self.remarks.is_some() {
1053 len += 1;
1054 }
1055 if self.rw_version.is_some() {
1056 len += 1;
1057 }
1058 if !self.state_table_info.is_empty() {
1059 len += 1;
1060 }
1061 let mut struct_ser = serializer.serialize_struct("backup_service.MetaSnapshotMetadata", len)?;
1062 if self.id != 0 {
1063 #[allow(clippy::needless_borrow)]
1064 #[allow(clippy::needless_borrows_for_generic_args)]
1065 struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?;
1066 }
1067 if self.hummock_version_id != 0 {
1068 #[allow(clippy::needless_borrow)]
1069 #[allow(clippy::needless_borrows_for_generic_args)]
1070 struct_ser.serialize_field("hummockVersionId", ToString::to_string(&self.hummock_version_id).as_str())?;
1071 }
1072 if let Some(v) = self.format_version.as_ref() {
1073 struct_ser.serialize_field("formatVersion", v)?;
1074 }
1075 if let Some(v) = self.remarks.as_ref() {
1076 struct_ser.serialize_field("remarks", v)?;
1077 }
1078 if let Some(v) = self.rw_version.as_ref() {
1079 struct_ser.serialize_field("rwVersion", v)?;
1080 }
1081 if !self.state_table_info.is_empty() {
1082 struct_ser.serialize_field("stateTableInfo", &self.state_table_info)?;
1083 }
1084 struct_ser.end()
1085 }
1086}
1087impl<'de> serde::Deserialize<'de> for MetaSnapshotMetadata {
1088 #[allow(deprecated)]
1089 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1090 where
1091 D: serde::Deserializer<'de>,
1092 {
1093 const FIELDS: &[&str] = &[
1094 "id",
1095 "hummock_version_id",
1096 "hummockVersionId",
1097 "format_version",
1098 "formatVersion",
1099 "remarks",
1100 "rw_version",
1101 "rwVersion",
1102 "state_table_info",
1103 "stateTableInfo",
1104 ];
1105
1106 #[allow(clippy::enum_variant_names)]
1107 enum GeneratedField {
1108 Id,
1109 HummockVersionId,
1110 FormatVersion,
1111 Remarks,
1112 RwVersion,
1113 StateTableInfo,
1114 }
1115 impl<'de> serde::Deserialize<'de> for GeneratedField {
1116 fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1117 where
1118 D: serde::Deserializer<'de>,
1119 {
1120 struct GeneratedVisitor;
1121
1122 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1123 type Value = GeneratedField;
1124
1125 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1126 write!(formatter, "expected one of: {:?}", &FIELDS)
1127 }
1128
1129 #[allow(unused_variables)]
1130 fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1131 where
1132 E: serde::de::Error,
1133 {
1134 match value {
1135 "id" => Ok(GeneratedField::Id),
1136 "hummockVersionId" | "hummock_version_id" => Ok(GeneratedField::HummockVersionId),
1137 "formatVersion" | "format_version" => Ok(GeneratedField::FormatVersion),
1138 "remarks" => Ok(GeneratedField::Remarks),
1139 "rwVersion" | "rw_version" => Ok(GeneratedField::RwVersion),
1140 "stateTableInfo" | "state_table_info" => Ok(GeneratedField::StateTableInfo),
1141 _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1142 }
1143 }
1144 }
1145 deserializer.deserialize_identifier(GeneratedVisitor)
1146 }
1147 }
1148 struct GeneratedVisitor;
1149 impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1150 type Value = MetaSnapshotMetadata;
1151
1152 fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1153 formatter.write_str("struct backup_service.MetaSnapshotMetadata")
1154 }
1155
1156 fn visit_map<V>(self, mut map_: V) -> std::result::Result<MetaSnapshotMetadata, V::Error>
1157 where
1158 V: serde::de::MapAccess<'de>,
1159 {
1160 let mut id__ = None;
1161 let mut hummock_version_id__ = None;
1162 let mut format_version__ = None;
1163 let mut remarks__ = None;
1164 let mut rw_version__ = None;
1165 let mut state_table_info__ = None;
1166 while let Some(k) = map_.next_key()? {
1167 match k {
1168 GeneratedField::Id => {
1169 if id__.is_some() {
1170 return Err(serde::de::Error::duplicate_field("id"));
1171 }
1172 id__ =
1173 Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1174 ;
1175 }
1176 GeneratedField::HummockVersionId => {
1177 if hummock_version_id__.is_some() {
1178 return Err(serde::de::Error::duplicate_field("hummockVersionId"));
1179 }
1180 hummock_version_id__ =
1181 Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1182 ;
1183 }
1184 GeneratedField::FormatVersion => {
1185 if format_version__.is_some() {
1186 return Err(serde::de::Error::duplicate_field("formatVersion"));
1187 }
1188 format_version__ =
1189 map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
1190 ;
1191 }
1192 GeneratedField::Remarks => {
1193 if remarks__.is_some() {
1194 return Err(serde::de::Error::duplicate_field("remarks"));
1195 }
1196 remarks__ = map_.next_value()?;
1197 }
1198 GeneratedField::RwVersion => {
1199 if rw_version__.is_some() {
1200 return Err(serde::de::Error::duplicate_field("rwVersion"));
1201 }
1202 rw_version__ = map_.next_value()?;
1203 }
1204 GeneratedField::StateTableInfo => {
1205 if state_table_info__.is_some() {
1206 return Err(serde::de::Error::duplicate_field("stateTableInfo"));
1207 }
1208 state_table_info__ = Some(
1209 map_.next_value::<std::collections::HashMap<::pbjson::private::NumberDeserialize<u32>, _>>()?
1210 .into_iter().map(|(k,v)| (k.0, v)).collect()
1211 );
1212 }
1213 }
1214 }
1215 Ok(MetaSnapshotMetadata {
1216 id: id__.unwrap_or_default(),
1217 hummock_version_id: hummock_version_id__.unwrap_or_default(),
1218 format_version: format_version__,
1219 remarks: remarks__,
1220 rw_version: rw_version__,
1221 state_table_info: state_table_info__.unwrap_or_default(),
1222 })
1223 }
1224 }
1225 deserializer.deserialize_struct("backup_service.MetaSnapshotMetadata", FIELDS, GeneratedVisitor)
1226 }
1227}