1use crate::primitives::fixed::{get_bool, get_i16, get_i32, put_bool, put_i16, put_i32};
3use crate::primitives::string_bytes::{
4 compact_nullable_string_len, compact_string_len, nullable_string_len,
5 put_compact_nullable_string, put_compact_string, put_nullable_string, put_string, string_len,
6};
7use crate::primitives::string_bytes_borrowed::{
8 get_compact_nullable_string_borrowed, get_compact_string_borrowed,
9 get_nullable_string_borrowed, get_string_borrowed,
10};
11use crate::tagged_fields::{WriteTaggedFields, read_tagged_fields, tagged_fields_len};
12use crate::{DecodeBorrow, Encode, ProtocolError, UnknownTaggedFields};
13use bytes::BufMut;
14pub const API_KEY: i16 = 3;
15pub const MIN_VERSION: i16 = 0;
16pub const MAX_VERSION: i16 = 13;
17pub const FLEXIBLE_MIN: i16 = 9;
18#[inline]
19fn is_flexible(version: i16) -> bool {
20 version >= FLEXIBLE_MIN
21}
22#[derive(Debug, Clone, PartialEq, Eq)]
23pub struct MetadataResponse<'a> {
24 pub throttle_time_ms: i32,
25 pub brokers: Vec<MetadataResponseBroker<'a>>,
26 pub cluster_id: Option<&'a str>,
27 pub controller_id: i32,
28 pub topics: Vec<MetadataResponseTopic<'a>>,
29 pub cluster_authorized_operations: i32,
30 pub error_code: i16,
31 pub unknown_tagged_fields: UnknownTaggedFields,
32}
33impl Default for MetadataResponse<'_> {
34 fn default() -> Self {
35 Self {
36 throttle_time_ms: 0i32,
37 brokers: Vec::new(),
38 cluster_id: None,
39 controller_id: -1i32,
40 topics: Vec::new(),
41 cluster_authorized_operations: -2_147_483_648i32,
42 error_code: 0i16,
43 unknown_tagged_fields: Default::default(),
44 }
45 }
46}
47impl MetadataResponse<'_> {
48 pub fn to_owned(&self) -> crate::owned::metadata_response::MetadataResponse {
49 crate::owned::metadata_response::MetadataResponse {
50 throttle_time_ms: (self.throttle_time_ms),
51 brokers: (self.brokers)
52 .iter()
53 .map(MetadataResponseBroker::to_owned)
54 .collect(),
55 cluster_id: (self.cluster_id).map(std::string::ToString::to_string),
56 controller_id: (self.controller_id),
57 topics: (self.topics)
58 .iter()
59 .map(MetadataResponseTopic::to_owned)
60 .collect(),
61 cluster_authorized_operations: (self.cluster_authorized_operations),
62 error_code: (self.error_code),
63 unknown_tagged_fields: self.unknown_tagged_fields.clone(),
64 }
65 }
66}
67impl Encode for MetadataResponse<'_> {
68 fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
69 if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
70 return Err(ProtocolError::UnsupportedVersion {
71 api_key: API_KEY,
72 version,
73 });
74 }
75 let flex = is_flexible(version);
76 if version >= 3 {
77 put_i32(buf, self.throttle_time_ms);
78 }
79 if version >= 0 {
80 {
81 crate::primitives::array::put_array_len(buf, (self.brokers).len(), flex);
82 for it in &self.brokers {
83 it.encode(buf, version)?;
84 }
85 }
86 }
87 if version >= 2 {
88 if flex {
89 put_compact_nullable_string(buf, self.cluster_id);
90 } else {
91 put_nullable_string(buf, self.cluster_id);
92 }
93 }
94 if version >= 1 {
95 put_i32(buf, self.controller_id);
96 }
97 if version >= 0 {
98 {
99 crate::primitives::array::put_array_len(buf, (self.topics).len(), flex);
100 for it in &self.topics {
101 it.encode(buf, version)?;
102 }
103 }
104 }
105 if (8..=10).contains(&version) {
106 put_i32(buf, self.cluster_authorized_operations);
107 }
108 if version >= 13 {
109 put_i16(buf, self.error_code);
110 }
111 if flex {
112 let tagged = WriteTaggedFields::new();
113 tagged.write(buf, &self.unknown_tagged_fields);
114 }
115 Ok(())
116 }
117 fn encoded_len(&self, version: i16) -> usize {
118 let flex = is_flexible(version);
119 let mut n: usize = 0;
120 if version >= 3 {
121 n += 4;
122 }
123 if version >= 0 {
124 n += {
125 let prefix =
126 crate::primitives::array::array_len_prefix_len((self.brokers).len(), flex);
127 let body: usize = (self.brokers)
128 .iter()
129 .map(|it| it.encoded_len(version))
130 .sum();
131 prefix + body
132 };
133 }
134 if version >= 2 {
135 n += if flex {
136 compact_nullable_string_len(self.cluster_id)
137 } else {
138 nullable_string_len(self.cluster_id)
139 };
140 }
141 if version >= 1 {
142 n += 4;
143 }
144 if version >= 0 {
145 n += {
146 let prefix =
147 crate::primitives::array::array_len_prefix_len((self.topics).len(), flex);
148 let body: usize = (self.topics).iter().map(|it| it.encoded_len(version)).sum();
149 prefix + body
150 };
151 }
152 if (8..=10).contains(&version) {
153 n += 4;
154 }
155 if version >= 13 {
156 n += 2;
157 }
158 if flex {
159 let known_pairs: Vec<(u32, usize)> = Vec::new();
160 n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
161 }
162 n
163 }
164}
165impl<'de> DecodeBorrow<'de> for MetadataResponse<'de> {
166 fn decode_borrow(buf: &mut &'de [u8], version: i16) -> Result<Self, ProtocolError> {
167 if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
168 return Err(ProtocolError::UnsupportedVersion {
169 api_key: API_KEY,
170 version,
171 });
172 }
173 let flex = is_flexible(version);
174 let mut out = Self::default();
175 if version >= 3 {
176 out.throttle_time_ms = get_i32(buf)?;
177 }
178 if version >= 0 {
179 out.brokers = {
180 let n = crate::primitives::array::get_array_len(buf, flex)?;
181 let mut v = Vec::with_capacity(n);
182 for _ in 0..n {
183 v.push(MetadataResponseBroker::decode_borrow(buf, version)?);
184 }
185 v
186 };
187 }
188 if version >= 2 {
189 out.cluster_id = if flex {
190 get_compact_nullable_string_borrowed(buf)?
191 } else {
192 get_nullable_string_borrowed(buf)?
193 };
194 }
195 if version >= 1 {
196 out.controller_id = get_i32(buf)?;
197 }
198 if version >= 0 {
199 out.topics = {
200 let n = crate::primitives::array::get_array_len(buf, flex)?;
201 let mut v = Vec::with_capacity(n);
202 for _ in 0..n {
203 v.push(MetadataResponseTopic::decode_borrow(buf, version)?);
204 }
205 v
206 };
207 }
208 if (8..=10).contains(&version) {
209 out.cluster_authorized_operations = get_i32(buf)?;
210 }
211 if version >= 13 {
212 out.error_code = get_i16(buf)?;
213 }
214 if flex {
215 out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
216 }
217 Ok(out)
218 }
219}
220#[cfg(test)]
221impl MetadataResponse<'_> {
222 #[must_use]
223 pub fn populated(version: i16) -> Self {
224 let mut m = Self::default();
225 if version >= 3 {
226 m.throttle_time_ms = 1i32;
227 }
228 if version >= 0 {
229 m.brokers = vec![MetadataResponseBroker::populated(version)];
230 }
231 if version >= 2 {
232 m.cluster_id = Some("x");
233 }
234 if version >= 1 {
235 m.controller_id = 1i32;
236 }
237 if version >= 0 {
238 m.topics = vec![MetadataResponseTopic::populated(version)];
239 }
240 if (8..=10).contains(&version) {
241 m.cluster_authorized_operations = 1i32;
242 }
243 if version >= 13 {
244 m.error_code = 1i16;
245 }
246 m
247 }
248}
249#[derive(Debug, Clone, PartialEq, Eq, Default)]
250pub struct MetadataResponseBroker<'a> {
251 pub node_id: i32,
252 pub host: &'a str,
253 pub port: i32,
254 pub rack: Option<&'a str>,
255 pub unknown_tagged_fields: UnknownTaggedFields,
256}
257impl MetadataResponseBroker<'_> {
258 pub fn to_owned(&self) -> crate::owned::metadata_response::MetadataResponseBroker {
259 crate::owned::metadata_response::MetadataResponseBroker {
260 node_id: (self.node_id),
261 host: (self.host).to_string(),
262 port: (self.port),
263 rack: (self.rack).map(std::string::ToString::to_string),
264 unknown_tagged_fields: self.unknown_tagged_fields.clone(),
265 }
266 }
267}
268impl Encode for MetadataResponseBroker<'_> {
269 fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
270 let flex = version >= 9;
271 if version >= 0 {
272 put_i32(buf, self.node_id);
273 }
274 if version >= 0 {
275 if flex {
276 put_compact_string(buf, self.host);
277 } else {
278 put_string(buf, self.host);
279 }
280 }
281 if version >= 0 {
282 put_i32(buf, self.port);
283 }
284 if version >= 1 {
285 if flex {
286 put_compact_nullable_string(buf, self.rack);
287 } else {
288 put_nullable_string(buf, self.rack);
289 }
290 }
291 if flex {
292 let tagged = WriteTaggedFields::new();
293 tagged.write(buf, &self.unknown_tagged_fields);
294 }
295 Ok(())
296 }
297 fn encoded_len(&self, version: i16) -> usize {
298 let flex = version >= 9;
299 let mut n: usize = 0;
300 if version >= 0 {
301 n += 4;
302 }
303 if version >= 0 {
304 n += if flex {
305 compact_string_len(self.host)
306 } else {
307 string_len(self.host)
308 };
309 }
310 if version >= 0 {
311 n += 4;
312 }
313 if version >= 1 {
314 n += if flex {
315 compact_nullable_string_len(self.rack)
316 } else {
317 nullable_string_len(self.rack)
318 };
319 }
320 if flex {
321 let known_pairs: Vec<(u32, usize)> = Vec::new();
322 n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
323 }
324 n
325 }
326}
327impl<'de> DecodeBorrow<'de> for MetadataResponseBroker<'de> {
328 fn decode_borrow(buf: &mut &'de [u8], version: i16) -> Result<Self, ProtocolError> {
329 let flex = version >= 9;
330 let mut out = Self::default();
331 if version >= 0 {
332 out.node_id = get_i32(buf)?;
333 }
334 if version >= 0 {
335 out.host = if flex {
336 get_compact_string_borrowed(buf)?
337 } else {
338 get_string_borrowed(buf)?
339 };
340 }
341 if version >= 0 {
342 out.port = get_i32(buf)?;
343 }
344 if version >= 1 {
345 out.rack = if flex {
346 get_compact_nullable_string_borrowed(buf)?
347 } else {
348 get_nullable_string_borrowed(buf)?
349 };
350 }
351 if flex {
352 out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
353 }
354 Ok(out)
355 }
356}
357#[cfg(test)]
358impl MetadataResponseBroker<'_> {
359 #[must_use]
360 pub fn populated(version: i16) -> Self {
361 let mut m = Self::default();
362 if version >= 0 {
363 m.node_id = 1i32;
364 }
365 if version >= 0 {
366 m.host = "x";
367 }
368 if version >= 0 {
369 m.port = 1i32;
370 }
371 if version >= 1 {
372 m.rack = Some("x");
373 }
374 m
375 }
376}
377#[derive(Debug, Clone, PartialEq, Eq)]
378pub struct MetadataResponseTopic<'a> {
379 pub error_code: i16,
380 pub name: Option<&'a str>,
381 pub topic_id: crate::primitives::uuid::Uuid,
382 pub is_internal: bool,
383 pub partitions: Vec<MetadataResponsePartition>,
384 pub topic_authorized_operations: i32,
385 pub unknown_tagged_fields: UnknownTaggedFields,
386}
387impl Default for MetadataResponseTopic<'_> {
388 fn default() -> Self {
389 Self {
390 error_code: 0i16,
391 name: None,
392 topic_id: Default::default(),
393 is_internal: false,
394 partitions: Vec::new(),
395 topic_authorized_operations: -2_147_483_648i32,
396 unknown_tagged_fields: Default::default(),
397 }
398 }
399}
400impl MetadataResponseTopic<'_> {
401 pub fn to_owned(&self) -> crate::owned::metadata_response::MetadataResponseTopic {
402 crate::owned::metadata_response::MetadataResponseTopic {
403 error_code: (self.error_code),
404 name: (self.name).map(std::string::ToString::to_string),
405 topic_id: (self.topic_id),
406 is_internal: (self.is_internal),
407 partitions: (self.partitions)
408 .iter()
409 .map(MetadataResponsePartition::to_owned)
410 .collect(),
411 topic_authorized_operations: (self.topic_authorized_operations),
412 unknown_tagged_fields: self.unknown_tagged_fields.clone(),
413 }
414 }
415}
416impl Encode for MetadataResponseTopic<'_> {
417 fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
418 let flex = version >= 9;
419 if version >= 0 {
420 put_i16(buf, self.error_code);
421 }
422 if version >= 0 {
423 if version >= 12 {
424 if flex {
425 put_compact_nullable_string(buf, self.name);
426 } else {
427 put_nullable_string(buf, self.name);
428 }
429 } else {
430 if flex {
431 put_compact_string(buf, (self.name).unwrap_or(""));
432 } else {
433 put_string(buf, (self.name).unwrap_or(""));
434 }
435 }
436 }
437 if version >= 10 {
438 crate::primitives::uuid::put_uuid(buf, self.topic_id);
439 }
440 if version >= 1 {
441 put_bool(buf, self.is_internal);
442 }
443 if version >= 0 {
444 {
445 crate::primitives::array::put_array_len(buf, (self.partitions).len(), flex);
446 for it in &self.partitions {
447 it.encode(buf, version)?;
448 }
449 }
450 }
451 if version >= 8 {
452 put_i32(buf, self.topic_authorized_operations);
453 }
454 if flex {
455 let tagged = WriteTaggedFields::new();
456 tagged.write(buf, &self.unknown_tagged_fields);
457 }
458 Ok(())
459 }
460 fn encoded_len(&self, version: i16) -> usize {
461 let flex = version >= 9;
462 let mut n: usize = 0;
463 if version >= 0 {
464 n += 2;
465 }
466 if version >= 0 {
467 n += if version >= 12 {
468 if flex {
469 compact_nullable_string_len(self.name)
470 } else {
471 nullable_string_len(self.name)
472 }
473 } else {
474 if flex {
475 compact_string_len((self.name).unwrap_or(""))
476 } else {
477 string_len((self.name).unwrap_or(""))
478 }
479 };
480 }
481 if version >= 10 {
482 n += 16;
483 }
484 if version >= 1 {
485 n += 1;
486 }
487 if version >= 0 {
488 n += {
489 let prefix =
490 crate::primitives::array::array_len_prefix_len((self.partitions).len(), flex);
491 let body: usize = (self.partitions)
492 .iter()
493 .map(|it| it.encoded_len(version))
494 .sum();
495 prefix + body
496 };
497 }
498 if version >= 8 {
499 n += 4;
500 }
501 if flex {
502 let known_pairs: Vec<(u32, usize)> = Vec::new();
503 n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
504 }
505 n
506 }
507}
508impl<'de> DecodeBorrow<'de> for MetadataResponseTopic<'de> {
509 fn decode_borrow(buf: &mut &'de [u8], version: i16) -> Result<Self, ProtocolError> {
510 let flex = version >= 9;
511 let mut out = Self::default();
512 if version >= 0 {
513 out.error_code = get_i16(buf)?;
514 }
515 if version >= 0 {
516 out.name = if version >= 12 {
517 if flex {
518 get_compact_nullable_string_borrowed(buf)?
519 } else {
520 get_nullable_string_borrowed(buf)?
521 }
522 } else {
523 Some(if flex {
524 get_compact_string_borrowed(buf)?
525 } else {
526 get_string_borrowed(buf)?
527 })
528 };
529 }
530 if version >= 10 {
531 out.topic_id = crate::primitives::uuid::get_uuid(buf)?;
532 }
533 if version >= 1 {
534 out.is_internal = get_bool(buf)?;
535 }
536 if version >= 0 {
537 out.partitions = {
538 let n = crate::primitives::array::get_array_len(buf, flex)?;
539 let mut v = Vec::with_capacity(n);
540 for _ in 0..n {
541 v.push(MetadataResponsePartition::decode_borrow(buf, version)?);
542 }
543 v
544 };
545 }
546 if version >= 8 {
547 out.topic_authorized_operations = get_i32(buf)?;
548 }
549 if flex {
550 out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
551 }
552 Ok(out)
553 }
554}
555#[cfg(test)]
556impl MetadataResponseTopic<'_> {
557 #[must_use]
558 pub fn populated(version: i16) -> Self {
559 let mut m = Self::default();
560 if version >= 0 {
561 m.error_code = 1i16;
562 }
563 if version >= 0 {
564 m.name = Some("x");
565 }
566 if version >= 10 {
567 m.topic_id = crate::primitives::uuid::Uuid([1u8; 16]);
568 }
569 if version >= 1 {
570 m.is_internal = true;
571 }
572 if version >= 0 {
573 m.partitions = vec![MetadataResponsePartition::populated(version)];
574 }
575 if version >= 8 {
576 m.topic_authorized_operations = 1i32;
577 }
578 m
579 }
580}
581#[derive(Debug, Clone, PartialEq, Eq)]
582pub struct MetadataResponsePartition {
583 pub error_code: i16,
584 pub partition_index: i32,
585 pub leader_id: i32,
586 pub leader_epoch: i32,
587 pub replica_nodes: Vec<i32>,
588 pub isr_nodes: Vec<i32>,
589 pub offline_replicas: Vec<i32>,
590 pub unknown_tagged_fields: UnknownTaggedFields,
591}
592impl Default for MetadataResponsePartition {
593 fn default() -> Self {
594 Self {
595 error_code: 0i16,
596 partition_index: 0i32,
597 leader_id: 0i32,
598 leader_epoch: -1i32,
599 replica_nodes: Vec::new(),
600 isr_nodes: Vec::new(),
601 offline_replicas: Vec::new(),
602 unknown_tagged_fields: Default::default(),
603 }
604 }
605}
606impl MetadataResponsePartition {
607 pub fn to_owned(&self) -> crate::owned::metadata_response::MetadataResponsePartition {
608 crate::owned::metadata_response::MetadataResponsePartition {
609 error_code: (self.error_code),
610 partition_index: (self.partition_index),
611 leader_id: (self.leader_id),
612 leader_epoch: (self.leader_epoch),
613 replica_nodes: (self.replica_nodes).clone(),
614 isr_nodes: (self.isr_nodes).clone(),
615 offline_replicas: (self.offline_replicas).clone(),
616 unknown_tagged_fields: self.unknown_tagged_fields.clone(),
617 }
618 }
619}
620impl Encode for MetadataResponsePartition {
621 fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
622 let flex = version >= 9;
623 if version >= 0 {
624 put_i16(buf, self.error_code);
625 }
626 if version >= 0 {
627 put_i32(buf, self.partition_index);
628 }
629 if version >= 0 {
630 put_i32(buf, self.leader_id);
631 }
632 if version >= 7 {
633 put_i32(buf, self.leader_epoch);
634 }
635 if version >= 0 {
636 {
637 crate::primitives::array::put_array_len(buf, (self.replica_nodes).len(), flex);
638 for it in &self.replica_nodes {
639 put_i32(buf, *it);
640 }
641 }
642 }
643 if version >= 0 {
644 {
645 crate::primitives::array::put_array_len(buf, (self.isr_nodes).len(), flex);
646 for it in &self.isr_nodes {
647 put_i32(buf, *it);
648 }
649 }
650 }
651 if version >= 5 {
652 {
653 crate::primitives::array::put_array_len(buf, (self.offline_replicas).len(), flex);
654 for it in &self.offline_replicas {
655 put_i32(buf, *it);
656 }
657 }
658 }
659 if flex {
660 let tagged = WriteTaggedFields::new();
661 tagged.write(buf, &self.unknown_tagged_fields);
662 }
663 Ok(())
664 }
665 fn encoded_len(&self, version: i16) -> usize {
666 let flex = version >= 9;
667 let mut n: usize = 0;
668 if version >= 0 {
669 n += 2;
670 }
671 if version >= 0 {
672 n += 4;
673 }
674 if version >= 0 {
675 n += 4;
676 }
677 if version >= 7 {
678 n += 4;
679 }
680 if version >= 0 {
681 n += {
682 let prefix = crate::primitives::array::array_len_prefix_len(
683 (self.replica_nodes).len(),
684 flex,
685 );
686 let body: usize = (self.replica_nodes).iter().map(|_| 4).sum();
687 prefix + body
688 };
689 }
690 if version >= 0 {
691 n += {
692 let prefix =
693 crate::primitives::array::array_len_prefix_len((self.isr_nodes).len(), flex);
694 let body: usize = (self.isr_nodes).iter().map(|_| 4).sum();
695 prefix + body
696 };
697 }
698 if version >= 5 {
699 n += {
700 let prefix = crate::primitives::array::array_len_prefix_len(
701 (self.offline_replicas).len(),
702 flex,
703 );
704 let body: usize = (self.offline_replicas).iter().map(|_| 4).sum();
705 prefix + body
706 };
707 }
708 if flex {
709 let known_pairs: Vec<(u32, usize)> = Vec::new();
710 n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
711 }
712 n
713 }
714}
715impl<'de> DecodeBorrow<'de> for MetadataResponsePartition {
716 fn decode_borrow(buf: &mut &'de [u8], version: i16) -> Result<Self, ProtocolError> {
717 let flex = version >= 9;
718 let mut out = Self::default();
719 if version >= 0 {
720 out.error_code = get_i16(buf)?;
721 }
722 if version >= 0 {
723 out.partition_index = get_i32(buf)?;
724 }
725 if version >= 0 {
726 out.leader_id = get_i32(buf)?;
727 }
728 if version >= 7 {
729 out.leader_epoch = get_i32(buf)?;
730 }
731 if version >= 0 {
732 out.replica_nodes = {
733 let n = crate::primitives::array::get_array_len(buf, flex)?;
734 let mut v = Vec::with_capacity(n);
735 for _ in 0..n {
736 v.push(get_i32(buf)?);
737 }
738 v
739 };
740 }
741 if version >= 0 {
742 out.isr_nodes = {
743 let n = crate::primitives::array::get_array_len(buf, flex)?;
744 let mut v = Vec::with_capacity(n);
745 for _ in 0..n {
746 v.push(get_i32(buf)?);
747 }
748 v
749 };
750 }
751 if version >= 5 {
752 out.offline_replicas = {
753 let n = crate::primitives::array::get_array_len(buf, flex)?;
754 let mut v = Vec::with_capacity(n);
755 for _ in 0..n {
756 v.push(get_i32(buf)?);
757 }
758 v
759 };
760 }
761 if flex {
762 out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
763 }
764 Ok(out)
765 }
766}
767#[cfg(test)]
768impl MetadataResponsePartition {
769 #[must_use]
770 pub fn populated(version: i16) -> Self {
771 let mut m = Self::default();
772 if version >= 0 {
773 m.error_code = 1i16;
774 }
775 if version >= 0 {
776 m.partition_index = 1i32;
777 }
778 if version >= 0 {
779 m.leader_id = 1i32;
780 }
781 if version >= 7 {
782 m.leader_epoch = 1i32;
783 }
784 if version >= 0 {
785 m.replica_nodes = vec![1i32];
786 }
787 if version >= 0 {
788 m.isr_nodes = vec![1i32];
789 }
790 if version >= 5 {
791 m.offline_replicas = vec![1i32];
792 }
793 m
794 }
795}