Skip to main content

krabka_protocol/opt/rustwide/workdir/generated/
RemoteLogSegmentMetadataRecord.owned.rs

1// AUTO-GENERATED by krabka-protocol-codegen against a9ce3221537b8653448750697915607dc7936cf3. Do not edit.
2
3use bytes::{Buf, BufMut};
4
5use crate::{
6    Decode, Encode, ProtocolError, UnknownTaggedFields,
7    primitives::{
8        fixed::{get_bool, get_i8, get_i32, get_i64, put_bool, put_i8, put_i32, put_i64},
9        string_bytes::{
10            compact_nullable_bytes_len, compact_string_len, get_compact_nullable_bytes_owned,
11            get_compact_string_owned, get_nullable_bytes_owned, get_string_owned,
12            nullable_bytes_len, put_compact_nullable_bytes, put_compact_string, put_nullable_bytes,
13            put_string, string_len,
14        },
15    },
16    tagged_fields::{WriteTaggedFields, encode_to_bytes, read_tagged_fields, tagged_fields_len},
17};
18pub const MIN_VERSION: i16 = 0;
19pub const MAX_VERSION: i16 = 0;
20pub const FLEXIBLE_MIN: i16 = 0;
21#[inline]
22#[must_use]
23pub fn is_flexible(version: i16) -> bool {
24    version >= FLEXIBLE_MIN
25}
26#[derive(Debug, Clone, PartialEq, Eq, Default)]
27pub struct RemoteLogSegmentMetadataRecord {
28    pub remote_log_segment_id: RemoteLogSegmentIdEntry,
29    pub start_offset: i64,
30    pub end_offset: i64,
31    pub broker_id: i32,
32    pub max_timestamp_ms: i64,
33    pub event_timestamp_ms: i64,
34    pub segment_leader_epochs: Vec<SegmentLeaderEpochEntry>,
35    pub segment_size_in_bytes: i32,
36    pub custom_metadata: Option<::bytes::Bytes>,
37    pub remote_log_segment_state: i8,
38    pub txn_index_empty: bool,
39    pub unknown_tagged_fields: UnknownTaggedFields,
40}
41impl RemoteLogSegmentMetadataRecord {
42    fn encode_field_0<B: BufMut>(
43        &self,
44        buf: &mut B,
45        version: i16,
46        _flex: bool,
47    ) -> Result<(), ProtocolError> {
48        if version >= 0 {
49            self.remote_log_segment_id.encode(buf, version)?;
50        }
51        Ok(())
52    }
53    fn encode_field_1<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
54        if version >= 0 {
55            put_i64(buf, self.start_offset);
56        }
57    }
58    fn encode_field_2<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
59        if version >= 0 {
60            put_i64(buf, self.end_offset);
61        }
62    }
63    fn encode_field_3<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
64        if version >= 0 {
65            put_i32(buf, self.broker_id);
66        }
67    }
68    fn encode_field_4<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
69        if version >= 0 {
70            put_i64(buf, self.max_timestamp_ms);
71        }
72    }
73    fn encode_field_5<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
74        if version >= 0 {
75            put_i64(buf, self.event_timestamp_ms);
76        }
77    }
78    fn encode_field_6<B: BufMut>(
79        &self,
80        buf: &mut B,
81        version: i16,
82        flex: bool,
83    ) -> Result<(), ProtocolError> {
84        if version >= 0 {
85            {
86                crate::primitives::array::put_array_len(
87                    buf,
88                    (self.segment_leader_epochs).len(),
89                    flex,
90                );
91                for it in &self.segment_leader_epochs {
92                    it.encode(buf, version)?;
93                }
94            };
95        }
96        Ok(())
97    }
98    fn encode_field_7<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
99        if version >= 0 {
100            put_i32(buf, self.segment_size_in_bytes);
101        }
102    }
103    fn encode_field_8<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
104        if version >= 0 {
105            if flex {
106                let () = put_compact_nullable_bytes(buf, self.custom_metadata.as_deref());
107            } else {
108                let () = put_nullable_bytes(buf, self.custom_metadata.as_deref());
109            }
110        }
111    }
112    fn encode_field_9<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
113        if version >= 0 {
114            put_i8(buf, self.remote_log_segment_state);
115        }
116    }
117    fn encode_tagged_fields<B: BufMut>(&self, buf: &mut B, _version: i16, flex: bool) {
118        if flex {
119            let mut tagged = WriteTaggedFields::new();
120            if !(crate::codegen_helpers::is_default(&self.txn_index_empty)) {
121                let payload = encode_to_bytes(1, |b| {
122                    put_bool(b, self.txn_index_empty);
123                    Ok(())
124                });
125                tagged.add(0, payload);
126            }
127            tagged.write(buf, &self.unknown_tagged_fields);
128        }
129    }
130    fn decode_field_0<B: Buf>(
131        out: &mut Self,
132        buf: &mut B,
133        version: i16,
134        _flex: bool,
135    ) -> Result<(), ProtocolError> {
136        if version >= 0 {
137            out.remote_log_segment_id = RemoteLogSegmentIdEntry::decode(buf, version)?;
138        }
139        Ok(())
140    }
141    fn decode_field_1<B: Buf>(
142        out: &mut Self,
143        buf: &mut B,
144        version: i16,
145        _flex: bool,
146    ) -> Result<(), ProtocolError> {
147        if version >= 0 {
148            out.start_offset = get_i64(buf)?;
149        }
150        Ok(())
151    }
152    fn decode_field_2<B: Buf>(
153        out: &mut Self,
154        buf: &mut B,
155        version: i16,
156        _flex: bool,
157    ) -> Result<(), ProtocolError> {
158        if version >= 0 {
159            out.end_offset = get_i64(buf)?;
160        }
161        Ok(())
162    }
163    fn decode_field_3<B: Buf>(
164        out: &mut Self,
165        buf: &mut B,
166        version: i16,
167        _flex: bool,
168    ) -> Result<(), ProtocolError> {
169        if version >= 0 {
170            out.broker_id = get_i32(buf)?;
171        }
172        Ok(())
173    }
174    fn decode_field_4<B: Buf>(
175        out: &mut Self,
176        buf: &mut B,
177        version: i16,
178        _flex: bool,
179    ) -> Result<(), ProtocolError> {
180        if version >= 0 {
181            out.max_timestamp_ms = get_i64(buf)?;
182        }
183        Ok(())
184    }
185    fn decode_field_5<B: Buf>(
186        out: &mut Self,
187        buf: &mut B,
188        version: i16,
189        _flex: bool,
190    ) -> Result<(), ProtocolError> {
191        if version >= 0 {
192            out.event_timestamp_ms = get_i64(buf)?;
193        }
194        Ok(())
195    }
196    fn decode_field_6<B: Buf>(
197        out: &mut Self,
198        buf: &mut B,
199        version: i16,
200        flex: bool,
201    ) -> Result<(), ProtocolError> {
202        if version >= 0 {
203            out.segment_leader_epochs = {
204                let n = crate::primitives::array::get_array_len(buf, flex)?;
205                let mut v = Vec::with_capacity(n);
206                for _ in 0..n {
207                    v.push(SegmentLeaderEpochEntry::decode(buf, version)?);
208                }
209                v
210            };
211        }
212        Ok(())
213    }
214    fn decode_field_7<B: Buf>(
215        out: &mut Self,
216        buf: &mut B,
217        version: i16,
218        _flex: bool,
219    ) -> Result<(), ProtocolError> {
220        if version >= 0 {
221            out.segment_size_in_bytes = get_i32(buf)?;
222        }
223        Ok(())
224    }
225    fn decode_field_8<B: Buf>(
226        out: &mut Self,
227        buf: &mut B,
228        version: i16,
229        flex: bool,
230    ) -> Result<(), ProtocolError> {
231        if version >= 0 {
232            out.custom_metadata = if flex {
233                get_compact_nullable_bytes_owned(buf)?
234            } else {
235                get_nullable_bytes_owned(buf)?
236            };
237        }
238        Ok(())
239    }
240    fn decode_field_9<B: Buf>(
241        out: &mut Self,
242        buf: &mut B,
243        version: i16,
244        _flex: bool,
245    ) -> Result<(), ProtocolError> {
246        if version >= 0 {
247            out.remote_log_segment_state = get_i8(buf)?;
248        }
249        Ok(())
250    }
251    fn decode_tagged_fields<B: Buf>(
252        out: &mut Self,
253        buf: &mut B,
254        _version: i16,
255        flex: bool,
256    ) -> Result<(), ProtocolError> {
257        if flex {
258            let mut tag_txn_index_empty = None;
259            out.unknown_tagged_fields = read_tagged_fields(buf, |tag, payload| match tag {
260                0 => {
261                    tag_txn_index_empty = Some({
262                        let b: &mut &[u8] = payload;
263                        get_bool(b)?
264                    });
265                    Ok(true)
266                }
267                _ => Ok(false),
268            })?;
269            if let Some(v) = tag_txn_index_empty {
270                out.txn_index_empty = v;
271            }
272        }
273        Ok(())
274    }
275}
276impl Encode for RemoteLogSegmentMetadataRecord {
277    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
278        if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
279            return Err(ProtocolError::SchemaMismatch(
280                "RemoteLogSegmentMetadataRecord version out of range",
281            ));
282        }
283        let flex = is_flexible(version);
284        self.encode_field_0(buf, version, flex)?;
285        self.encode_field_1(buf, version, flex);
286        self.encode_field_2(buf, version, flex);
287        self.encode_field_3(buf, version, flex);
288        self.encode_field_4(buf, version, flex);
289        self.encode_field_5(buf, version, flex);
290        self.encode_field_6(buf, version, flex)?;
291        self.encode_field_7(buf, version, flex);
292        self.encode_field_8(buf, version, flex);
293        self.encode_field_9(buf, version, flex);
294        self.encode_tagged_fields(buf, version, flex);
295        Ok(())
296    }
297    fn encoded_len(&self, version: i16) -> usize {
298        let flex = is_flexible(version);
299        let mut n: usize = 0;
300        if version >= 0 {
301            n += self.remote_log_segment_id.encoded_len(version);
302        }
303        if version >= 0 {
304            n += 8;
305        }
306        if version >= 0 {
307            n += 8;
308        }
309        if version >= 0 {
310            n += 4;
311        }
312        if version >= 0 {
313            n += 8;
314        }
315        if version >= 0 {
316            n += 8;
317        }
318        if version >= 0 {
319            n += {
320                let prefix = crate::primitives::array::array_len_prefix_len(
321                    (self.segment_leader_epochs).len(),
322                    flex,
323                );
324                let body: usize = (self.segment_leader_epochs)
325                    .iter()
326                    .map(|it| it.encoded_len(version))
327                    .sum();
328                prefix + body
329            };
330        }
331        if version >= 0 {
332            n += 4;
333        }
334        if version >= 0 {
335            n += if flex {
336                compact_nullable_bytes_len(self.custom_metadata.as_deref())
337            } else {
338                nullable_bytes_len(self.custom_metadata.as_deref())
339            };
340        }
341        if version >= 0 {
342            n += 1;
343        }
344        if flex {
345            let mut known_pairs: Vec<(u32, usize)> = Vec::new();
346            if !(crate::codegen_helpers::is_default(&self.txn_index_empty)) {
347                known_pairs.push((0, 1));
348            }
349            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
350        }
351        n
352    }
353}
354impl Decode<'_> for RemoteLogSegmentMetadataRecord {
355    fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
356        if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
357            return Err(ProtocolError::SchemaMismatch(
358                "RemoteLogSegmentMetadataRecord version out of range",
359            ));
360        }
361        let flex = is_flexible(version);
362        let mut out = Self::default();
363        Self::decode_field_0(&mut out, buf, version, flex)?;
364        Self::decode_field_1(&mut out, buf, version, flex)?;
365        Self::decode_field_2(&mut out, buf, version, flex)?;
366        Self::decode_field_3(&mut out, buf, version, flex)?;
367        Self::decode_field_4(&mut out, buf, version, flex)?;
368        Self::decode_field_5(&mut out, buf, version, flex)?;
369        Self::decode_field_6(&mut out, buf, version, flex)?;
370        Self::decode_field_7(&mut out, buf, version, flex)?;
371        Self::decode_field_8(&mut out, buf, version, flex)?;
372        Self::decode_field_9(&mut out, buf, version, flex)?;
373        Self::decode_tagged_fields(&mut out, buf, version, flex)?;
374        Ok(out)
375    }
376}
377#[cfg(test)]
378impl RemoteLogSegmentMetadataRecord {
379    #[must_use]
380    pub fn populated(version: i16) -> Self {
381        let mut m = Self::default();
382        if version >= 0 {
383            m.remote_log_segment_id = RemoteLogSegmentIdEntry::populated(version);
384        }
385        if version >= 0 {
386            m.start_offset = 1i64;
387        }
388        if version >= 0 {
389            m.end_offset = 1i64;
390        }
391        if version >= 0 {
392            m.broker_id = 1i32;
393        }
394        if version >= 0 {
395            m.max_timestamp_ms = 1i64;
396        }
397        if version >= 0 {
398            m.event_timestamp_ms = 1i64;
399        }
400        if version >= 0 {
401            m.segment_leader_epochs = vec![SegmentLeaderEpochEntry::populated(version)];
402        }
403        if version >= 0 {
404            m.segment_size_in_bytes = 1i32;
405        }
406        if version >= 0 {
407            m.custom_metadata = Some(::bytes::Bytes::from_static(b"x"));
408        }
409        if version >= 0 {
410            m.remote_log_segment_state = 1i8;
411        }
412        if version >= 0 {
413            m.txn_index_empty = true;
414        }
415        m
416    }
417}
418#[derive(Debug, Clone, PartialEq, Eq, Default)]
419pub struct RemoteLogSegmentIdEntry {
420    pub topic_id_partition: TopicIdPartitionEntry,
421    pub id: crate::primitives::uuid::Uuid,
422    pub unknown_tagged_fields: UnknownTaggedFields,
423}
424impl Encode for RemoteLogSegmentIdEntry {
425    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
426        let flex = version >= 0;
427        if version >= 0 {
428            self.topic_id_partition.encode(buf, version)?;
429        }
430        if version >= 0 {
431            crate::primitives::uuid::put_uuid(buf, self.id);
432        }
433        if flex {
434            let tagged = WriteTaggedFields::new();
435            tagged.write(buf, &self.unknown_tagged_fields);
436        }
437        Ok(())
438    }
439    fn encoded_len(&self, version: i16) -> usize {
440        let flex = version >= 0;
441        let mut n: usize = 0;
442        if version >= 0 {
443            n += self.topic_id_partition.encoded_len(version);
444        }
445        if version >= 0 {
446            n += 16;
447        }
448        if flex {
449            let known_pairs: Vec<(u32, usize)> = Vec::new();
450            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
451        }
452        n
453    }
454}
455impl Decode<'_> for RemoteLogSegmentIdEntry {
456    fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
457        let flex = version >= 0;
458        let mut out = Self::default();
459        if version >= 0 {
460            out.topic_id_partition = TopicIdPartitionEntry::decode(buf, version)?;
461        }
462        if version >= 0 {
463            out.id = crate::primitives::uuid::get_uuid(buf)?;
464        }
465        if flex {
466            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
467        }
468        Ok(out)
469    }
470}
471#[cfg(test)]
472impl RemoteLogSegmentIdEntry {
473    #[must_use]
474    pub fn populated(version: i16) -> Self {
475        let mut m = Self::default();
476        if version >= 0 {
477            m.topic_id_partition = TopicIdPartitionEntry::populated(version);
478        }
479        if version >= 0 {
480            m.id = crate::primitives::uuid::Uuid([1u8; 16]);
481        }
482        m
483    }
484}
485#[derive(Debug, Clone, PartialEq, Eq, Default)]
486pub struct TopicIdPartitionEntry {
487    pub name: String,
488    pub id: crate::primitives::uuid::Uuid,
489    pub partition: i32,
490    pub unknown_tagged_fields: UnknownTaggedFields,
491}
492impl Encode for TopicIdPartitionEntry {
493    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
494        let flex = version >= 0;
495        if version >= 0 {
496            if flex {
497                let () = put_compact_string(buf, &self.name);
498            } else {
499                let () = put_string(buf, &self.name);
500            }
501        }
502        if version >= 0 {
503            crate::primitives::uuid::put_uuid(buf, self.id);
504        }
505        if version >= 0 {
506            put_i32(buf, self.partition);
507        }
508        if flex {
509            let tagged = WriteTaggedFields::new();
510            tagged.write(buf, &self.unknown_tagged_fields);
511        }
512        Ok(())
513    }
514    fn encoded_len(&self, version: i16) -> usize {
515        let flex = version >= 0;
516        let mut n: usize = 0;
517        if version >= 0 {
518            n += if flex {
519                compact_string_len(&self.name)
520            } else {
521                string_len(&self.name)
522            };
523        }
524        if version >= 0 {
525            n += 16;
526        }
527        if version >= 0 {
528            n += 4;
529        }
530        if flex {
531            let known_pairs: Vec<(u32, usize)> = Vec::new();
532            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
533        }
534        n
535    }
536}
537impl Decode<'_> for TopicIdPartitionEntry {
538    fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
539        let flex = version >= 0;
540        let mut out = Self::default();
541        if version >= 0 {
542            out.name = if flex {
543                get_compact_string_owned(buf)?
544            } else {
545                get_string_owned(buf)?
546            };
547        }
548        if version >= 0 {
549            out.id = crate::primitives::uuid::get_uuid(buf)?;
550        }
551        if version >= 0 {
552            out.partition = get_i32(buf)?;
553        }
554        if flex {
555            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
556        }
557        Ok(out)
558    }
559}
560#[cfg(test)]
561impl TopicIdPartitionEntry {
562    #[must_use]
563    pub fn populated(version: i16) -> Self {
564        let mut m = Self::default();
565        if version >= 0 {
566            m.name = "x".to_string();
567        }
568        if version >= 0 {
569            m.id = crate::primitives::uuid::Uuid([1u8; 16]);
570        }
571        if version >= 0 {
572            m.partition = 1i32;
573        }
574        m
575    }
576}
577#[derive(Debug, Clone, PartialEq, Eq, Default)]
578pub struct SegmentLeaderEpochEntry {
579    pub leader_epoch: i32,
580    pub offset: i64,
581    pub unknown_tagged_fields: UnknownTaggedFields,
582}
583impl Encode for SegmentLeaderEpochEntry {
584    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
585        let flex = version >= 0;
586        if version >= 0 {
587            put_i32(buf, self.leader_epoch);
588        }
589        if version >= 0 {
590            put_i64(buf, self.offset);
591        }
592        if flex {
593            let tagged = WriteTaggedFields::new();
594            tagged.write(buf, &self.unknown_tagged_fields);
595        }
596        Ok(())
597    }
598    fn encoded_len(&self, version: i16) -> usize {
599        let flex = version >= 0;
600        let mut n: usize = 0;
601        if version >= 0 {
602            n += 4;
603        }
604        if version >= 0 {
605            n += 8;
606        }
607        if flex {
608            let known_pairs: Vec<(u32, usize)> = Vec::new();
609            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
610        }
611        n
612    }
613}
614impl Decode<'_> for SegmentLeaderEpochEntry {
615    fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
616        let flex = version >= 0;
617        let mut out = Self::default();
618        if version >= 0 {
619            out.leader_epoch = get_i32(buf)?;
620        }
621        if version >= 0 {
622            out.offset = get_i64(buf)?;
623        }
624        if flex {
625            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
626        }
627        Ok(out)
628    }
629}
630#[cfg(test)]
631impl SegmentLeaderEpochEntry {
632    #[must_use]
633    pub fn populated(version: i16) -> Self {
634        let mut m = Self::default();
635        if version >= 0 {
636            m.leader_epoch = 1i32;
637        }
638        if version >= 0 {
639            m.offset = 1i64;
640        }
641        m
642    }
643}
644/// Default JSON payload matching `Self::default()` for JVM oracle differential testing.
645/// Only includes fields valid for the given version.
646#[must_use]
647#[allow(unused_comparisons)]
648pub fn default_json(_version: i16) -> ::serde_json::Value {
649    let mut obj = ::serde_json::Map::new();
650    obj.insert("remoteLogSegmentId".to_string(), {
651        let mut m = ::serde_json::Map::new();
652        m.insert("topicIdPartition".to_string(), {
653            let mut m = ::serde_json::Map::new();
654            m.insert(
655                "name".to_string(),
656                ::serde_json::Value::String(String::new()),
657            );
658            m.insert(
659                "id".to_string(),
660                ::serde_json::Value::String("AAAAAAAAAAAAAAAAAAAAAA".to_string()),
661            );
662            m.insert("partition".to_string(), ::serde_json::json!(0));
663            ::serde_json::Value::Object(m)
664        });
665        m.insert(
666            "id".to_string(),
667            ::serde_json::Value::String("AAAAAAAAAAAAAAAAAAAAAA".to_string()),
668        );
669        ::serde_json::Value::Object(m)
670    });
671    obj.insert("startOffset".to_string(), ::serde_json::json!(0));
672    obj.insert("endOffset".to_string(), ::serde_json::json!(0));
673    obj.insert("brokerId".to_string(), ::serde_json::json!(0));
674    obj.insert("maxTimestampMs".to_string(), ::serde_json::json!(0));
675    obj.insert("eventTimestampMs".to_string(), ::serde_json::json!(0));
676    obj.insert(
677        "segmentLeaderEpochs".to_string(),
678        ::serde_json::Value::Array(vec![]),
679    );
680    obj.insert("segmentSizeInBytes".to_string(), ::serde_json::json!(0));
681    obj.insert("customMetadata".to_string(), ::serde_json::Value::Null);
682    obj.insert("remoteLogSegmentState".to_string(), ::serde_json::json!(0));
683    obj.insert(
684        "txnIndexEmpty".to_string(),
685        ::serde_json::Value::Bool(false),
686    );
687    ::serde_json::Value::Object(obj)
688}
689/// A message with a non-default value in every tagged field, at every depth, for
690/// the JVM oracle differential sweep. The value is the same at every version.
691#[must_use]
692pub fn tagged_fixture() -> RemoteLogSegmentMetadataRecord {
693    RemoteLogSegmentMetadataRecord {
694        txn_index_empty: true,
695        ..RemoteLogSegmentMetadataRecord::default()
696    }
697}
698/// The JSON form of `tagged_fixture()` that Kafka's JSON converter reads at
699/// `version`. It holds only the fields that the schema declares at that version.
700#[must_use]
701pub fn tagged_fixture_json(_version: i16) -> ::serde_json::Value {
702    let mut m = ::serde_json::Map::new();
703    m.insert("remoteLogSegmentId".to_string(), {
704        let mut m = ::serde_json::Map::new();
705        m.insert("topicIdPartition".to_string(), {
706            let mut m = ::serde_json::Map::new();
707            m.insert(
708                "name".to_string(),
709                ::serde_json::Value::String(String::new()),
710            );
711            m.insert(
712                "id".to_string(),
713                ::serde_json::Value::String("AAAAAAAAAAAAAAAAAAAAAA".to_string()),
714            );
715            m.insert("partition".to_string(), ::serde_json::json!(0));
716            ::serde_json::Value::Object(m)
717        });
718        m.insert(
719            "id".to_string(),
720            ::serde_json::Value::String("AAAAAAAAAAAAAAAAAAAAAA".to_string()),
721        );
722        ::serde_json::Value::Object(m)
723    });
724    m.insert("startOffset".to_string(), ::serde_json::json!(0));
725    m.insert("endOffset".to_string(), ::serde_json::json!(0));
726    m.insert("brokerId".to_string(), ::serde_json::json!(0));
727    m.insert("maxTimestampMs".to_string(), ::serde_json::json!(0));
728    m.insert("eventTimestampMs".to_string(), ::serde_json::json!(0));
729    m.insert(
730        "segmentLeaderEpochs".to_string(),
731        ::serde_json::Value::Array(vec![]),
732    );
733    m.insert("segmentSizeInBytes".to_string(), ::serde_json::json!(0));
734    m.insert("customMetadata".to_string(), ::serde_json::Value::Null);
735    m.insert("remoteLogSegmentState".to_string(), ::serde_json::json!(0));
736    m.insert("txnIndexEmpty".to_string(), ::serde_json::Value::Bool(true));
737    ::serde_json::Value::Object(m)
738}