kunobi-daemon 0.4.2

Process ownership, request draining, and verified upgrades for local daemons
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
// @generated by buffa-codegen. DO NOT EDIT.
// source: lifecycle.proto

/// Separates shared lifecycle operation IDs from application-owned operation IDs.
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum MessageKind {
    /// Operations maintained by kunobi-daemon.
    LIFECYCLE = 0i32,
    /// Operations maintained by the application, starting at 1.
    APPLICATION = 1i32,
}
impl MessageKind {
    ///Idiomatic alias for [`Self::LIFECYCLE`]; `Debug` prints the variant name.
    #[allow(non_upper_case_globals)]
    pub const Lifecycle: Self = Self::LIFECYCLE;
    ///Idiomatic alias for [`Self::APPLICATION`]; `Debug` prints the variant name.
    #[allow(non_upper_case_globals)]
    pub const Application: Self = Self::APPLICATION;
}
impl ::core::default::Default for MessageKind {
    fn default() -> Self {
        Self::LIFECYCLE
    }
}
impl ::buffa::Enumeration for MessageKind {
    fn from_i32(value: i32) -> ::core::option::Option<Self> {
        match value {
            0i32 => ::core::option::Option::Some(Self::LIFECYCLE),
            1i32 => ::core::option::Option::Some(Self::APPLICATION),
            _ => ::core::option::Option::None,
        }
    }
    fn to_i32(&self) -> i32 {
        *self as i32
    }
    fn proto_name(&self) -> &'static str {
        match self {
            Self::LIFECYCLE => "LIFECYCLE",
            Self::APPLICATION => "APPLICATION",
        }
    }
    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
        match name {
            "LIFECYCLE" => ::core::option::Option::Some(Self::LIFECYCLE),
            "APPLICATION" => ::core::option::Option::Some(Self::APPLICATION),
            _ => ::core::option::Option::None,
        }
    }
    fn values() -> &'static [Self] {
        &[Self::LIFECYCLE, Self::APPLICATION]
    }
}
/// Version/capability offer. Field numbers are part of the wire contract.
/// Never reuse a removed field number or change its type.
#[derive(Clone, PartialEq, Default)]
pub struct Hello {
    /// Oldest binary version this peer can speak.
    ///
    /// Field 1: `minimum`
    pub minimum: u32,
    /// Newest binary version this peer can speak.
    ///
    /// Field 2: `maximum`
    pub maximum: u32,
    /// Implemented optional capabilities.
    ///
    /// Field 3: `supported`
    pub supported: u64,
    /// Capabilities without which this connection must be refused.
    ///
    /// Field 4: `required`
    pub required: u64,
    /// Maximum encoded frame this peer will receive.
    ///
    /// Field 5: `max_frame`
    pub max_frame: u32,
    /// Application protocol identifier; not an authentication credential.
    ///
    /// Field 6: `application`
    pub application: ::buffa::alloc::string::String,
    /// Installation profile, such as stable or dev. Must match the peer exactly.
    ///
    /// Field 7: `profile`
    pub profile: ::buffa::alloc::string::String,
    /// Named service instance. Must match the peer exactly.
    ///
    /// Field 8: `instance`
    pub instance: ::buffa::alloc::string::String,
    /// Package-owned UUID, exactly 16 bytes, non-nil and stable across upgrades.
    /// This is an identity check, not an authentication credential.
    ///
    /// Field 9: `service_id`
    pub service_id: ::buffa::alloc::vec::Vec<u8>,
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Hello {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Hello")
            .field("minimum", &self.minimum)
            .field("maximum", &self.maximum)
            .field("supported", &self.supported)
            .field("required", &self.required)
            .field("max_frame", &self.max_frame)
            .field("application", &self.application)
            .field("profile", &self.profile)
            .field("instance", &self.instance)
            .field("service_id", &self.service_id)
            .finish()
    }
}
impl Hello {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/kunobi.daemon.v2.Hello";
}
::buffa::impl_default_instance!(Hello);
impl ::buffa::MessageName for Hello {
    const PACKAGE: &'static str = "kunobi.daemon.v2";
    const NAME: &'static str = "Hello";
    const FULL_NAME: &'static str = "kunobi.daemon.v2.Hello";
    const TYPE_URL: &'static str = "type.googleapis.com/kunobi.daemon.v2.Hello";
}
impl ::buffa::Message for Hello {
    /// Returns the total encoded size in bytes.
    ///
    /// Accumulates in `u64` (which cannot overflow for in-memory
    /// data) and saturates to `u32` at return, so a message whose
    /// encoded size exceeds the 2 GiB protobuf limit yields a value
    /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
    /// points reject, never a silently wrapped size.
    #[allow(clippy::let_and_return)]
    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u64;
        if self.minimum != 0u32 {
            size += 1u64 + ::buffa::types::uint32_encoded_len(self.minimum) as u64;
        }
        if self.maximum != 0u32 {
            size += 1u64 + ::buffa::types::uint32_encoded_len(self.maximum) as u64;
        }
        if self.supported != 0u64 {
            size += 1u64 + ::buffa::types::uint64_encoded_len(self.supported) as u64;
        }
        if self.required != 0u64 {
            size += 1u64 + ::buffa::types::uint64_encoded_len(self.required) as u64;
        }
        if self.max_frame != 0u32 {
            size += 1u64 + ::buffa::types::uint32_encoded_len(self.max_frame) as u64;
        }
        if !self.application.is_empty() {
            size += 1u64 + ::buffa::types::string_encoded_len(&self.application) as u64;
        }
        if !self.profile.is_empty() {
            size += 1u64 + ::buffa::types::string_encoded_len(&self.profile) as u64;
        }
        if !self.instance.is_empty() {
            size += 1u64 + ::buffa::types::string_encoded_len(&self.instance) as u64;
        }
        if !self.service_id.is_empty() {
            size += 1u64 + ::buffa::types::bytes_encoded_len(&self.service_id) as u64;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u64;
        ::buffa::saturate_size(size)
    }
    fn write_to(
        &self,
        _cache: &mut ::buffa::SizeCache,
        buf: &mut impl ::buffa::EncodeSink,
    ) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if self.minimum != 0u32 {
            ::buffa::types::put_uint32_field(1u32, self.minimum, buf);
        }
        if self.maximum != 0u32 {
            ::buffa::types::put_uint32_field(2u32, self.maximum, buf);
        }
        if self.supported != 0u64 {
            ::buffa::types::put_uint64_field(3u32, self.supported, buf);
        }
        if self.required != 0u64 {
            ::buffa::types::put_uint64_field(4u32, self.required, buf);
        }
        if self.max_frame != 0u32 {
            ::buffa::types::put_uint32_field(5u32, self.max_frame, buf);
        }
        if !self.application.is_empty() {
            ::buffa::types::put_string_field(6u32, &self.application, buf);
        }
        if !self.profile.is_empty() {
            ::buffa::types::put_string_field(7u32, &self.profile, buf);
        }
        if !self.instance.is_empty() {
            ::buffa::types::put_string_field(8u32, &self.instance, buf);
        }
        if !self.service_id.is_empty() {
            ::buffa::types::put_shared_bytes_field(9u32, &self.service_id, buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        ctx: ::buffa::DecodeContext<'_>,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.minimum = ::buffa::types::decode_uint32(buf)?;
            }
            2u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.maximum = ::buffa::types::decode_uint32(buf)?;
            }
            3u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.supported = ::buffa::types::decode_uint64(buf)?;
            }
            4u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.required = ::buffa::types::decode_uint64(buf)?;
            }
            5u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.max_frame = ::buffa::types::decode_uint32(buf)?;
            }
            6u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                ::buffa::types::merge_string(&mut self.application, buf)?;
            }
            7u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                ::buffa::types::merge_string(&mut self.profile, buf)?;
            }
            8u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                ::buffa::types::merge_string(&mut self.instance, buf)?;
            }
            9u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                ::buffa::types::merge_bytes(&mut self.service_id, buf)?;
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn clear(&mut self) {
        self.minimum = 0u32;
        self.maximum = 0u32;
        self.supported = 0u64;
        self.required = 0u64;
        self.max_frame = 0u32;
        self.application.clear();
        self.profile.clear();
        self.instance.clear();
        self.service_id.clear();
        self.__buffa_unknown_fields.clear();
    }
}
impl ::buffa::ExtensionSet for Hello {
    const PROTO_FQN: &'static str = "kunobi.daemon.v2.Hello";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
/// Common lifecycle control fields. Unknown fields are not interpreted by the Rust
/// receiver and retained when re-encoding. New semantics require capabilities.
#[derive(Clone, PartialEq, Default)]
pub struct Control {
    /// Operation: health=1, drain=2, prepare=3, paused=4, ready=5, commit=6, abort=7.
    /// For kind=APPLICATION, the application owns IDs starting at 1 instead.
    /// Never reuse retired operation IDs within either kind.
    ///
    /// Field 1: `operation`
    pub operation: u32,
    /// Caller-supplied correlation ID; never used to automatically replay work.
    ///
    /// Field 2: `request_id`
    pub request_id: u64,
    /// Destination generation, where applicable.
    ///
    /// Field 3: `generation`
    pub generation: u64,
    /// Attempt identity. The handoff coordinator validates its meaning.
    ///
    /// Field 4: `token`
    pub token: ::buffa::alloc::vec::Vec<u8>,
    /// Byte boundary acknowledged by the handoff peer. Absent differs from zero.
    ///
    /// Field 5: `offset`
    pub offset: ::core::option::Option<u64>,
    /// Bounded application data; large streams must be chunked.
    ///
    /// Field 6: `payload`
    pub payload: ::buffa::alloc::vec::Vec<u8>,
    /// Selects the operation namespace. Unknown kinds must be rejected.
    ///
    /// Field 7: `kind`
    pub kind: ::buffa::EnumValue<MessageKind>,
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Control {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Control")
            .field("operation", &self.operation)
            .field("request_id", &self.request_id)
            .field("generation", &self.generation)
            .field("token", &self.token)
            .field("offset", &self.offset)
            .field("payload", &self.payload)
            .field("kind", &self.kind)
            .finish()
    }
}
impl Control {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/kunobi.daemon.v2.Control";
}
impl Control {
    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
    #[inline]
    ///Sets [`Self::offset`] to `Some(value)`, consuming and returning `self`.
    pub fn with_offset(mut self, value: u64) -> Self {
        self.offset = Some(value);
        self
    }
}
::buffa::impl_default_instance!(Control);
impl ::buffa::MessageName for Control {
    const PACKAGE: &'static str = "kunobi.daemon.v2";
    const NAME: &'static str = "Control";
    const FULL_NAME: &'static str = "kunobi.daemon.v2.Control";
    const TYPE_URL: &'static str = "type.googleapis.com/kunobi.daemon.v2.Control";
}
impl ::buffa::Message for Control {
    /// Returns the total encoded size in bytes.
    ///
    /// Accumulates in `u64` (which cannot overflow for in-memory
    /// data) and saturates to `u32` at return, so a message whose
    /// encoded size exceeds the 2 GiB protobuf limit yields a value
    /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
    /// points reject, never a silently wrapped size.
    #[allow(clippy::let_and_return)]
    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u64;
        if self.operation != 0u32 {
            size += 1u64 + ::buffa::types::uint32_encoded_len(self.operation) as u64;
        }
        if self.request_id != 0u64 {
            size += 1u64 + ::buffa::types::uint64_encoded_len(self.request_id) as u64;
        }
        if self.generation != 0u64 {
            size += 1u64 + ::buffa::types::uint64_encoded_len(self.generation) as u64;
        }
        if !self.token.is_empty() {
            size += 1u64 + ::buffa::types::bytes_encoded_len(&self.token) as u64;
        }
        if let Some(v) = self.offset {
            size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64;
        }
        if !self.payload.is_empty() {
            size += 1u64 + ::buffa::types::bytes_encoded_len(&self.payload) as u64;
        }
        {
            let val = self.kind.to_i32();
            if val != 0 {
                size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
            }
        }
        size += self.__buffa_unknown_fields.encoded_len() as u64;
        ::buffa::saturate_size(size)
    }
    fn write_to(
        &self,
        _cache: &mut ::buffa::SizeCache,
        buf: &mut impl ::buffa::EncodeSink,
    ) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if self.operation != 0u32 {
            ::buffa::types::put_uint32_field(1u32, self.operation, buf);
        }
        if self.request_id != 0u64 {
            ::buffa::types::put_uint64_field(2u32, self.request_id, buf);
        }
        if self.generation != 0u64 {
            ::buffa::types::put_uint64_field(3u32, self.generation, buf);
        }
        if !self.token.is_empty() {
            ::buffa::types::put_shared_bytes_field(4u32, &self.token, buf);
        }
        if let Some(v) = self.offset {
            ::buffa::types::put_uint64_field(5u32, v, buf);
        }
        if !self.payload.is_empty() {
            ::buffa::types::put_shared_bytes_field(6u32, &self.payload, buf);
        }
        {
            let val = self.kind.to_i32();
            if val != 0 {
                ::buffa::types::put_int32_field(7u32, val, buf);
            }
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        ctx: ::buffa::DecodeContext<'_>,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.operation = ::buffa::types::decode_uint32(buf)?;
            }
            2u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.request_id = ::buffa::types::decode_uint64(buf)?;
            }
            3u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.generation = ::buffa::types::decode_uint64(buf)?;
            }
            4u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                ::buffa::types::merge_bytes(&mut self.token, buf)?;
            }
            5u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.offset = ::core::option::Option::Some(
                    ::buffa::types::decode_uint64(buf)?,
                );
            }
            6u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                ::buffa::types::merge_bytes(&mut self.payload, buf)?;
            }
            7u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn clear(&mut self) {
        self.operation = 0u32;
        self.request_id = 0u64;
        self.generation = 0u64;
        self.token.clear();
        self.offset = ::core::option::Option::None;
        self.payload.clear();
        self.kind = ::buffa::EnumValue::from(0);
        self.__buffa_unknown_fields.clear();
    }
}
impl ::buffa::ExtensionSet for Control {
    const PROTO_FQN: &'static str = "kunobi.daemon.v2.Control";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
/// Payload of HEALTH and DRAIN replies when HEALTH_DETAILS is negotiated.
/// This observation is made in memory, independently of application I/O.
#[derive(Clone, PartialEq, Default)]
pub struct Health {
    /// Field 1: `process_id`
    pub process_id: u32,
    /// Field 2: `generation`
    pub generation: u64,
    /// Field 3: `build`
    pub build: ::buffa::alloc::string::String,
    /// Application-defined monotonically comparable build revision, if used.
    ///
    /// Field 4: `revision`
    pub revision: u64,
    /// Field 5: `ready`
    pub ready: bool,
    /// Field 6: `draining`
    pub draining: bool,
    /// Field 7: `active`
    pub active: u64,
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Health {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Health")
            .field("process_id", &self.process_id)
            .field("generation", &self.generation)
            .field("build", &self.build)
            .field("revision", &self.revision)
            .field("ready", &self.ready)
            .field("draining", &self.draining)
            .field("active", &self.active)
            .finish()
    }
}
impl Health {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/kunobi.daemon.v2.Health";
}
::buffa::impl_default_instance!(Health);
impl ::buffa::MessageName for Health {
    const PACKAGE: &'static str = "kunobi.daemon.v2";
    const NAME: &'static str = "Health";
    const FULL_NAME: &'static str = "kunobi.daemon.v2.Health";
    const TYPE_URL: &'static str = "type.googleapis.com/kunobi.daemon.v2.Health";
}
impl ::buffa::Message for Health {
    /// Returns the total encoded size in bytes.
    ///
    /// Accumulates in `u64` (which cannot overflow for in-memory
    /// data) and saturates to `u32` at return, so a message whose
    /// encoded size exceeds the 2 GiB protobuf limit yields a value
    /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
    /// points reject, never a silently wrapped size.
    #[allow(clippy::let_and_return)]
    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u64;
        if self.process_id != 0u32 {
            size += 1u64 + ::buffa::types::uint32_encoded_len(self.process_id) as u64;
        }
        if self.generation != 0u64 {
            size += 1u64 + ::buffa::types::uint64_encoded_len(self.generation) as u64;
        }
        if !self.build.is_empty() {
            size += 1u64 + ::buffa::types::string_encoded_len(&self.build) as u64;
        }
        if self.revision != 0u64 {
            size += 1u64 + ::buffa::types::uint64_encoded_len(self.revision) as u64;
        }
        if self.ready {
            size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
        }
        if self.draining {
            size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
        }
        if self.active != 0u64 {
            size += 1u64 + ::buffa::types::uint64_encoded_len(self.active) as u64;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u64;
        ::buffa::saturate_size(size)
    }
    fn write_to(
        &self,
        _cache: &mut ::buffa::SizeCache,
        buf: &mut impl ::buffa::EncodeSink,
    ) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if self.process_id != 0u32 {
            ::buffa::types::put_uint32_field(1u32, self.process_id, buf);
        }
        if self.generation != 0u64 {
            ::buffa::types::put_uint64_field(2u32, self.generation, buf);
        }
        if !self.build.is_empty() {
            ::buffa::types::put_string_field(3u32, &self.build, buf);
        }
        if self.revision != 0u64 {
            ::buffa::types::put_uint64_field(4u32, self.revision, buf);
        }
        if self.ready {
            ::buffa::types::put_bool_field(5u32, self.ready, buf);
        }
        if self.draining {
            ::buffa::types::put_bool_field(6u32, self.draining, buf);
        }
        if self.active != 0u64 {
            ::buffa::types::put_uint64_field(7u32, self.active, buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        ctx: ::buffa::DecodeContext<'_>,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.process_id = ::buffa::types::decode_uint32(buf)?;
            }
            2u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.generation = ::buffa::types::decode_uint64(buf)?;
            }
            3u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                ::buffa::types::merge_string(&mut self.build, buf)?;
            }
            4u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.revision = ::buffa::types::decode_uint64(buf)?;
            }
            5u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.ready = ::buffa::types::decode_bool(buf)?;
            }
            6u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.draining = ::buffa::types::decode_bool(buf)?;
            }
            7u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                self.active = ::buffa::types::decode_uint64(buf)?;
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn clear(&mut self) {
        self.process_id = 0u32;
        self.generation = 0u64;
        self.build.clear();
        self.revision = 0u64;
        self.ready = false;
        self.draining = false;
        self.active = 0u64;
        self.__buffa_unknown_fields.clear();
    }
}
impl ::buffa::ExtensionSet for Health {
    const PROTO_FQN: &'static str = "kunobi.daemon.v2.Health";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}