Skip to main content

exoware_sdk/gen/
store.v1.stream.rs

1// @generated by protoc-gen-buffa. DO NOT EDIT.
2// source: store/v1/stream.proto
3
4/// Live (and optionally replayed) subscription request.
5#[derive(Clone, PartialEq, Default)]
6#[derive(::serde::Serialize, ::serde::Deserialize)]
7#[serde(default)]
8pub struct SubscribeRequest {
9    /// OR semantics across `match_keys`: a row is delivered if any match_key
10    /// matches. Bounded to keep server-side regex compilation cost predictable.
11    ///
12    /// Field 1: `match_keys`
13    #[serde(
14        rename = "matchKeys",
15        alias = "match_keys",
16        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
17        deserialize_with = "::buffa::json_helpers::null_as_default"
18    )]
19    pub match_keys: ::buffa::alloc::vec::Vec<super::super::common::v1::MatchKey>,
20    /// Optional value-side filter, AND'd with `match_keys`. OR semantics within
21    /// the list: once a row's key passes a `MatchKey`, it is delivered only if
22    /// its raw value bytes satisfy any one of `value_filters` (or the list is
23    /// empty).
24    ///
25    /// Field 2: `value_filters`
26    #[serde(
27        rename = "valueFilters",
28        alias = "value_filters",
29        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
30        deserialize_with = "::buffa::json_helpers::null_as_default"
31    )]
32    pub value_filters: ::buffa::alloc::vec::Vec<super::super::common::v1::BytesFilter>,
33    /// Optional replay cursor.
34    ///
35    /// Unset / 0 -\> subscription starts from the next live batch; no replay.
36    ///
37    /// Set to N -\> the server first replays every retained batch with
38    /// `sequence_number >= N` in ascending order, then transitions seamlessly
39    /// into the live stream. If `N` references a sequence number that has been
40    /// evicted from the batch log, the server returns OUT_OF_RANGE with an
41    /// `ErrorInfo { reason: "BATCH_EVICTED", metadata: { "oldest_retained": ... } }`
42    /// detail so callers can decide how to proceed.
43    ///
44    /// Field 3: `since_sequence_number`
45    #[serde(
46        rename = "sinceSequenceNumber",
47        alias = "since_sequence_number",
48        with = "::buffa::json_helpers::opt_uint64",
49        skip_serializing_if = "Option::is_none"
50    )]
51    pub since_sequence_number: Option<u64>,
52    #[serde(skip)]
53    #[doc(hidden)]
54    pub __buffa_unknown_fields: ::buffa::UnknownFields,
55    #[doc(hidden)]
56    #[serde(skip)]
57    pub __buffa_cached_size: ::buffa::__private::CachedSize,
58}
59impl ::core::fmt::Debug for SubscribeRequest {
60    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
61        f.debug_struct("SubscribeRequest")
62            .field("match_keys", &self.match_keys)
63            .field("value_filters", &self.value_filters)
64            .field("since_sequence_number", &self.since_sequence_number)
65            .finish()
66    }
67}
68impl SubscribeRequest {
69    /// Protobuf type URL for this message, for use with `Any::pack` and
70    /// `Any::unpack_if`.
71    ///
72    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
73    pub const TYPE_URL: &'static str = "type.googleapis.com/store.stream.v1.SubscribeRequest";
74}
75unsafe impl ::buffa::DefaultInstance for SubscribeRequest {
76    fn default_instance() -> &'static Self {
77        static VALUE: ::buffa::__private::OnceBox<SubscribeRequest> = ::buffa::__private::OnceBox::new();
78        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
79    }
80}
81impl ::buffa::Message for SubscribeRequest {
82    /// Returns the total encoded size in bytes.
83    ///
84    /// The result is a `u32`; the protobuf specification requires all
85    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
86    /// compliant message will never overflow this type.
87    fn compute_size(&self) -> u32 {
88        #[allow(unused_imports)]
89        use ::buffa::Enumeration as _;
90        let mut size = 0u32;
91        if let Some(v) = self.since_sequence_number {
92            size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
93        }
94        for v in &self.match_keys {
95            let inner_size = v.compute_size();
96            size
97                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
98                    + inner_size;
99        }
100        for v in &self.value_filters {
101            let inner_size = v.compute_size();
102            size
103                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
104                    + inner_size;
105        }
106        size += self.__buffa_unknown_fields.encoded_len() as u32;
107        self.__buffa_cached_size.set(size);
108        size
109    }
110    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
111        #[allow(unused_imports)]
112        use ::buffa::Enumeration as _;
113        if let Some(v) = self.since_sequence_number {
114            ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
115                .encode(buf);
116            ::buffa::types::encode_uint64(v, buf);
117        }
118        for v in &self.match_keys {
119            ::buffa::encoding::Tag::new(
120                    1u32,
121                    ::buffa::encoding::WireType::LengthDelimited,
122                )
123                .encode(buf);
124            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
125            v.write_to(buf);
126        }
127        for v in &self.value_filters {
128            ::buffa::encoding::Tag::new(
129                    2u32,
130                    ::buffa::encoding::WireType::LengthDelimited,
131                )
132                .encode(buf);
133            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
134            v.write_to(buf);
135        }
136        self.__buffa_unknown_fields.write_to(buf);
137    }
138    fn merge_field(
139        &mut self,
140        tag: ::buffa::encoding::Tag,
141        buf: &mut impl ::buffa::bytes::Buf,
142        depth: u32,
143    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
144        #[allow(unused_imports)]
145        use ::buffa::bytes::Buf as _;
146        #[allow(unused_imports)]
147        use ::buffa::Enumeration as _;
148        match tag.field_number() {
149            3u32 => {
150                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
151                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
152                        field_number: 3u32,
153                        expected: 0u8,
154                        actual: tag.wire_type() as u8,
155                    });
156                }
157                self.since_sequence_number = ::core::option::Option::Some(
158                    ::buffa::types::decode_uint64(buf)?,
159                );
160            }
161            1u32 => {
162                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
163                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
164                        field_number: 1u32,
165                        expected: 2u8,
166                        actual: tag.wire_type() as u8,
167                    });
168                }
169                let mut elem = ::core::default::Default::default();
170                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
171                self.match_keys.push(elem);
172            }
173            2u32 => {
174                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
175                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
176                        field_number: 2u32,
177                        expected: 2u8,
178                        actual: tag.wire_type() as u8,
179                    });
180                }
181                let mut elem = ::core::default::Default::default();
182                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
183                self.value_filters.push(elem);
184            }
185            _ => {
186                self.__buffa_unknown_fields
187                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
188            }
189        }
190        ::core::result::Result::Ok(())
191    }
192    fn cached_size(&self) -> u32 {
193        self.__buffa_cached_size.get()
194    }
195    fn clear(&mut self) {
196        self.since_sequence_number = ::core::option::Option::None;
197        self.match_keys.clear();
198        self.value_filters.clear();
199        self.__buffa_unknown_fields.clear();
200        self.__buffa_cached_size.set(0);
201    }
202}
203impl ::buffa::ExtensionSet for SubscribeRequest {
204    const PROTO_FQN: &'static str = "store.stream.v1.SubscribeRequest";
205    fn unknown_fields(&self) -> &::buffa::UnknownFields {
206        &self.__buffa_unknown_fields
207    }
208    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
209        &mut self.__buffa_unknown_fields
210    }
211}
212impl ::buffa::json_helpers::ProtoElemJson for SubscribeRequest {
213    fn serialize_proto_json<S: ::serde::Serializer>(
214        v: &Self,
215        s: S,
216    ) -> ::core::result::Result<S::Ok, S::Error> {
217        ::serde::Serialize::serialize(v, s)
218    }
219    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
220        d: D,
221    ) -> ::core::result::Result<Self, D::Error> {
222        <Self as ::serde::Deserialize>::deserialize(d)
223    }
224}
225#[doc(hidden)]
226pub const __SUBSCRIBE_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
227    type_url: "type.googleapis.com/store.stream.v1.SubscribeRequest",
228    to_json: ::buffa::type_registry::any_to_json::<SubscribeRequest>,
229    from_json: ::buffa::type_registry::any_from_json::<SubscribeRequest>,
230    is_wkt: false,
231};
232/// Live (and optionally replayed) subscription request.
233#[derive(Clone, Debug, Default)]
234pub struct SubscribeRequestView<'a> {
235    /// OR semantics across `match_keys`: a row is delivered if any match_key
236    /// matches. Bounded to keep server-side regex compilation cost predictable.
237    ///
238    /// Field 1: `match_keys`
239    pub match_keys: ::buffa::RepeatedView<
240        'a,
241        super::super::common::v1::MatchKeyView<'a>,
242    >,
243    /// Optional value-side filter, AND'd with `match_keys`. OR semantics within
244    /// the list: once a row's key passes a `MatchKey`, it is delivered only if
245    /// its raw value bytes satisfy any one of `value_filters` (or the list is
246    /// empty).
247    ///
248    /// Field 2: `value_filters`
249    pub value_filters: ::buffa::RepeatedView<
250        'a,
251        super::super::common::v1::BytesFilterView<'a>,
252    >,
253    /// Optional replay cursor.
254    ///
255    /// Unset / 0 -\> subscription starts from the next live batch; no replay.
256    ///
257    /// Set to N -\> the server first replays every retained batch with
258    /// `sequence_number >= N` in ascending order, then transitions seamlessly
259    /// into the live stream. If `N` references a sequence number that has been
260    /// evicted from the batch log, the server returns OUT_OF_RANGE with an
261    /// `ErrorInfo { reason: "BATCH_EVICTED", metadata: { "oldest_retained": ... } }`
262    /// detail so callers can decide how to proceed.
263    ///
264    /// Field 3: `since_sequence_number`
265    pub since_sequence_number: ::core::option::Option<u64>,
266    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
267}
268impl<'a> SubscribeRequestView<'a> {
269    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
270    ///
271    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
272    /// and by generated sub-message decode arms with `depth - 1`.
273    ///
274    /// **Not part of the public API.** Named with a leading underscore to
275    /// signal that it is for generated-code use only.
276    #[doc(hidden)]
277    pub fn _decode_depth(
278        buf: &'a [u8],
279        depth: u32,
280    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
281        let mut view = Self::default();
282        view._merge_into_view(buf, depth)?;
283        ::core::result::Result::Ok(view)
284    }
285    /// Merge fields from `buf` into this view (proto merge semantics).
286    ///
287    /// Repeated fields append; singular fields last-wins; singular
288    /// MESSAGE fields merge recursively. Used by sub-message decode
289    /// arms when the same field appears multiple times on the wire.
290    ///
291    /// **Not part of the public API.**
292    #[doc(hidden)]
293    pub fn _merge_into_view(
294        &mut self,
295        buf: &'a [u8],
296        depth: u32,
297    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
298        let _ = depth;
299        #[allow(unused_variables)]
300        let view = self;
301        let mut cur: &'a [u8] = buf;
302        while !cur.is_empty() {
303            let before_tag = cur;
304            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
305            match tag.field_number() {
306                3u32 => {
307                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
308                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
309                            field_number: 3u32,
310                            expected: 0u8,
311                            actual: tag.wire_type() as u8,
312                        });
313                    }
314                    view.since_sequence_number = Some(
315                        ::buffa::types::decode_uint64(&mut cur)?,
316                    );
317                }
318                1u32 => {
319                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
320                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
321                            field_number: 1u32,
322                            expected: 2u8,
323                            actual: tag.wire_type() as u8,
324                        });
325                    }
326                    if depth == 0 {
327                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
328                    }
329                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
330                    view.match_keys
331                        .push(
332                            super::super::common::v1::MatchKeyView::_decode_depth(
333                                sub,
334                                depth - 1,
335                            )?,
336                        );
337                }
338                2u32 => {
339                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
340                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
341                            field_number: 2u32,
342                            expected: 2u8,
343                            actual: tag.wire_type() as u8,
344                        });
345                    }
346                    if depth == 0 {
347                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
348                    }
349                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
350                    view.value_filters
351                        .push(
352                            super::super::common::v1::BytesFilterView::_decode_depth(
353                                sub,
354                                depth - 1,
355                            )?,
356                        );
357                }
358                _ => {
359                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
360                    let span_len = before_tag.len() - cur.len();
361                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
362                }
363            }
364        }
365        ::core::result::Result::Ok(())
366    }
367}
368impl<'a> ::buffa::MessageView<'a> for SubscribeRequestView<'a> {
369    type Owned = SubscribeRequest;
370    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
371        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
372    }
373    fn decode_view_with_limit(
374        buf: &'a [u8],
375        depth: u32,
376    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
377        Self::_decode_depth(buf, depth)
378    }
379    /// Convert this view to the owned message type.
380    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
381    fn to_owned_message(&self) -> SubscribeRequest {
382        #[allow(unused_imports)]
383        use ::buffa::alloc::string::ToString as _;
384        SubscribeRequest {
385            match_keys: self.match_keys.iter().map(|v| v.to_owned_message()).collect(),
386            value_filters: self
387                .value_filters
388                .iter()
389                .map(|v| v.to_owned_message())
390                .collect(),
391            since_sequence_number: self.since_sequence_number,
392            __buffa_unknown_fields: self
393                .__buffa_unknown_fields
394                .to_owned()
395                .unwrap_or_default()
396                .into(),
397            ..::core::default::Default::default()
398        }
399    }
400}
401unsafe impl ::buffa::DefaultViewInstance for SubscribeRequestView<'static> {
402    fn default_view_instance() -> &'static Self {
403        static VALUE: ::buffa::__private::OnceBox<SubscribeRequestView<'static>> = ::buffa::__private::OnceBox::new();
404        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
405    }
406}
407unsafe impl<'a> ::buffa::HasDefaultViewInstance for SubscribeRequestView<'a> {
408    type Static = SubscribeRequestView<'static>;
409}
410/// Point-lookup for one historical batch. Always returns the complete batch.
411#[derive(Clone, PartialEq, Default)]
412#[derive(::serde::Serialize, ::serde::Deserialize)]
413#[serde(default)]
414pub struct GetRequest {
415    /// Field 1: `sequence_number`
416    #[serde(
417        rename = "sequenceNumber",
418        alias = "sequence_number",
419        with = "::buffa::json_helpers::uint64",
420        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
421    )]
422    pub sequence_number: u64,
423    #[serde(skip)]
424    #[doc(hidden)]
425    pub __buffa_unknown_fields: ::buffa::UnknownFields,
426    #[doc(hidden)]
427    #[serde(skip)]
428    pub __buffa_cached_size: ::buffa::__private::CachedSize,
429}
430impl ::core::fmt::Debug for GetRequest {
431    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
432        f.debug_struct("GetRequest")
433            .field("sequence_number", &self.sequence_number)
434            .finish()
435    }
436}
437impl GetRequest {
438    /// Protobuf type URL for this message, for use with `Any::pack` and
439    /// `Any::unpack_if`.
440    ///
441    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
442    pub const TYPE_URL: &'static str = "type.googleapis.com/store.stream.v1.GetRequest";
443}
444unsafe impl ::buffa::DefaultInstance for GetRequest {
445    fn default_instance() -> &'static Self {
446        static VALUE: ::buffa::__private::OnceBox<GetRequest> = ::buffa::__private::OnceBox::new();
447        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
448    }
449}
450impl ::buffa::Message for GetRequest {
451    /// Returns the total encoded size in bytes.
452    ///
453    /// The result is a `u32`; the protobuf specification requires all
454    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
455    /// compliant message will never overflow this type.
456    fn compute_size(&self) -> u32 {
457        #[allow(unused_imports)]
458        use ::buffa::Enumeration as _;
459        let mut size = 0u32;
460        if self.sequence_number != 0u64 {
461            size
462                += 1u32
463                    + ::buffa::types::uint64_encoded_len(self.sequence_number) as u32;
464        }
465        size += self.__buffa_unknown_fields.encoded_len() as u32;
466        self.__buffa_cached_size.set(size);
467        size
468    }
469    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
470        #[allow(unused_imports)]
471        use ::buffa::Enumeration as _;
472        if self.sequence_number != 0u64 {
473            ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
474                .encode(buf);
475            ::buffa::types::encode_uint64(self.sequence_number, buf);
476        }
477        self.__buffa_unknown_fields.write_to(buf);
478    }
479    fn merge_field(
480        &mut self,
481        tag: ::buffa::encoding::Tag,
482        buf: &mut impl ::buffa::bytes::Buf,
483        depth: u32,
484    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
485        #[allow(unused_imports)]
486        use ::buffa::bytes::Buf as _;
487        #[allow(unused_imports)]
488        use ::buffa::Enumeration as _;
489        match tag.field_number() {
490            1u32 => {
491                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
492                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
493                        field_number: 1u32,
494                        expected: 0u8,
495                        actual: tag.wire_type() as u8,
496                    });
497                }
498                self.sequence_number = ::buffa::types::decode_uint64(buf)?;
499            }
500            _ => {
501                self.__buffa_unknown_fields
502                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
503            }
504        }
505        ::core::result::Result::Ok(())
506    }
507    fn cached_size(&self) -> u32 {
508        self.__buffa_cached_size.get()
509    }
510    fn clear(&mut self) {
511        self.sequence_number = 0u64;
512        self.__buffa_unknown_fields.clear();
513        self.__buffa_cached_size.set(0);
514    }
515}
516impl ::buffa::ExtensionSet for GetRequest {
517    const PROTO_FQN: &'static str = "store.stream.v1.GetRequest";
518    fn unknown_fields(&self) -> &::buffa::UnknownFields {
519        &self.__buffa_unknown_fields
520    }
521    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
522        &mut self.__buffa_unknown_fields
523    }
524}
525impl ::buffa::json_helpers::ProtoElemJson for GetRequest {
526    fn serialize_proto_json<S: ::serde::Serializer>(
527        v: &Self,
528        s: S,
529    ) -> ::core::result::Result<S::Ok, S::Error> {
530        ::serde::Serialize::serialize(v, s)
531    }
532    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
533        d: D,
534    ) -> ::core::result::Result<Self, D::Error> {
535        <Self as ::serde::Deserialize>::deserialize(d)
536    }
537}
538#[doc(hidden)]
539pub const __GET_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
540    type_url: "type.googleapis.com/store.stream.v1.GetRequest",
541    to_json: ::buffa::type_registry::any_to_json::<GetRequest>,
542    from_json: ::buffa::type_registry::any_from_json::<GetRequest>,
543    is_wkt: false,
544};
545/// Point-lookup for one historical batch. Always returns the complete batch.
546#[derive(Clone, Debug, Default)]
547pub struct GetRequestView<'a> {
548    /// Field 1: `sequence_number`
549    pub sequence_number: u64,
550    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
551}
552impl<'a> GetRequestView<'a> {
553    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
554    ///
555    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
556    /// and by generated sub-message decode arms with `depth - 1`.
557    ///
558    /// **Not part of the public API.** Named with a leading underscore to
559    /// signal that it is for generated-code use only.
560    #[doc(hidden)]
561    pub fn _decode_depth(
562        buf: &'a [u8],
563        depth: u32,
564    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
565        let mut view = Self::default();
566        view._merge_into_view(buf, depth)?;
567        ::core::result::Result::Ok(view)
568    }
569    /// Merge fields from `buf` into this view (proto merge semantics).
570    ///
571    /// Repeated fields append; singular fields last-wins; singular
572    /// MESSAGE fields merge recursively. Used by sub-message decode
573    /// arms when the same field appears multiple times on the wire.
574    ///
575    /// **Not part of the public API.**
576    #[doc(hidden)]
577    pub fn _merge_into_view(
578        &mut self,
579        buf: &'a [u8],
580        depth: u32,
581    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
582        let _ = depth;
583        #[allow(unused_variables)]
584        let view = self;
585        let mut cur: &'a [u8] = buf;
586        while !cur.is_empty() {
587            let before_tag = cur;
588            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
589            match tag.field_number() {
590                1u32 => {
591                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
592                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
593                            field_number: 1u32,
594                            expected: 0u8,
595                            actual: tag.wire_type() as u8,
596                        });
597                    }
598                    view.sequence_number = ::buffa::types::decode_uint64(&mut cur)?;
599                }
600                _ => {
601                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
602                    let span_len = before_tag.len() - cur.len();
603                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
604                }
605            }
606        }
607        ::core::result::Result::Ok(())
608    }
609}
610impl<'a> ::buffa::MessageView<'a> for GetRequestView<'a> {
611    type Owned = GetRequest;
612    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
613        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
614    }
615    fn decode_view_with_limit(
616        buf: &'a [u8],
617        depth: u32,
618    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
619        Self::_decode_depth(buf, depth)
620    }
621    /// Convert this view to the owned message type.
622    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
623    fn to_owned_message(&self) -> GetRequest {
624        #[allow(unused_imports)]
625        use ::buffa::alloc::string::ToString as _;
626        GetRequest {
627            sequence_number: self.sequence_number,
628            __buffa_unknown_fields: self
629                .__buffa_unknown_fields
630                .to_owned()
631                .unwrap_or_default()
632                .into(),
633            ..::core::default::Default::default()
634        }
635    }
636}
637unsafe impl ::buffa::DefaultViewInstance for GetRequestView<'static> {
638    fn default_view_instance() -> &'static Self {
639        static VALUE: ::buffa::__private::OnceBox<GetRequestView<'static>> = ::buffa::__private::OnceBox::new();
640        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
641    }
642}
643unsafe impl<'a> ::buffa::HasDefaultViewInstance for GetRequestView<'a> {
644    type Static = GetRequestView<'static>;
645}
646/// One item delivered on a `Subscribe` stream: all rows from a single atomic
647/// `Put` batch that matched the subscriber's filter. Live and replayed frames
648/// are indistinguishable by content; only the observed `sequence_number`
649/// (strictly monotonically increasing either way) differs.
650#[derive(Clone, PartialEq, Default)]
651#[derive(::serde::Serialize, ::serde::Deserialize)]
652#[serde(default)]
653pub struct SubscribeResponse {
654    /// Field 1: `sequence_number`
655    #[serde(
656        rename = "sequenceNumber",
657        alias = "sequence_number",
658        with = "::buffa::json_helpers::uint64",
659        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
660    )]
661    pub sequence_number: u64,
662    /// Field 2: `entries`
663    #[serde(
664        rename = "entries",
665        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
666        deserialize_with = "::buffa::json_helpers::null_as_default"
667    )]
668    pub entries: ::buffa::alloc::vec::Vec<super::super::common::v1::KvEntry>,
669    #[serde(skip)]
670    #[doc(hidden)]
671    pub __buffa_unknown_fields: ::buffa::UnknownFields,
672    #[doc(hidden)]
673    #[serde(skip)]
674    pub __buffa_cached_size: ::buffa::__private::CachedSize,
675}
676impl ::core::fmt::Debug for SubscribeResponse {
677    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
678        f.debug_struct("SubscribeResponse")
679            .field("sequence_number", &self.sequence_number)
680            .field("entries", &self.entries)
681            .finish()
682    }
683}
684impl SubscribeResponse {
685    /// Protobuf type URL for this message, for use with `Any::pack` and
686    /// `Any::unpack_if`.
687    ///
688    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
689    pub const TYPE_URL: &'static str = "type.googleapis.com/store.stream.v1.SubscribeResponse";
690}
691unsafe impl ::buffa::DefaultInstance for SubscribeResponse {
692    fn default_instance() -> &'static Self {
693        static VALUE: ::buffa::__private::OnceBox<SubscribeResponse> = ::buffa::__private::OnceBox::new();
694        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
695    }
696}
697impl ::buffa::Message for SubscribeResponse {
698    /// Returns the total encoded size in bytes.
699    ///
700    /// The result is a `u32`; the protobuf specification requires all
701    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
702    /// compliant message will never overflow this type.
703    fn compute_size(&self) -> u32 {
704        #[allow(unused_imports)]
705        use ::buffa::Enumeration as _;
706        let mut size = 0u32;
707        if self.sequence_number != 0u64 {
708            size
709                += 1u32
710                    + ::buffa::types::uint64_encoded_len(self.sequence_number) as u32;
711        }
712        for v in &self.entries {
713            let inner_size = v.compute_size();
714            size
715                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
716                    + inner_size;
717        }
718        size += self.__buffa_unknown_fields.encoded_len() as u32;
719        self.__buffa_cached_size.set(size);
720        size
721    }
722    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
723        #[allow(unused_imports)]
724        use ::buffa::Enumeration as _;
725        if self.sequence_number != 0u64 {
726            ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
727                .encode(buf);
728            ::buffa::types::encode_uint64(self.sequence_number, buf);
729        }
730        for v in &self.entries {
731            ::buffa::encoding::Tag::new(
732                    2u32,
733                    ::buffa::encoding::WireType::LengthDelimited,
734                )
735                .encode(buf);
736            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
737            v.write_to(buf);
738        }
739        self.__buffa_unknown_fields.write_to(buf);
740    }
741    fn merge_field(
742        &mut self,
743        tag: ::buffa::encoding::Tag,
744        buf: &mut impl ::buffa::bytes::Buf,
745        depth: u32,
746    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
747        #[allow(unused_imports)]
748        use ::buffa::bytes::Buf as _;
749        #[allow(unused_imports)]
750        use ::buffa::Enumeration as _;
751        match tag.field_number() {
752            1u32 => {
753                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
754                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
755                        field_number: 1u32,
756                        expected: 0u8,
757                        actual: tag.wire_type() as u8,
758                    });
759                }
760                self.sequence_number = ::buffa::types::decode_uint64(buf)?;
761            }
762            2u32 => {
763                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
764                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
765                        field_number: 2u32,
766                        expected: 2u8,
767                        actual: tag.wire_type() as u8,
768                    });
769                }
770                let mut elem = ::core::default::Default::default();
771                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
772                self.entries.push(elem);
773            }
774            _ => {
775                self.__buffa_unknown_fields
776                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
777            }
778        }
779        ::core::result::Result::Ok(())
780    }
781    fn cached_size(&self) -> u32 {
782        self.__buffa_cached_size.get()
783    }
784    fn clear(&mut self) {
785        self.sequence_number = 0u64;
786        self.entries.clear();
787        self.__buffa_unknown_fields.clear();
788        self.__buffa_cached_size.set(0);
789    }
790}
791impl ::buffa::ExtensionSet for SubscribeResponse {
792    const PROTO_FQN: &'static str = "store.stream.v1.SubscribeResponse";
793    fn unknown_fields(&self) -> &::buffa::UnknownFields {
794        &self.__buffa_unknown_fields
795    }
796    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
797        &mut self.__buffa_unknown_fields
798    }
799}
800impl ::buffa::json_helpers::ProtoElemJson for SubscribeResponse {
801    fn serialize_proto_json<S: ::serde::Serializer>(
802        v: &Self,
803        s: S,
804    ) -> ::core::result::Result<S::Ok, S::Error> {
805        ::serde::Serialize::serialize(v, s)
806    }
807    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
808        d: D,
809    ) -> ::core::result::Result<Self, D::Error> {
810        <Self as ::serde::Deserialize>::deserialize(d)
811    }
812}
813#[doc(hidden)]
814pub const __SUBSCRIBE_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
815    type_url: "type.googleapis.com/store.stream.v1.SubscribeResponse",
816    to_json: ::buffa::type_registry::any_to_json::<SubscribeResponse>,
817    from_json: ::buffa::type_registry::any_from_json::<SubscribeResponse>,
818    is_wkt: false,
819};
820/// One item delivered on a `Subscribe` stream: all rows from a single atomic
821/// `Put` batch that matched the subscriber's filter. Live and replayed frames
822/// are indistinguishable by content; only the observed `sequence_number`
823/// (strictly monotonically increasing either way) differs.
824#[derive(Clone, Debug, Default)]
825pub struct SubscribeResponseView<'a> {
826    /// Field 1: `sequence_number`
827    pub sequence_number: u64,
828    /// Field 2: `entries`
829    pub entries: ::buffa::RepeatedView<'a, super::super::common::v1::KvEntryView<'a>>,
830    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
831}
832impl<'a> SubscribeResponseView<'a> {
833    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
834    ///
835    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
836    /// and by generated sub-message decode arms with `depth - 1`.
837    ///
838    /// **Not part of the public API.** Named with a leading underscore to
839    /// signal that it is for generated-code use only.
840    #[doc(hidden)]
841    pub fn _decode_depth(
842        buf: &'a [u8],
843        depth: u32,
844    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
845        let mut view = Self::default();
846        view._merge_into_view(buf, depth)?;
847        ::core::result::Result::Ok(view)
848    }
849    /// Merge fields from `buf` into this view (proto merge semantics).
850    ///
851    /// Repeated fields append; singular fields last-wins; singular
852    /// MESSAGE fields merge recursively. Used by sub-message decode
853    /// arms when the same field appears multiple times on the wire.
854    ///
855    /// **Not part of the public API.**
856    #[doc(hidden)]
857    pub fn _merge_into_view(
858        &mut self,
859        buf: &'a [u8],
860        depth: u32,
861    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
862        let _ = depth;
863        #[allow(unused_variables)]
864        let view = self;
865        let mut cur: &'a [u8] = buf;
866        while !cur.is_empty() {
867            let before_tag = cur;
868            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
869            match tag.field_number() {
870                1u32 => {
871                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
872                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
873                            field_number: 1u32,
874                            expected: 0u8,
875                            actual: tag.wire_type() as u8,
876                        });
877                    }
878                    view.sequence_number = ::buffa::types::decode_uint64(&mut cur)?;
879                }
880                2u32 => {
881                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
882                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
883                            field_number: 2u32,
884                            expected: 2u8,
885                            actual: tag.wire_type() as u8,
886                        });
887                    }
888                    if depth == 0 {
889                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
890                    }
891                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
892                    view.entries
893                        .push(
894                            super::super::common::v1::KvEntryView::_decode_depth(
895                                sub,
896                                depth - 1,
897                            )?,
898                        );
899                }
900                _ => {
901                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
902                    let span_len = before_tag.len() - cur.len();
903                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
904                }
905            }
906        }
907        ::core::result::Result::Ok(())
908    }
909}
910impl<'a> ::buffa::MessageView<'a> for SubscribeResponseView<'a> {
911    type Owned = SubscribeResponse;
912    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
913        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
914    }
915    fn decode_view_with_limit(
916        buf: &'a [u8],
917        depth: u32,
918    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
919        Self::_decode_depth(buf, depth)
920    }
921    /// Convert this view to the owned message type.
922    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
923    fn to_owned_message(&self) -> SubscribeResponse {
924        #[allow(unused_imports)]
925        use ::buffa::alloc::string::ToString as _;
926        SubscribeResponse {
927            sequence_number: self.sequence_number,
928            entries: self.entries.iter().map(|v| v.to_owned_message()).collect(),
929            __buffa_unknown_fields: self
930                .__buffa_unknown_fields
931                .to_owned()
932                .unwrap_or_default()
933                .into(),
934            ..::core::default::Default::default()
935        }
936    }
937}
938unsafe impl ::buffa::DefaultViewInstance for SubscribeResponseView<'static> {
939    fn default_view_instance() -> &'static Self {
940        static VALUE: ::buffa::__private::OnceBox<SubscribeResponseView<'static>> = ::buffa::__private::OnceBox::new();
941        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
942    }
943}
944unsafe impl<'a> ::buffa::HasDefaultViewInstance for SubscribeResponseView<'a> {
945    type Static = SubscribeResponseView<'static>;
946}
947/// Response for `Get`: the full contents of the batch at the requested
948/// sequence number, with no server-side filter applied.
949#[derive(Clone, PartialEq, Default)]
950#[derive(::serde::Serialize, ::serde::Deserialize)]
951#[serde(default)]
952pub struct GetResponse {
953    /// Field 1: `sequence_number`
954    #[serde(
955        rename = "sequenceNumber",
956        alias = "sequence_number",
957        with = "::buffa::json_helpers::uint64",
958        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
959    )]
960    pub sequence_number: u64,
961    /// Field 2: `entries`
962    #[serde(
963        rename = "entries",
964        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
965        deserialize_with = "::buffa::json_helpers::null_as_default"
966    )]
967    pub entries: ::buffa::alloc::vec::Vec<super::super::common::v1::KvEntry>,
968    #[serde(skip)]
969    #[doc(hidden)]
970    pub __buffa_unknown_fields: ::buffa::UnknownFields,
971    #[doc(hidden)]
972    #[serde(skip)]
973    pub __buffa_cached_size: ::buffa::__private::CachedSize,
974}
975impl ::core::fmt::Debug for GetResponse {
976    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
977        f.debug_struct("GetResponse")
978            .field("sequence_number", &self.sequence_number)
979            .field("entries", &self.entries)
980            .finish()
981    }
982}
983impl GetResponse {
984    /// Protobuf type URL for this message, for use with `Any::pack` and
985    /// `Any::unpack_if`.
986    ///
987    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
988    pub const TYPE_URL: &'static str = "type.googleapis.com/store.stream.v1.GetResponse";
989}
990unsafe impl ::buffa::DefaultInstance for GetResponse {
991    fn default_instance() -> &'static Self {
992        static VALUE: ::buffa::__private::OnceBox<GetResponse> = ::buffa::__private::OnceBox::new();
993        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
994    }
995}
996impl ::buffa::Message for GetResponse {
997    /// Returns the total encoded size in bytes.
998    ///
999    /// The result is a `u32`; the protobuf specification requires all
1000    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1001    /// compliant message will never overflow this type.
1002    fn compute_size(&self) -> u32 {
1003        #[allow(unused_imports)]
1004        use ::buffa::Enumeration as _;
1005        let mut size = 0u32;
1006        if self.sequence_number != 0u64 {
1007            size
1008                += 1u32
1009                    + ::buffa::types::uint64_encoded_len(self.sequence_number) as u32;
1010        }
1011        for v in &self.entries {
1012            let inner_size = v.compute_size();
1013            size
1014                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1015                    + inner_size;
1016        }
1017        size += self.__buffa_unknown_fields.encoded_len() as u32;
1018        self.__buffa_cached_size.set(size);
1019        size
1020    }
1021    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
1022        #[allow(unused_imports)]
1023        use ::buffa::Enumeration as _;
1024        if self.sequence_number != 0u64 {
1025            ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
1026                .encode(buf);
1027            ::buffa::types::encode_uint64(self.sequence_number, buf);
1028        }
1029        for v in &self.entries {
1030            ::buffa::encoding::Tag::new(
1031                    2u32,
1032                    ::buffa::encoding::WireType::LengthDelimited,
1033                )
1034                .encode(buf);
1035            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
1036            v.write_to(buf);
1037        }
1038        self.__buffa_unknown_fields.write_to(buf);
1039    }
1040    fn merge_field(
1041        &mut self,
1042        tag: ::buffa::encoding::Tag,
1043        buf: &mut impl ::buffa::bytes::Buf,
1044        depth: u32,
1045    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1046        #[allow(unused_imports)]
1047        use ::buffa::bytes::Buf as _;
1048        #[allow(unused_imports)]
1049        use ::buffa::Enumeration as _;
1050        match tag.field_number() {
1051            1u32 => {
1052                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1053                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1054                        field_number: 1u32,
1055                        expected: 0u8,
1056                        actual: tag.wire_type() as u8,
1057                    });
1058                }
1059                self.sequence_number = ::buffa::types::decode_uint64(buf)?;
1060            }
1061            2u32 => {
1062                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1063                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1064                        field_number: 2u32,
1065                        expected: 2u8,
1066                        actual: tag.wire_type() as u8,
1067                    });
1068                }
1069                let mut elem = ::core::default::Default::default();
1070                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1071                self.entries.push(elem);
1072            }
1073            _ => {
1074                self.__buffa_unknown_fields
1075                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1076            }
1077        }
1078        ::core::result::Result::Ok(())
1079    }
1080    fn cached_size(&self) -> u32 {
1081        self.__buffa_cached_size.get()
1082    }
1083    fn clear(&mut self) {
1084        self.sequence_number = 0u64;
1085        self.entries.clear();
1086        self.__buffa_unknown_fields.clear();
1087        self.__buffa_cached_size.set(0);
1088    }
1089}
1090impl ::buffa::ExtensionSet for GetResponse {
1091    const PROTO_FQN: &'static str = "store.stream.v1.GetResponse";
1092    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1093        &self.__buffa_unknown_fields
1094    }
1095    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1096        &mut self.__buffa_unknown_fields
1097    }
1098}
1099impl ::buffa::json_helpers::ProtoElemJson for GetResponse {
1100    fn serialize_proto_json<S: ::serde::Serializer>(
1101        v: &Self,
1102        s: S,
1103    ) -> ::core::result::Result<S::Ok, S::Error> {
1104        ::serde::Serialize::serialize(v, s)
1105    }
1106    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1107        d: D,
1108    ) -> ::core::result::Result<Self, D::Error> {
1109        <Self as ::serde::Deserialize>::deserialize(d)
1110    }
1111}
1112#[doc(hidden)]
1113pub const __GET_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1114    type_url: "type.googleapis.com/store.stream.v1.GetResponse",
1115    to_json: ::buffa::type_registry::any_to_json::<GetResponse>,
1116    from_json: ::buffa::type_registry::any_from_json::<GetResponse>,
1117    is_wkt: false,
1118};
1119/// Response for `Get`: the full contents of the batch at the requested
1120/// sequence number, with no server-side filter applied.
1121#[derive(Clone, Debug, Default)]
1122pub struct GetResponseView<'a> {
1123    /// Field 1: `sequence_number`
1124    pub sequence_number: u64,
1125    /// Field 2: `entries`
1126    pub entries: ::buffa::RepeatedView<'a, super::super::common::v1::KvEntryView<'a>>,
1127    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1128}
1129impl<'a> GetResponseView<'a> {
1130    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
1131    ///
1132    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
1133    /// and by generated sub-message decode arms with `depth - 1`.
1134    ///
1135    /// **Not part of the public API.** Named with a leading underscore to
1136    /// signal that it is for generated-code use only.
1137    #[doc(hidden)]
1138    pub fn _decode_depth(
1139        buf: &'a [u8],
1140        depth: u32,
1141    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1142        let mut view = Self::default();
1143        view._merge_into_view(buf, depth)?;
1144        ::core::result::Result::Ok(view)
1145    }
1146    /// Merge fields from `buf` into this view (proto merge semantics).
1147    ///
1148    /// Repeated fields append; singular fields last-wins; singular
1149    /// MESSAGE fields merge recursively. Used by sub-message decode
1150    /// arms when the same field appears multiple times on the wire.
1151    ///
1152    /// **Not part of the public API.**
1153    #[doc(hidden)]
1154    pub fn _merge_into_view(
1155        &mut self,
1156        buf: &'a [u8],
1157        depth: u32,
1158    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1159        let _ = depth;
1160        #[allow(unused_variables)]
1161        let view = self;
1162        let mut cur: &'a [u8] = buf;
1163        while !cur.is_empty() {
1164            let before_tag = cur;
1165            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1166            match tag.field_number() {
1167                1u32 => {
1168                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1169                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1170                            field_number: 1u32,
1171                            expected: 0u8,
1172                            actual: tag.wire_type() as u8,
1173                        });
1174                    }
1175                    view.sequence_number = ::buffa::types::decode_uint64(&mut cur)?;
1176                }
1177                2u32 => {
1178                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1179                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1180                            field_number: 2u32,
1181                            expected: 2u8,
1182                            actual: tag.wire_type() as u8,
1183                        });
1184                    }
1185                    if depth == 0 {
1186                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
1187                    }
1188                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1189                    view.entries
1190                        .push(
1191                            super::super::common::v1::KvEntryView::_decode_depth(
1192                                sub,
1193                                depth - 1,
1194                            )?,
1195                        );
1196                }
1197                _ => {
1198                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1199                    let span_len = before_tag.len() - cur.len();
1200                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1201                }
1202            }
1203        }
1204        ::core::result::Result::Ok(())
1205    }
1206}
1207impl<'a> ::buffa::MessageView<'a> for GetResponseView<'a> {
1208    type Owned = GetResponse;
1209    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1210        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1211    }
1212    fn decode_view_with_limit(
1213        buf: &'a [u8],
1214        depth: u32,
1215    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1216        Self::_decode_depth(buf, depth)
1217    }
1218    /// Convert this view to the owned message type.
1219    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
1220    fn to_owned_message(&self) -> GetResponse {
1221        #[allow(unused_imports)]
1222        use ::buffa::alloc::string::ToString as _;
1223        GetResponse {
1224            sequence_number: self.sequence_number,
1225            entries: self.entries.iter().map(|v| v.to_owned_message()).collect(),
1226            __buffa_unknown_fields: self
1227                .__buffa_unknown_fields
1228                .to_owned()
1229                .unwrap_or_default()
1230                .into(),
1231            ..::core::default::Default::default()
1232        }
1233    }
1234}
1235unsafe impl ::buffa::DefaultViewInstance for GetResponseView<'static> {
1236    fn default_view_instance() -> &'static Self {
1237        static VALUE: ::buffa::__private::OnceBox<GetResponseView<'static>> = ::buffa::__private::OnceBox::new();
1238        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1239    }
1240}
1241unsafe impl<'a> ::buffa::HasDefaultViewInstance for GetResponseView<'a> {
1242    type Static = GetResponseView<'static>;
1243}
1244
1245/// Full service name for this service.
1246pub const SERVICE_SERVICE_NAME: &str = "store.stream.v1.Service";
1247/// Push-based subscription + point-lookup over the store's batch log.
1248/// `Subscribe` delivers a `SubscribeResponse` per atomic `Put` batch whose
1249/// entries match any of the subscriber's `match_keys`. Optional
1250/// `since_sequence_number` replays retained batches before transitioning live.
1251/// `Get` returns the complete batch at a given sequence number (no filter
1252/// applied server-side). `SubscribeResponse` and `GetResponse` carry the
1253/// same shape so callers can share decoders.
1254///
1255/// # Implementing handlers
1256///
1257/// Handlers receive requests as `OwnedView<FooView<'static>>`, which gives
1258/// zero-copy borrowed access to fields (e.g. `request.name` is a `&str`
1259/// into the decoded buffer). The view can be held across `.await` points.
1260///
1261/// Implement methods with plain `async fn`; the returned future satisfies
1262/// the `Send` bound automatically. See the
1263/// [buffa user guide](https://github.com/anthropics/buffa/blob/main/docs/guide.md#ownedview-in-async-trait-implementations)
1264/// for zero-copy access patterns and when `to_owned_message()` is needed.
1265#[allow(clippy::type_complexity)]
1266pub trait Service: Send + Sync + 'static {
1267    /// Handle the Subscribe RPC.
1268    fn subscribe(
1269        &self,
1270        ctx: ::connectrpc::Context,
1271        request: ::buffa::view::OwnedView<SubscribeRequestView<'static>>,
1272    ) -> impl ::std::future::Future<
1273        Output = Result<
1274            (
1275                ::std::pin::Pin<
1276                    Box<
1277                        dyn ::futures::Stream<
1278                            Item = Result<SubscribeResponse, ::connectrpc::ConnectError>,
1279                        > + Send,
1280                    >,
1281                >,
1282                ::connectrpc::Context,
1283            ),
1284            ::connectrpc::ConnectError,
1285        >,
1286    > + Send;
1287    /// Handle the Get RPC.
1288    fn get(
1289        &self,
1290        ctx: ::connectrpc::Context,
1291        request: ::buffa::view::OwnedView<GetRequestView<'static>>,
1292    ) -> impl ::std::future::Future<
1293        Output = Result<(GetResponse, ::connectrpc::Context), ::connectrpc::ConnectError>,
1294    > + Send;
1295}
1296/// Extension trait for registering a service implementation with a Router.
1297///
1298/// This trait is automatically implemented for all types that implement the service trait.
1299///
1300/// # Example
1301///
1302/// ```rust,ignore
1303/// use std::sync::Arc;
1304///
1305/// let service = Arc::new(MyServiceImpl);
1306/// let router = service.register(Router::new());
1307/// ```
1308pub trait ServiceExt: Service {
1309    /// Register this service implementation with a Router.
1310    ///
1311    /// Takes ownership of the `Arc<Self>` and returns a new Router with
1312    /// this service's methods registered.
1313    fn register(
1314        self: ::std::sync::Arc<Self>,
1315        router: ::connectrpc::Router,
1316    ) -> ::connectrpc::Router;
1317}
1318impl<S: Service> ServiceExt for S {
1319    fn register(
1320        self: ::std::sync::Arc<Self>,
1321        router: ::connectrpc::Router,
1322    ) -> ::connectrpc::Router {
1323        router
1324            .route_view_server_stream(
1325                SERVICE_SERVICE_NAME,
1326                "Subscribe",
1327                ::connectrpc::view_streaming_handler_fn({
1328                    let svc = ::std::sync::Arc::clone(&self);
1329                    move |ctx, req| {
1330                        let svc = ::std::sync::Arc::clone(&svc);
1331                        async move { svc.subscribe(ctx, req).await }
1332                    }
1333                }),
1334            )
1335            .route_view(
1336                SERVICE_SERVICE_NAME,
1337                "Get",
1338                {
1339                    let svc = ::std::sync::Arc::clone(&self);
1340                    ::connectrpc::view_handler_fn(move |ctx, req| {
1341                        let svc = ::std::sync::Arc::clone(&svc);
1342                        async move { svc.get(ctx, req).await }
1343                    })
1344                },
1345            )
1346    }
1347}
1348/// Monomorphic dispatcher for `Service`.
1349///
1350/// Unlike `.register(Router)` which type-erases each method into an `Arc<dyn ErasedHandler>` stored in a `HashMap`, this struct dispatches via a compile-time `match` on method name: no vtable, no hash lookup.
1351///
1352/// # Example
1353///
1354/// ```rust,ignore
1355/// use connectrpc::ConnectRpcService;
1356///
1357/// let server = ServiceServer::new(MyImpl);
1358/// let service = ConnectRpcService::new(server);
1359/// // hand `service` to axum/hyper as a fallback_service
1360/// ```
1361pub struct ServiceServer<T> {
1362    inner: ::std::sync::Arc<T>,
1363}
1364impl<T: Service> ServiceServer<T> {
1365    /// Wrap a service implementation in a monomorphic dispatcher.
1366    pub fn new(service: T) -> Self {
1367        Self {
1368            inner: ::std::sync::Arc::new(service),
1369        }
1370    }
1371    /// Wrap an already-`Arc`'d service implementation.
1372    pub fn from_arc(inner: ::std::sync::Arc<T>) -> Self {
1373        Self { inner }
1374    }
1375}
1376impl<T> Clone for ServiceServer<T> {
1377    fn clone(&self) -> Self {
1378        Self {
1379            inner: ::std::sync::Arc::clone(&self.inner),
1380        }
1381    }
1382}
1383impl<T: Service> ::connectrpc::Dispatcher for ServiceServer<T> {
1384    #[inline]
1385    fn lookup(
1386        &self,
1387        path: &str,
1388    ) -> Option<::connectrpc::dispatcher::codegen::MethodDescriptor> {
1389        let method = path.strip_prefix("store.stream.v1.Service/")?;
1390        match method {
1391            "Subscribe" => {
1392                Some(
1393                    ::connectrpc::dispatcher::codegen::MethodDescriptor::server_streaming(),
1394                )
1395            }
1396            "Get" => {
1397                Some(::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false))
1398            }
1399            _ => None,
1400        }
1401    }
1402    fn call_unary(
1403        &self,
1404        path: &str,
1405        ctx: ::connectrpc::Context,
1406        request: ::buffa::bytes::Bytes,
1407        format: ::connectrpc::CodecFormat,
1408    ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
1409        let Some(method) = path.strip_prefix("store.stream.v1.Service/") else {
1410            return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
1411        };
1412        let _ = (&ctx, &request, &format);
1413        match method {
1414            "Get" => {
1415                let svc = ::std::sync::Arc::clone(&self.inner);
1416                Box::pin(async move {
1417                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
1418                        GetRequestView,
1419                    >(request, format)?;
1420                    let (res, ctx) = svc.get(ctx, req).await?;
1421                    let bytes = ::connectrpc::dispatcher::codegen::encode_response(
1422                        &res,
1423                        format,
1424                    )?;
1425                    Ok((bytes, ctx))
1426                })
1427            }
1428            _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
1429        }
1430    }
1431    fn call_server_streaming(
1432        &self,
1433        path: &str,
1434        ctx: ::connectrpc::Context,
1435        request: ::buffa::bytes::Bytes,
1436        format: ::connectrpc::CodecFormat,
1437    ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
1438        let Some(method) = path.strip_prefix("store.stream.v1.Service/") else {
1439            return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
1440        };
1441        let _ = (&ctx, &request, &format);
1442        match method {
1443            "Subscribe" => {
1444                let svc = ::std::sync::Arc::clone(&self.inner);
1445                Box::pin(async move {
1446                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
1447                        SubscribeRequestView,
1448                    >(request, format)?;
1449                    let (resp_stream, ctx) = svc.subscribe(ctx, req).await?;
1450                    Ok((
1451                        ::connectrpc::dispatcher::codegen::encode_response_stream(
1452                            resp_stream,
1453                            format,
1454                        ),
1455                        ctx,
1456                    ))
1457                })
1458            }
1459            _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
1460        }
1461    }
1462    fn call_client_streaming(
1463        &self,
1464        path: &str,
1465        ctx: ::connectrpc::Context,
1466        requests: ::connectrpc::dispatcher::codegen::RequestStream,
1467        format: ::connectrpc::CodecFormat,
1468    ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
1469        let Some(method) = path.strip_prefix("store.stream.v1.Service/") else {
1470            return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
1471        };
1472        let _ = (&ctx, &requests, &format);
1473        match method {
1474            _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
1475        }
1476    }
1477    fn call_bidi_streaming(
1478        &self,
1479        path: &str,
1480        ctx: ::connectrpc::Context,
1481        requests: ::connectrpc::dispatcher::codegen::RequestStream,
1482        format: ::connectrpc::CodecFormat,
1483    ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
1484        let Some(method) = path.strip_prefix("store.stream.v1.Service/") else {
1485            return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
1486        };
1487        let _ = (&ctx, &requests, &format);
1488        match method {
1489            _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
1490        }
1491    }
1492}
1493/// Client for this service.
1494///
1495/// Generic over `T: ClientTransport`. For **gRPC** (HTTP/2), use
1496/// `Http2Connection` — it has honest `poll_ready` and composes with
1497/// `tower::balance` for multi-connection load balancing. For **Connect
1498/// over HTTP/1.1** (or unknown protocol), use `HttpClient`.
1499///
1500/// # Example (gRPC / HTTP/2)
1501///
1502/// ```rust,ignore
1503/// use connectrpc::client::{Http2Connection, ClientConfig};
1504/// use connectrpc::Protocol;
1505///
1506/// let uri: http::Uri = "http://localhost:8080".parse()?;
1507/// let conn = Http2Connection::connect_plaintext(uri.clone()).await?.shared(1024);
1508/// let config = ClientConfig::new(uri).protocol(Protocol::Grpc);
1509///
1510/// let client = ServiceClient::new(conn, config);
1511/// let response = client.subscribe(request).await?;
1512/// ```
1513///
1514/// # Example (Connect / HTTP/1.1 or ALPN)
1515///
1516/// ```rust,ignore
1517/// use connectrpc::client::{HttpClient, ClientConfig};
1518///
1519/// let http = HttpClient::plaintext();  // cleartext http:// only
1520/// let config = ClientConfig::new("http://localhost:8080".parse()?);
1521///
1522/// let client = ServiceClient::new(http, config);
1523/// let response = client.subscribe(request).await?;
1524/// ```
1525///
1526/// # Working with the response
1527///
1528/// Unary calls return [`UnaryResponse<OwnedView<FooView>>`](::connectrpc::client::UnaryResponse).
1529/// The `OwnedView` derefs to the view, so field access is zero-copy:
1530///
1531/// ```rust,ignore
1532/// let resp = client.subscribe(request).await?.into_view();
1533/// let name: &str = resp.name;  // borrow into the response buffer
1534/// ```
1535///
1536/// If you need the owned struct (e.g. to store or pass by value), use
1537/// [`into_owned()`](::connectrpc::client::UnaryResponse::into_owned):
1538///
1539/// ```rust,ignore
1540/// let owned = client.subscribe(request).await?.into_owned();
1541/// ```
1542#[derive(Clone)]
1543pub struct ServiceClient<T> {
1544    transport: T,
1545    config: ::connectrpc::client::ClientConfig,
1546}
1547impl<T> ServiceClient<T>
1548where
1549    T: ::connectrpc::client::ClientTransport,
1550    <T::ResponseBody as ::http_body::Body>::Error: ::std::fmt::Display,
1551{
1552    /// Create a new client with the given transport and configuration.
1553    pub fn new(transport: T, config: ::connectrpc::client::ClientConfig) -> Self {
1554        Self { transport, config }
1555    }
1556    /// Get the client configuration.
1557    pub fn config(&self) -> &::connectrpc::client::ClientConfig {
1558        &self.config
1559    }
1560    /// Get a mutable reference to the client configuration.
1561    pub fn config_mut(&mut self) -> &mut ::connectrpc::client::ClientConfig {
1562        &mut self.config
1563    }
1564    /// Call the Subscribe RPC. Sends a request to /store.stream.v1.Service/Subscribe.
1565    pub async fn subscribe(
1566        &self,
1567        request: SubscribeRequest,
1568    ) -> Result<
1569        ::connectrpc::client::ServerStream<
1570            T::ResponseBody,
1571            SubscribeResponseView<'static>,
1572        >,
1573        ::connectrpc::ConnectError,
1574    > {
1575        self.subscribe_with_options(
1576                request,
1577                ::connectrpc::client::CallOptions::default(),
1578            )
1579            .await
1580    }
1581    /// Call the Subscribe RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
1582    pub async fn subscribe_with_options(
1583        &self,
1584        request: SubscribeRequest,
1585        options: ::connectrpc::client::CallOptions,
1586    ) -> Result<
1587        ::connectrpc::client::ServerStream<
1588            T::ResponseBody,
1589            SubscribeResponseView<'static>,
1590        >,
1591        ::connectrpc::ConnectError,
1592    > {
1593        ::connectrpc::client::call_server_stream(
1594                &self.transport,
1595                &self.config,
1596                SERVICE_SERVICE_NAME,
1597                "Subscribe",
1598                request,
1599                options,
1600            )
1601            .await
1602    }
1603    /// Call the Get RPC. Sends a request to /store.stream.v1.Service/Get.
1604    pub async fn get(
1605        &self,
1606        request: GetRequest,
1607    ) -> Result<
1608        ::connectrpc::client::UnaryResponse<
1609            ::buffa::view::OwnedView<GetResponseView<'static>>,
1610        >,
1611        ::connectrpc::ConnectError,
1612    > {
1613        self.get_with_options(request, ::connectrpc::client::CallOptions::default())
1614            .await
1615    }
1616    /// Call the Get RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
1617    pub async fn get_with_options(
1618        &self,
1619        request: GetRequest,
1620        options: ::connectrpc::client::CallOptions,
1621    ) -> Result<
1622        ::connectrpc::client::UnaryResponse<
1623            ::buffa::view::OwnedView<GetResponseView<'static>>,
1624        >,
1625        ::connectrpc::ConnectError,
1626    > {
1627        ::connectrpc::client::call_unary(
1628                &self.transport,
1629                &self.config,
1630                SERVICE_SERVICE_NAME,
1631                "Get",
1632                request,
1633                options,
1634            )
1635            .await
1636    }
1637}