From 30425e37e4229f5a996d00e204536bddd6f524f8 Mon Sep 17 00:00:00 2001 From: tychedelia Date: Wed, 8 Feb 2023 15:45:18 -0600 Subject: [PATCH] Updates from Kafka upstream. (#14) --- CHANGELOG.md | 2 +- Cargo.toml | 2 +- README.md | 79 +++++++++++- protocol_codegen/Cargo.toml | 2 +- protocol_codegen/src/generate_messages.rs | 15 ++- .../src/generate_messages/generate.rs | 18 ++- src/messages.rs | 2 + src/messages/add_offsets_to_txn_request.rs | 11 +- src/messages/add_offsets_to_txn_response.rs | 11 +- src/messages/add_partitions_to_txn_request.rs | 20 ++- .../add_partitions_to_txn_response.rs | 29 ++++- src/messages/allocate_producer_ids_request.rs | 11 +- .../allocate_producer_ids_response.rs | 11 +- src/messages/alter_client_quotas_request.rs | 38 +++++- src/messages/alter_client_quotas_response.rs | 29 ++++- src/messages/alter_configs_request.rs | 29 ++++- src/messages/alter_configs_response.rs | 20 ++- .../alter_partition_reassignments_request.rs | 29 ++++- .../alter_partition_reassignments_response.rs | 29 ++++- src/messages/alter_partition_request.rs | 97 ++++++++++---- src/messages/alter_partition_response.rs | 101 +++++++++++---- .../alter_replica_log_dirs_request.rs | 29 ++++- .../alter_replica_log_dirs_response.rs | 29 ++++- .../alter_user_scram_credentials_request.rs | 29 ++++- .../alter_user_scram_credentials_response.rs | 20 ++- src/messages/api_versions_request.rs | 11 +- src/messages/api_versions_response.rs | 38 +++++- src/messages/begin_quorum_epoch_request.rs | 29 ++++- src/messages/begin_quorum_epoch_response.rs | 29 ++++- src/messages/broker_heartbeat_request.rs | 11 +- src/messages/broker_heartbeat_response.rs | 11 +- src/messages/broker_registration_request.rs | 29 ++++- src/messages/broker_registration_response.rs | 11 +- src/messages/consumer_protocol_assignment.rs | 20 ++- .../consumer_protocol_subscription.rs | 20 ++- src/messages/controlled_shutdown_request.rs | 11 +- src/messages/controlled_shutdown_response.rs | 20 ++- src/messages/create_acls_request.rs | 44 +++++-- src/messages/create_acls_response.rs | 36 ++++-- .../create_delegation_token_request.rs | 88 +++++++++++-- .../create_delegation_token_response.rs | 85 +++++++++++-- src/messages/create_partitions_request.rs | 29 ++++- src/messages/create_partitions_response.rs | 20 ++- src/messages/create_topics_request.rs | 38 +++++- src/messages/create_topics_response.rs | 29 ++++- src/messages/default_principal_data.rs | 11 +- src/messages/delete_acls_request.rs | 44 +++++-- src/messages/delete_acls_response.rs | 69 ++++++---- src/messages/delete_groups_request.rs | 11 +- src/messages/delete_groups_response.rs | 20 ++- src/messages/delete_records_request.rs | 29 ++++- src/messages/delete_records_response.rs | 29 ++++- src/messages/delete_topics_request.rs | 20 ++- src/messages/delete_topics_response.rs | 20 ++- src/messages/describe_acls_request.rs | 29 +++-- src/messages/describe_acls_response.rs | 65 +++++++--- .../describe_client_quotas_request.rs | 20 ++- .../describe_client_quotas_response.rs | 38 +++++- src/messages/describe_cluster_request.rs | 11 +- src/messages/describe_cluster_response.rs | 20 ++- src/messages/describe_configs_request.rs | 20 ++- src/messages/describe_configs_response.rs | 38 +++++- .../describe_delegation_token_request.rs | 34 +++-- .../describe_delegation_token_response.rs | 119 +++++++++++++++--- src/messages/describe_groups_request.rs | 11 +- src/messages/describe_groups_response.rs | 29 ++++- src/messages/describe_log_dirs_request.rs | 32 +++-- src/messages/describe_log_dirs_response.rs | 114 +++++++++++++---- src/messages/describe_producers_request.rs | 20 ++- src/messages/describe_producers_response.rs | 38 +++++- src/messages/describe_quorum_request.rs | 49 ++++++-- src/messages/describe_quorum_response.rs | 116 +++++++++++++---- src/messages/describe_transactions_request.rs | 11 +- .../describe_transactions_response.rs | 29 ++++- ...describe_user_scram_credentials_request.rs | 20 ++- ...escribe_user_scram_credentials_response.rs | 29 ++++- src/messages/elect_leaders_request.rs | 20 ++- src/messages/elect_leaders_response.rs | 29 ++++- src/messages/end_quorum_epoch_request.rs | 29 ++++- src/messages/end_quorum_epoch_response.rs | 29 ++++- src/messages/end_txn_request.rs | 11 +- src/messages/end_txn_response.rs | 11 +- src/messages/envelope_request.rs | 11 +- src/messages/envelope_response.rs | 11 +- .../expire_delegation_token_request.rs | 11 +- .../expire_delegation_token_response.rs | 11 +- src/messages/fetch_request.rs | 38 +++++- src/messages/fetch_response.rs | 65 +++++++++- src/messages/fetch_snapshot_request.rs | 38 +++++- src/messages/fetch_snapshot_response.rs | 47 ++++++- src/messages/find_coordinator_request.rs | 11 +- src/messages/find_coordinator_response.rs | 20 ++- src/messages/heartbeat_request.rs | 11 +- src/messages/heartbeat_response.rs | 11 +- .../incremental_alter_configs_request.rs | 29 ++++- .../incremental_alter_configs_response.rs | 20 ++- src/messages/init_producer_id_request.rs | 11 +- src/messages/init_producer_id_response.rs | 11 +- src/messages/join_group_request.rs | 20 ++- src/messages/join_group_response.rs | 28 +++-- src/messages/leader_and_isr_request.rs | 52 ++++++-- src/messages/leader_and_isr_response.rs | 29 ++++- src/messages/leader_change_message.rs | 20 ++- src/messages/leave_group_request.rs | 20 ++- src/messages/leave_group_response.rs | 20 ++- src/messages/list_groups_request.rs | 11 +- src/messages/list_groups_response.rs | 20 ++- src/messages/list_offsets_request.rs | 29 ++++- src/messages/list_offsets_response.rs | 29 ++++- .../list_partition_reassignments_request.rs | 20 ++- .../list_partition_reassignments_response.rs | 29 ++++- src/messages/list_transactions_request.rs | 11 +- src/messages/list_transactions_response.rs | 20 ++- src/messages/metadata_request.rs | 20 ++- src/messages/metadata_response.rs | 38 +++++- src/messages/offset_commit_request.rs | 29 ++++- src/messages/offset_commit_response.rs | 29 ++++- src/messages/offset_delete_request.rs | 29 ++++- src/messages/offset_delete_response.rs | 29 ++++- src/messages/offset_fetch_request.rs | 38 +++++- src/messages/offset_fetch_response.rs | 56 ++++++++- .../offset_for_leader_epoch_request.rs | 29 ++++- .../offset_for_leader_epoch_response.rs | 29 ++++- src/messages/produce_request.rs | 29 ++++- src/messages/produce_response.rs | 38 +++++- .../renew_delegation_token_request.rs | 11 +- .../renew_delegation_token_response.rs | 11 +- src/messages/request_header.rs | 11 +- src/messages/response_header.rs | 11 +- src/messages/sasl_authenticate_request.rs | 11 +- src/messages/sasl_authenticate_response.rs | 11 +- src/messages/sasl_handshake_request.rs | 11 +- src/messages/sasl_handshake_response.rs | 11 +- src/messages/snapshot_footer_record.rs | 11 +- src/messages/snapshot_header_record.rs | 11 +- src/messages/stop_replica_request.rs | 47 ++++++- src/messages/stop_replica_response.rs | 20 ++- src/messages/sync_group_request.rs | 20 ++- src/messages/sync_group_response.rs | 11 +- src/messages/txn_offset_commit_request.rs | 29 ++++- src/messages/txn_offset_commit_response.rs | 29 ++++- src/messages/unregister_broker_request.rs | 11 +- src/messages/unregister_broker_response.rs | 11 +- src/messages/update_features_request.rs | 110 ++++++++++++++-- src/messages/update_features_response.rs | 40 ++++-- src/messages/update_metadata_request.rs | 47 ++++++- src/messages/update_metadata_response.rs | 11 +- src/messages/vote_request.rs | 29 ++++- src/messages/vote_response.rs | 29 ++++- src/messages/write_txn_markers_request.rs | 29 ++++- src/messages/write_txn_markers_response.rs | 38 +++++- src/protocol/mod.rs | 18 +-- 152 files changed, 3902 insertions(+), 419 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e0ad65..d0586a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ #### Enhancements: -- Add derrive builder for all messages. +- Add derive builder for all messages. ## v0.1.0 diff --git a/Cargo.toml b/Cargo.toml index 9c5a782..2a830de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,4 +30,4 @@ snap = "1.0.5" flate2 = "1.0.20" string = "0.3.0" derive_builder = "0.10.2" -paste = "1.0.7" +paste = "1.0.7" \ No newline at end of file diff --git a/README.md b/README.md index fbc88d1..fa9bbc4 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,84 @@ Unlike other Kafka protocol implementations, this project uses code generation t including different protocol versions. See [Kafka's repo](https://github.com/apache/kafka/blob/trunk/clients/src/main/resources/common/message) for an example of protocol schema. -The code generator fetch the Kafka [repo](https://github.com/apache/kafka), and use the default branch to generate codes. +## Versioning -## For Developers +Protocol messages are generated against the most recent stable Kafka release, currently [3.3.2](https://github.com/apache/kafka/releases/tag/3.3.2). + +Although the Kafka protocol remains relatively stable and strives to be backwards compatible, new fields are occasionally +added. In order to ensure forward compatability with the protocol, this crate marks all exported items as `#[non-exhaustive]`. +Protocol messages can be constructed using either `Default::default` or their provided [builder](https://docs.rs/derive_builder/latest/derive_builder/). + +## Working with messages + +Using `Default::default`: +```rust +use kafka_protocol::messages::{ApiKey, MetadataRequest, RequestHeader}; +use kafka_protocol::protocol::StrBytes; + +let mut header = RequestHeader::default(); +header.client_id = Some(StrBytes::from_str("my-client")); +header.request_api_key = ApiKey::MetadataKey as i16; +header.request_api_version = 12; + +let mut request = MetadataRequest::default(); +request.topics = None; +request.allow_auto_topic_creation = true; +``` + +Using `kafka_protocol::protocol::Builder`: +```rust +use kafka_protocol::messages::{ApiKey, MetadataRequest, RequestHeader}; +use kafka_protocol::protocol::{Builder, StrBytes}; + +let header = RequestHeader::builder() + .client_id(Some(StrBytes::from_str("my-client"))) + .request_api_key(ApiKey::MetadataKey as i16) + .request_api_version(12) + .build(); +! +let request = MetadataRequest::builder() + .topics(None) + .allow_auto_topic_creation(true) + .build(); +``` +### Serialization + +Once a message has been created, it can be serialized using [`Encodable`], writing +the struct to a provided [`bytes::BytesMut`]. The API version for the given message +matching the version specified in the request header must be provided. + +```rust +use bytes::BytesMut; +use kafka_protocol::messages::MetadataRequest; +use kafka_protocol::protocol::Encodable; + +let mut bytes = BytesMut::new(); +let request = MetadataRequest::default(); +request.encode(&mut bytes, 12).unwrap(); +``` + +### Deserialization + +Messages can be decoded using [`Decodobale`] and providing the matching API version from their +corresponding request. + +```rust +use bytes::Bytes; +use kafka_protocol::messages::ApiVersionsRequest; +use kafka_protocol::protocol::Decodable; + +let bytes: [u8; 25] = [ + 0x12, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2d, + 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2d, 0x6a, 0x61, + 0x76, 0x61, 0x06, 0x32, 0x2e, 0x38, 0x2e, 0x30, + 0x00 +]; + +let res = ApiVersionsRequest::decode(&mut Bytes::from(bytes.to_vec()), 3).unwrap(); +``` + +### Development Run `cargo run -p protocol_codegen` in the root path of this repo to generate/update the Rust codes via the latest Kafka protocol schema. diff --git a/protocol_codegen/Cargo.toml b/protocol_codegen/Cargo.toml index f262ce0..7b17d54 100644 --- a/protocol_codegen/Cargo.toml +++ b/protocol_codegen/Cargo.toml @@ -15,6 +15,6 @@ serde_plain = "0.3.0" parse-display = "0.1.1" json_comments = "0.2.0" assert-json-diff = "1.0.1" -git2 = "0.13" +git2 = "0.16" tempfile = "3.2.0" uuid = { version = "0.8.2", features = ["v4", "serde" ] } \ No newline at end of file diff --git a/protocol_codegen/src/generate_messages.rs b/protocol_codegen/src/generate_messages.rs index 76a216a..6490bfc 100644 --- a/protocol_codegen/src/generate_messages.rs +++ b/protocol_codegen/src/generate_messages.rs @@ -3,6 +3,7 @@ use std::io::Write; use std::collections::{BTreeSet, BTreeMap}; use failure::Error; +use git2::Oid; mod code_writer; pub mod expr; @@ -23,11 +24,21 @@ pub fn run() -> Result<(), Error> { // Download messages from head of Kafka repo println!("Cloning kafka repo"); - git2::build::RepoBuilder::new() + let repo = git2::build::RepoBuilder::new() .fetch_options(git2::FetchOptions::new()) .with_checkout(git2::build::CheckoutBuilder::new()) .clone("https://github.com/apache/kafka.git", &input_tmpdir.as_path())?; + // Checkout the release commit + // https://github.com/apache/kafka/releases/tag/3.3.2 + // checking out a tag with git2 is annoying -- we pin to the tag's commit sha instead + let release_commit = "b66af662e61082cb8def576ded1fe5cee37e155f"; + println!("Checking out release {}", release_commit); + let oid = Oid::from_str(release_commit).unwrap(); + let commit = repo.find_commit(oid).expect("Could not find release commit!").into_object(); + repo.checkout_tree(&commit, None).unwrap(); + repo.set_head_detached(commit.id()).unwrap(); + // Clear output directory for file in fs::read_dir(output_path)? { let file = file?; @@ -131,6 +142,7 @@ pub fn run() -> Result<(), Error> { writeln!(module_file)?; writeln!(module_file, "/// Wrapping enum for all requests in the Kafka protocol.")?; + writeln!(module_file, "#[non_exhaustive]")?; writeln!(module_file, "#[derive(Debug, Clone, PartialEq)]")?; writeln!(module_file, "pub enum RequestKind {{")?; for (_, request_type) in request_types.iter() { @@ -141,6 +153,7 @@ pub fn run() -> Result<(), Error> { writeln!(module_file)?; writeln!(module_file, "/// Wrapping enum for all responses in the Kafka protocol.")?; + writeln!(module_file, "#[non_exhaustive]")?; writeln!(module_file, "#[derive(Debug, Clone, PartialEq)]")?; writeln!(module_file, "pub enum ResponseKind {{")?; for (_, response_type) in response_types.iter() { diff --git a/protocol_codegen/src/generate_messages/generate.rs b/protocol_codegen/src/generate_messages/generate.rs index 7a026d7..0c03ea6 100644 --- a/protocol_codegen/src/generate_messages/generate.rs +++ b/protocol_codegen/src/generate_messages/generate.rs @@ -712,6 +712,7 @@ fn write_struct_def( } writeln!(w, "/// Valid versions: {}", valid_versions)?; + writeln!(w, "#[non_exhaustive]")?; writeln!(w, "#[derive(Debug, Clone, PartialEq, derive_builder::Builder)]")?; write!(w, "pub struct {} ", name)?; w.block(|w| { @@ -738,6 +739,21 @@ fn write_struct_def( writeln!(w)?; writeln!(w)?; + write!(w, "impl Builder for {} ", name)?; + w.block(|w| { + writeln!(w, "type Builder = {}Builder;", name)?; + writeln!(w)?; + write!(w, "fn builder() -> Self::Builder")?; + w.block(|w| { + writeln!(w, "{}Builder::default()", name)?; + Ok(()) + })?; + writeln!(w)?; + Ok(()) + })?; + writeln!(w)?; + writeln!(w)?; + if map_key.is_some() { write!(w, "impl MapEncodable for {} ", name)?; } else { @@ -887,7 +903,7 @@ fn write_file_header( writeln!(w)?; writeln!(w, "use crate::protocol::{{")?; writeln!(w, " Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange,")?; - writeln!(w, " types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{{ByteBuf, ByteBufMut}}")?; + writeln!(w, " types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{{ByteBuf, ByteBufMut}}, Builder")?; writeln!(w, "}};")?; writeln!(w)?; writeln!(w)?; diff --git a/src/messages.rs b/src/messages.rs index 29a4e26..84d4685 100644 --- a/src/messages.rs +++ b/src/messages.rs @@ -998,6 +998,7 @@ impl TryFrom for ApiKey { } /// Wrapping enum for all requests in the Kafka protocol. +#[non_exhaustive] #[derive(Debug, Clone, PartialEq)] pub enum RequestKind { /// ProduceRequest, @@ -1139,6 +1140,7 @@ pub enum RequestKind { } /// Wrapping enum for all responses in the Kafka protocol. +#[non_exhaustive] #[derive(Debug, Clone, PartialEq)] pub enum ResponseKind { /// ProduceResponse, diff --git a/src/messages/add_offsets_to_txn_request.rs b/src/messages/add_offsets_to_txn_request.rs index 02e68a8..03a4bf0 100644 --- a/src/messages/add_offsets_to_txn_request.rs +++ b/src/messages/add_offsets_to_txn_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AddOffsetsToTxnRequest { /// The transactional id corresponding to the transaction. @@ -44,6 +45,14 @@ pub struct AddOffsetsToTxnRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AddOffsetsToTxnRequest { + type Builder = AddOffsetsToTxnRequestBuilder; + + fn builder() -> Self::Builder{ + AddOffsetsToTxnRequestBuilder::default() + } +} + impl Encodable for AddOffsetsToTxnRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/add_offsets_to_txn_response.rs b/src/messages/add_offsets_to_txn_response.rs index f1df6aa..1001455 100644 --- a/src/messages/add_offsets_to_txn_response.rs +++ b/src/messages/add_offsets_to_txn_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AddOffsetsToTxnResponse { /// Duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -34,6 +35,14 @@ pub struct AddOffsetsToTxnResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AddOffsetsToTxnResponse { + type Builder = AddOffsetsToTxnResponseBuilder; + + fn builder() -> Self::Builder{ + AddOffsetsToTxnResponseBuilder::default() + } +} + impl Encodable for AddOffsetsToTxnResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/add_partitions_to_txn_request.rs b/src/messages/add_partitions_to_txn_request.rs index a5f728b..2a7090b 100644 --- a/src/messages/add_partitions_to_txn_request.rs +++ b/src/messages/add_partitions_to_txn_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AddPartitionsToTxnTopic { /// The partition indexes to add to the transaction @@ -29,6 +30,14 @@ pub struct AddPartitionsToTxnTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AddPartitionsToTxnTopic { + type Builder = AddPartitionsToTxnTopicBuilder; + + fn builder() -> Self::Builder{ + AddPartitionsToTxnTopicBuilder::default() + } +} + impl MapEncodable for AddPartitionsToTxnTopic { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -125,6 +134,7 @@ impl Message for AddPartitionsToTxnTopic { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AddPartitionsToTxnRequest { /// The transactional id corresponding to the transaction. @@ -151,6 +161,14 @@ pub struct AddPartitionsToTxnRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AddPartitionsToTxnRequest { + type Builder = AddPartitionsToTxnRequestBuilder; + + fn builder() -> Self::Builder{ + AddPartitionsToTxnRequestBuilder::default() + } +} + impl Encodable for AddPartitionsToTxnRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/add_partitions_to_txn_response.rs b/src/messages/add_partitions_to_txn_response.rs index 7f950cf..42bbc0b 100644 --- a/src/messages/add_partitions_to_txn_response.rs +++ b/src/messages/add_partitions_to_txn_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AddPartitionsToTxnPartitionResult { /// The response error code. @@ -29,6 +30,14 @@ pub struct AddPartitionsToTxnPartitionResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AddPartitionsToTxnPartitionResult { + type Builder = AddPartitionsToTxnPartitionResultBuilder; + + fn builder() -> Self::Builder{ + AddPartitionsToTxnPartitionResultBuilder::default() + } +} + impl MapEncodable for AddPartitionsToTxnPartitionResult { type Key = i32; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -101,6 +110,7 @@ impl Message for AddPartitionsToTxnPartitionResult { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AddPartitionsToTxnTopicResult { /// The results for each partition @@ -112,6 +122,14 @@ pub struct AddPartitionsToTxnTopicResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AddPartitionsToTxnTopicResult { + type Builder = AddPartitionsToTxnTopicResultBuilder; + + fn builder() -> Self::Builder{ + AddPartitionsToTxnTopicResultBuilder::default() + } +} + impl MapEncodable for AddPartitionsToTxnTopicResult { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -208,6 +226,7 @@ impl Message for AddPartitionsToTxnTopicResult { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AddPartitionsToTxnResponse { /// Duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -224,6 +243,14 @@ pub struct AddPartitionsToTxnResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AddPartitionsToTxnResponse { + type Builder = AddPartitionsToTxnResponseBuilder; + + fn builder() -> Self::Builder{ + AddPartitionsToTxnResponseBuilder::default() + } +} + impl Encodable for AddPartitionsToTxnResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/allocate_producer_ids_request.rs b/src/messages/allocate_producer_ids_request.rs index e27aed3..7ce60b6 100644 --- a/src/messages/allocate_producer_ids_request.rs +++ b/src/messages/allocate_producer_ids_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AllocateProducerIdsRequest { /// The ID of the requesting broker @@ -34,6 +35,14 @@ pub struct AllocateProducerIdsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AllocateProducerIdsRequest { + type Builder = AllocateProducerIdsRequestBuilder; + + fn builder() -> Self::Builder{ + AllocateProducerIdsRequestBuilder::default() + } +} + impl Encodable for AllocateProducerIdsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.broker_id)?; diff --git a/src/messages/allocate_producer_ids_response.rs b/src/messages/allocate_producer_ids_response.rs index ab6b863..0c4f789 100644 --- a/src/messages/allocate_producer_ids_response.rs +++ b/src/messages/allocate_producer_ids_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AllocateProducerIdsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -44,6 +45,14 @@ pub struct AllocateProducerIdsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AllocateProducerIdsResponse { + type Builder = AllocateProducerIdsResponseBuilder; + + fn builder() -> Self::Builder{ + AllocateProducerIdsResponseBuilder::default() + } +} + impl Encodable for AllocateProducerIdsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/alter_client_quotas_request.rs b/src/messages/alter_client_quotas_request.rs index 2007fc5..d07eb41 100644 --- a/src/messages/alter_client_quotas_request.rs +++ b/src/messages/alter_client_quotas_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EntityData { /// The entity type. @@ -34,6 +35,14 @@ pub struct EntityData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EntityData { + type Builder = EntityDataBuilder; + + fn builder() -> Self::Builder{ + EntityDataBuilder::default() + } +} + impl Encodable for EntityData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -130,6 +139,7 @@ impl Message for EntityData { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OpData { /// The quota configuration key. @@ -151,6 +161,14 @@ pub struct OpData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OpData { + type Builder = OpDataBuilder; + + fn builder() -> Self::Builder{ + OpDataBuilder::default() + } +} + impl Encodable for OpData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -240,6 +258,7 @@ impl Message for OpData { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EntryData { /// The quota entity to alter. @@ -256,6 +275,14 @@ pub struct EntryData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EntryData { + type Builder = EntryDataBuilder; + + fn builder() -> Self::Builder{ + EntryDataBuilder::default() + } +} + impl Encodable for EntryData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -352,6 +379,7 @@ impl Message for EntryData { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterClientQuotasRequest { /// The quota configuration entries to alter. @@ -368,6 +396,14 @@ pub struct AlterClientQuotasRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterClientQuotasRequest { + type Builder = AlterClientQuotasRequestBuilder; + + fn builder() -> Self::Builder{ + AlterClientQuotasRequestBuilder::default() + } +} + impl Encodable for AlterClientQuotasRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/alter_client_quotas_response.rs b/src/messages/alter_client_quotas_response.rs index cb2eac4..3d32ade 100644 --- a/src/messages/alter_client_quotas_response.rs +++ b/src/messages/alter_client_quotas_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EntityData { /// The entity type. @@ -34,6 +35,14 @@ pub struct EntityData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EntityData { + type Builder = EntityDataBuilder; + + fn builder() -> Self::Builder{ + EntityDataBuilder::default() + } +} + impl Encodable for EntityData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -130,6 +139,7 @@ impl Message for EntityData { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EntryData { /// The error code, or `0` if the quota alteration succeeded. @@ -151,6 +161,14 @@ pub struct EntryData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EntryData { + type Builder = EntryDataBuilder; + + fn builder() -> Self::Builder{ + EntryDataBuilder::default() + } +} + impl Encodable for EntryData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -252,6 +270,7 @@ impl Message for EntryData { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterClientQuotasResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -268,6 +287,14 @@ pub struct AlterClientQuotasResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterClientQuotasResponse { + type Builder = AlterClientQuotasResponseBuilder; + + fn builder() -> Self::Builder{ + AlterClientQuotasResponseBuilder::default() + } +} + impl Encodable for AlterClientQuotasResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/alter_configs_request.rs b/src/messages/alter_configs_request.rs index 146907f..962caab 100644 --- a/src/messages/alter_configs_request.rs +++ b/src/messages/alter_configs_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterableConfig { /// The value to set for the configuration key. @@ -29,6 +30,14 @@ pub struct AlterableConfig { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterableConfig { + type Builder = AlterableConfigBuilder; + + fn builder() -> Self::Builder{ + AlterableConfigBuilder::default() + } +} + impl MapEncodable for AlterableConfig { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -125,6 +134,7 @@ impl Message for AlterableConfig { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterConfigsResource { /// The resource type. @@ -146,6 +156,14 @@ pub struct AlterConfigsResource { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterConfigsResource { + type Builder = AlterConfigsResourceBuilder; + + fn builder() -> Self::Builder{ + AlterConfigsResourceBuilder::default() + } +} + impl Encodable for AlterConfigsResource { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int8.encode(buf, &self.resource_type)?; @@ -247,6 +265,7 @@ impl Message for AlterConfigsResource { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterConfigsRequest { /// The updates for each resource. @@ -263,6 +282,14 @@ pub struct AlterConfigsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterConfigsRequest { + type Builder = AlterConfigsRequestBuilder; + + fn builder() -> Self::Builder{ + AlterConfigsRequestBuilder::default() + } +} + impl Encodable for AlterConfigsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/alter_configs_response.rs b/src/messages/alter_configs_response.rs index d913d74..44f1951 100644 --- a/src/messages/alter_configs_response.rs +++ b/src/messages/alter_configs_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterConfigsResourceResponse { /// The resource error code. @@ -44,6 +45,14 @@ pub struct AlterConfigsResourceResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterConfigsResourceResponse { + type Builder = AlterConfigsResourceResponseBuilder; + + fn builder() -> Self::Builder{ + AlterConfigsResourceResponseBuilder::default() + } +} + impl Encodable for AlterConfigsResourceResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -150,6 +159,7 @@ impl Message for AlterConfigsResourceResponse { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterConfigsResponse { /// Duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -166,6 +176,14 @@ pub struct AlterConfigsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterConfigsResponse { + type Builder = AlterConfigsResponseBuilder; + + fn builder() -> Self::Builder{ + AlterConfigsResponseBuilder::default() + } +} + impl Encodable for AlterConfigsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/alter_partition_reassignments_request.rs b/src/messages/alter_partition_reassignments_request.rs index b6f233e..6f26e7f 100644 --- a/src/messages/alter_partition_reassignments_request.rs +++ b/src/messages/alter_partition_reassignments_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ReassignablePartition { /// The partition index. @@ -34,6 +35,14 @@ pub struct ReassignablePartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ReassignablePartition { + type Builder = ReassignablePartitionBuilder; + + fn builder() -> Self::Builder{ + ReassignablePartitionBuilder::default() + } +} + impl Encodable for ReassignablePartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -100,6 +109,7 @@ impl Message for ReassignablePartition { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ReassignableTopic { /// The topic name. @@ -116,6 +126,14 @@ pub struct ReassignableTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ReassignableTopic { + type Builder = ReassignableTopicBuilder; + + fn builder() -> Self::Builder{ + ReassignableTopicBuilder::default() + } +} + impl Encodable for ReassignableTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -182,6 +200,7 @@ impl Message for ReassignableTopic { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterPartitionReassignmentsRequest { /// The time in ms to wait for the request to complete. @@ -198,6 +217,14 @@ pub struct AlterPartitionReassignmentsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterPartitionReassignmentsRequest { + type Builder = AlterPartitionReassignmentsRequestBuilder; + + fn builder() -> Self::Builder{ + AlterPartitionReassignmentsRequestBuilder::default() + } +} + impl Encodable for AlterPartitionReassignmentsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.timeout_ms)?; diff --git a/src/messages/alter_partition_reassignments_response.rs b/src/messages/alter_partition_reassignments_response.rs index 2ea0d30..ffd356f 100644 --- a/src/messages/alter_partition_reassignments_response.rs +++ b/src/messages/alter_partition_reassignments_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ReassignablePartitionResponse { /// The partition index. @@ -39,6 +40,14 @@ pub struct ReassignablePartitionResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ReassignablePartitionResponse { + type Builder = ReassignablePartitionResponseBuilder; + + fn builder() -> Self::Builder{ + ReassignablePartitionResponseBuilder::default() + } +} + impl Encodable for ReassignablePartitionResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -110,6 +119,7 @@ impl Message for ReassignablePartitionResponse { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ReassignableTopicResponse { /// The topic name @@ -126,6 +136,14 @@ pub struct ReassignableTopicResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ReassignableTopicResponse { + type Builder = ReassignableTopicResponseBuilder; + + fn builder() -> Self::Builder{ + ReassignableTopicResponseBuilder::default() + } +} + impl Encodable for ReassignableTopicResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -192,6 +210,7 @@ impl Message for ReassignableTopicResponse { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterPartitionReassignmentsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -218,6 +237,14 @@ pub struct AlterPartitionReassignmentsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterPartitionReassignmentsResponse { + type Builder = AlterPartitionReassignmentsResponseBuilder; + + fn builder() -> Self::Builder{ + AlterPartitionReassignmentsResponseBuilder::default() + } +} + impl Encodable for AlterPartitionReassignmentsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/alter_partition_request.rs b/src/messages/alter_partition_request.rs index 3642d51..fd9d725 100644 --- a/src/messages/alter_partition_request.rs +++ b/src/messages/alter_partition_request.rs @@ -13,42 +13,51 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-1 +/// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub partition_index: i32, /// The leader epoch of this partition /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub leader_epoch: i32, /// The ISR for this partition /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub new_isr: Vec, /// 1 if the partition is recovering from an unclean leader election; 0 otherwise. /// - /// Supported API versions: 1 + /// Supported API versions: 1-2 pub leader_recovery_state: i8, /// The expected epoch of the partition which is being updated. For legacy cluster this is the ZkVersion in the LeaderAndIsr request. /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub partition_epoch: i32, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -142,29 +151,48 @@ impl Default for PartitionData { } impl Message for PartitionData { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; } -/// Valid versions: 0-1 +/// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The name of the topic to alter ISRs for /// /// Supported API versions: 0-1 - pub name: super::TopicName, + pub topic_name: super::TopicName, + /// The ID of the topic to alter ISRs for /// + /// Supported API versions: 2 + pub topic_id: Uuid, + /// - /// Supported API versions: 0-1 + /// + /// Supported API versions: 0-2 pub partitions: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { - types::CompactString.encode(buf, &self.name)?; + if version <= 1 { + types::CompactString.encode(buf, &self.topic_name)?; + } + if version >= 2 { + types::Uuid.encode(buf, &self.topic_id)?; + } types::CompactArray(types::Struct { version }).encode(buf, &self.partitions)?; let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { @@ -178,7 +206,12 @@ impl Encodable for TopicData { } fn compute_size(&self, version: i16) -> Result { let mut total_size = 0; - total_size += types::CompactString.compute_size(&self.name)?; + if version <= 1 { + total_size += types::CompactString.compute_size(&self.topic_name)?; + } + if version >= 2 { + total_size += types::Uuid.compute_size(&self.topic_id)?; + } total_size += types::CompactArray(types::Struct { version }).compute_size(&self.partitions)?; let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { @@ -194,7 +227,16 @@ impl Encodable for TopicData { impl Decodable for TopicData { fn decode(buf: &mut B, version: i16) -> Result { - let name = types::CompactString.decode(buf)?; + let topic_name = if version <= 1 { + types::CompactString.decode(buf)? + } else { + Default::default() + }; + let topic_id = if version >= 2 { + types::Uuid.decode(buf)? + } else { + Uuid::nil() + }; let partitions = types::CompactArray(types::Struct { version }).decode(buf)?; let mut unknown_tagged_fields = BTreeMap::new(); let num_tagged_fields = types::UnsignedVarInt.decode(buf)?; @@ -206,7 +248,8 @@ impl Decodable for TopicData { unknown_tagged_fields.insert(tag as i32, unknown_value); } Ok(Self { - name, + topic_name, + topic_id, partitions, unknown_tagged_fields, }) @@ -216,7 +259,8 @@ impl Decodable for TopicData { impl Default for TopicData { fn default() -> Self { Self { - name: Default::default(), + topic_name: Default::default(), + topic_id: Uuid::nil(), partitions: Default::default(), unknown_tagged_fields: BTreeMap::new(), } @@ -224,31 +268,40 @@ impl Default for TopicData { } impl Message for TopicData { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; } -/// Valid versions: 0-1 +/// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterPartitionRequest { /// The ID of the requesting broker /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub broker_id: super::BrokerId, /// The epoch of the requesting broker /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub broker_epoch: i64, /// /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub topics: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterPartitionRequest { + type Builder = AlterPartitionRequestBuilder; + + fn builder() -> Self::Builder{ + AlterPartitionRequestBuilder::default() + } +} + impl Encodable for AlterPartitionRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.broker_id)?; @@ -316,7 +369,7 @@ impl Default for AlterPartitionRequest { } impl Message for AlterPartitionRequest { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; } impl HeaderVersion for AlterPartitionRequest { diff --git a/src/messages/alter_partition_response.rs b/src/messages/alter_partition_response.rs index 9d4c06d..200d527 100644 --- a/src/messages/alter_partition_response.rs +++ b/src/messages/alter_partition_response.rs @@ -13,52 +13,61 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-1 +/// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub partition_index: i32, /// The partition level error code /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub error_code: i16, /// The broker ID of the leader. /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub leader_id: super::BrokerId, /// The leader epoch. /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub leader_epoch: i32, /// The in-sync replica IDs. /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub isr: Vec, /// 1 if the partition is recovering from an unclean leader election; 0 otherwise. /// - /// Supported API versions: 1 + /// Supported API versions: 1-2 pub leader_recovery_state: i8, /// The current epoch for the partition for KRaft controllers. The current ZK version for the legacy controllers. /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub partition_epoch: i32, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -154,29 +163,48 @@ impl Default for PartitionData { } impl Message for PartitionData { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; } -/// Valid versions: 0-1 +/// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The name of the topic /// /// Supported API versions: 0-1 - pub name: super::TopicName, + pub topic_name: super::TopicName, + /// The ID of the topic /// + /// Supported API versions: 2 + pub topic_id: Uuid, + /// - /// Supported API versions: 0-1 + /// + /// Supported API versions: 0-2 pub partitions: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { - types::CompactString.encode(buf, &self.name)?; + if version <= 1 { + types::CompactString.encode(buf, &self.topic_name)?; + } + if version >= 2 { + types::Uuid.encode(buf, &self.topic_id)?; + } types::CompactArray(types::Struct { version }).encode(buf, &self.partitions)?; let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { @@ -190,7 +218,12 @@ impl Encodable for TopicData { } fn compute_size(&self, version: i16) -> Result { let mut total_size = 0; - total_size += types::CompactString.compute_size(&self.name)?; + if version <= 1 { + total_size += types::CompactString.compute_size(&self.topic_name)?; + } + if version >= 2 { + total_size += types::Uuid.compute_size(&self.topic_id)?; + } total_size += types::CompactArray(types::Struct { version }).compute_size(&self.partitions)?; let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { @@ -206,7 +239,16 @@ impl Encodable for TopicData { impl Decodable for TopicData { fn decode(buf: &mut B, version: i16) -> Result { - let name = types::CompactString.decode(buf)?; + let topic_name = if version <= 1 { + types::CompactString.decode(buf)? + } else { + Default::default() + }; + let topic_id = if version >= 2 { + types::Uuid.decode(buf)? + } else { + Uuid::nil() + }; let partitions = types::CompactArray(types::Struct { version }).decode(buf)?; let mut unknown_tagged_fields = BTreeMap::new(); let num_tagged_fields = types::UnsignedVarInt.decode(buf)?; @@ -218,7 +260,8 @@ impl Decodable for TopicData { unknown_tagged_fields.insert(tag as i32, unknown_value); } Ok(Self { - name, + topic_name, + topic_id, partitions, unknown_tagged_fields, }) @@ -228,7 +271,8 @@ impl Decodable for TopicData { impl Default for TopicData { fn default() -> Self { Self { - name: Default::default(), + topic_name: Default::default(), + topic_id: Uuid::nil(), partitions: Default::default(), unknown_tagged_fields: BTreeMap::new(), } @@ -236,31 +280,40 @@ impl Default for TopicData { } impl Message for TopicData { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; } -/// Valid versions: 0-1 +/// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterPartitionResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub throttle_time_ms: i32, /// The top level response error code /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub error_code: i16, /// /// - /// Supported API versions: 0-1 + /// Supported API versions: 0-2 pub topics: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterPartitionResponse { + type Builder = AlterPartitionResponseBuilder; + + fn builder() -> Self::Builder{ + AlterPartitionResponseBuilder::default() + } +} + impl Encodable for AlterPartitionResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; @@ -328,7 +381,7 @@ impl Default for AlterPartitionResponse { } impl Message for AlterPartitionResponse { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; } impl HeaderVersion for AlterPartitionResponse { diff --git a/src/messages/alter_replica_log_dirs_request.rs b/src/messages/alter_replica_log_dirs_request.rs index e5b20b6..9ca0e59 100644 --- a/src/messages/alter_replica_log_dirs_request.rs +++ b/src/messages/alter_replica_log_dirs_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterReplicaLogDirTopic { /// The partition indexes. @@ -29,6 +30,14 @@ pub struct AlterReplicaLogDirTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterReplicaLogDirTopic { + type Builder = AlterReplicaLogDirTopicBuilder; + + fn builder() -> Self::Builder{ + AlterReplicaLogDirTopicBuilder::default() + } +} + impl MapEncodable for AlterReplicaLogDirTopic { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -125,6 +134,7 @@ impl Message for AlterReplicaLogDirTopic { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterReplicaLogDir { /// The topics to add to the directory. @@ -136,6 +146,14 @@ pub struct AlterReplicaLogDir { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterReplicaLogDir { + type Builder = AlterReplicaLogDirBuilder; + + fn builder() -> Self::Builder{ + AlterReplicaLogDirBuilder::default() + } +} + impl MapEncodable for AlterReplicaLogDir { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -232,6 +250,7 @@ impl Message for AlterReplicaLogDir { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterReplicaLogDirsRequest { /// The alterations to make for each directory. @@ -243,6 +262,14 @@ pub struct AlterReplicaLogDirsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterReplicaLogDirsRequest { + type Builder = AlterReplicaLogDirsRequestBuilder; + + fn builder() -> Self::Builder{ + AlterReplicaLogDirsRequestBuilder::default() + } +} + impl Encodable for AlterReplicaLogDirsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/alter_replica_log_dirs_response.rs b/src/messages/alter_replica_log_dirs_response.rs index ed34135..f16c928 100644 --- a/src/messages/alter_replica_log_dirs_response.rs +++ b/src/messages/alter_replica_log_dirs_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterReplicaLogDirPartitionResult { /// The partition index. @@ -34,6 +35,14 @@ pub struct AlterReplicaLogDirPartitionResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterReplicaLogDirPartitionResult { + type Builder = AlterReplicaLogDirPartitionResultBuilder; + + fn builder() -> Self::Builder{ + AlterReplicaLogDirPartitionResultBuilder::default() + } +} + impl Encodable for AlterReplicaLogDirPartitionResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -106,6 +115,7 @@ impl Message for AlterReplicaLogDirPartitionResult { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterReplicaLogDirTopicResult { /// The name of the topic. @@ -122,6 +132,14 @@ pub struct AlterReplicaLogDirTopicResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterReplicaLogDirTopicResult { + type Builder = AlterReplicaLogDirTopicResultBuilder; + + fn builder() -> Self::Builder{ + AlterReplicaLogDirTopicResultBuilder::default() + } +} + impl Encodable for AlterReplicaLogDirTopicResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -218,6 +236,7 @@ impl Message for AlterReplicaLogDirTopicResult { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterReplicaLogDirsResponse { /// Duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -234,6 +253,14 @@ pub struct AlterReplicaLogDirsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterReplicaLogDirsResponse { + type Builder = AlterReplicaLogDirsResponseBuilder; + + fn builder() -> Self::Builder{ + AlterReplicaLogDirsResponseBuilder::default() + } +} + impl Encodable for AlterReplicaLogDirsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/alter_user_scram_credentials_request.rs b/src/messages/alter_user_scram_credentials_request.rs index ef3fc2f..4f605be 100644 --- a/src/messages/alter_user_scram_credentials_request.rs +++ b/src/messages/alter_user_scram_credentials_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ScramCredentialDeletion { /// The user name. @@ -34,6 +35,14 @@ pub struct ScramCredentialDeletion { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ScramCredentialDeletion { + type Builder = ScramCredentialDeletionBuilder; + + fn builder() -> Self::Builder{ + ScramCredentialDeletionBuilder::default() + } +} + impl Encodable for ScramCredentialDeletion { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -100,6 +109,7 @@ impl Message for ScramCredentialDeletion { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ScramCredentialUpsertion { /// The user name. @@ -131,6 +141,14 @@ pub struct ScramCredentialUpsertion { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ScramCredentialUpsertion { + type Builder = ScramCredentialUpsertionBuilder; + + fn builder() -> Self::Builder{ + ScramCredentialUpsertionBuilder::default() + } +} + impl Encodable for ScramCredentialUpsertion { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -212,6 +230,7 @@ impl Message for ScramCredentialUpsertion { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterUserScramCredentialsRequest { /// The SCRAM credentials to remove. @@ -228,6 +247,14 @@ pub struct AlterUserScramCredentialsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterUserScramCredentialsRequest { + type Builder = AlterUserScramCredentialsRequestBuilder; + + fn builder() -> Self::Builder{ + AlterUserScramCredentialsRequestBuilder::default() + } +} + impl Encodable for AlterUserScramCredentialsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactArray(types::Struct { version }).encode(buf, &self.deletions)?; diff --git a/src/messages/alter_user_scram_credentials_response.rs b/src/messages/alter_user_scram_credentials_response.rs index 6ac44b6..af842e3 100644 --- a/src/messages/alter_user_scram_credentials_response.rs +++ b/src/messages/alter_user_scram_credentials_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterUserScramCredentialsResult { /// The user name. @@ -39,6 +40,14 @@ pub struct AlterUserScramCredentialsResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterUserScramCredentialsResult { + type Builder = AlterUserScramCredentialsResultBuilder; + + fn builder() -> Self::Builder{ + AlterUserScramCredentialsResultBuilder::default() + } +} + impl Encodable for AlterUserScramCredentialsResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.user)?; @@ -110,6 +119,7 @@ impl Message for AlterUserScramCredentialsResult { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterUserScramCredentialsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -126,6 +136,14 @@ pub struct AlterUserScramCredentialsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterUserScramCredentialsResponse { + type Builder = AlterUserScramCredentialsResponseBuilder; + + fn builder() -> Self::Builder{ + AlterUserScramCredentialsResponseBuilder::default() + } +} + impl Encodable for AlterUserScramCredentialsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/api_versions_request.rs b/src/messages/api_versions_request.rs index 2221607..1b25e84 100644 --- a/src/messages/api_versions_request.rs +++ b/src/messages/api_versions_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ApiVersionsRequest { /// The name of the client. @@ -34,6 +35,14 @@ pub struct ApiVersionsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ApiVersionsRequest { + type Builder = ApiVersionsRequestBuilder; + + fn builder() -> Self::Builder{ + ApiVersionsRequestBuilder::default() + } +} + impl Encodable for ApiVersionsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/api_versions_response.rs b/src/messages/api_versions_response.rs index 0030c93..c6c636b 100644 --- a/src/messages/api_versions_response.rs +++ b/src/messages/api_versions_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ApiVersion { /// The minimum supported version, inclusive. @@ -34,6 +35,14 @@ pub struct ApiVersion { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ApiVersion { + type Builder = ApiVersionBuilder; + + fn builder() -> Self::Builder{ + ApiVersionBuilder::default() + } +} + impl MapEncodable for ApiVersion { type Key = i16; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -111,6 +120,7 @@ impl Message for ApiVersion { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SupportedFeatureKey { /// The minimum supported version for the feature. @@ -127,6 +137,14 @@ pub struct SupportedFeatureKey { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SupportedFeatureKey { + type Builder = SupportedFeatureKeyBuilder; + + fn builder() -> Self::Builder{ + SupportedFeatureKeyBuilder::default() + } +} + impl MapEncodable for SupportedFeatureKey { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -252,6 +270,7 @@ impl Message for SupportedFeatureKey { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FinalizedFeatureKey { /// The cluster-wide finalized max version level for the feature. @@ -268,6 +287,14 @@ pub struct FinalizedFeatureKey { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FinalizedFeatureKey { + type Builder = FinalizedFeatureKeyBuilder; + + fn builder() -> Self::Builder{ + FinalizedFeatureKeyBuilder::default() + } +} + impl MapEncodable for FinalizedFeatureKey { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -393,6 +420,7 @@ impl Message for FinalizedFeatureKey { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ApiVersionsResponse { /// The top-level error code. @@ -429,6 +457,14 @@ pub struct ApiVersionsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ApiVersionsResponse { + type Builder = ApiVersionsResponseBuilder; + + fn builder() -> Self::Builder{ + ApiVersionsResponseBuilder::default() + } +} + impl Encodable for ApiVersionsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/begin_quorum_epoch_request.rs b/src/messages/begin_quorum_epoch_request.rs index 04356a7..034f1a1 100644 --- a/src/messages/begin_quorum_epoch_request.rs +++ b/src/messages/begin_quorum_epoch_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index. @@ -37,6 +38,14 @@ pub struct PartitionData { } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -83,6 +92,7 @@ impl Message for PartitionData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The topic name. @@ -97,6 +107,14 @@ pub struct TopicData { } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::String.encode(buf, &self.topic_name)?; @@ -138,6 +156,7 @@ impl Message for TopicData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct BeginQuorumEpochRequest { /// @@ -152,6 +171,14 @@ pub struct BeginQuorumEpochRequest { } +impl Builder for BeginQuorumEpochRequest { + type Builder = BeginQuorumEpochRequestBuilder; + + fn builder() -> Self::Builder{ + BeginQuorumEpochRequestBuilder::default() + } +} + impl Encodable for BeginQuorumEpochRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::String.encode(buf, &self.cluster_id)?; diff --git a/src/messages/begin_quorum_epoch_response.rs b/src/messages/begin_quorum_epoch_response.rs index a2a5834..924e4eb 100644 --- a/src/messages/begin_quorum_epoch_response.rs +++ b/src/messages/begin_quorum_epoch_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index. @@ -42,6 +43,14 @@ pub struct PartitionData { } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -93,6 +102,7 @@ impl Message for PartitionData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The topic name. @@ -107,6 +117,14 @@ pub struct TopicData { } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::String.encode(buf, &self.topic_name)?; @@ -148,6 +166,7 @@ impl Message for TopicData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct BeginQuorumEpochResponse { /// The top level error code. @@ -162,6 +181,14 @@ pub struct BeginQuorumEpochResponse { } +impl Builder for BeginQuorumEpochResponse { + type Builder = BeginQuorumEpochResponseBuilder; + + fn builder() -> Self::Builder{ + BeginQuorumEpochResponseBuilder::default() + } +} + impl Encodable for BeginQuorumEpochResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/broker_heartbeat_request.rs b/src/messages/broker_heartbeat_request.rs index 77a205c..2a611ae 100644 --- a/src/messages/broker_heartbeat_request.rs +++ b/src/messages/broker_heartbeat_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct BrokerHeartbeatRequest { /// The broker ID. @@ -49,6 +50,14 @@ pub struct BrokerHeartbeatRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for BrokerHeartbeatRequest { + type Builder = BrokerHeartbeatRequestBuilder; + + fn builder() -> Self::Builder{ + BrokerHeartbeatRequestBuilder::default() + } +} + impl Encodable for BrokerHeartbeatRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.broker_id)?; diff --git a/src/messages/broker_heartbeat_response.rs b/src/messages/broker_heartbeat_response.rs index 526a82a..fa5905d 100644 --- a/src/messages/broker_heartbeat_response.rs +++ b/src/messages/broker_heartbeat_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct BrokerHeartbeatResponse { /// Duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -49,6 +50,14 @@ pub struct BrokerHeartbeatResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for BrokerHeartbeatResponse { + type Builder = BrokerHeartbeatResponseBuilder; + + fn builder() -> Self::Builder{ + BrokerHeartbeatResponseBuilder::default() + } +} + impl Encodable for BrokerHeartbeatResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/broker_registration_request.rs b/src/messages/broker_registration_request.rs index 45ac6f3..8b9e914 100644 --- a/src/messages/broker_registration_request.rs +++ b/src/messages/broker_registration_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct Listener { /// The hostname. @@ -39,6 +40,14 @@ pub struct Listener { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for Listener { + type Builder = ListenerBuilder; + + fn builder() -> Self::Builder{ + ListenerBuilder::default() + } +} + impl MapEncodable for Listener { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -115,6 +124,7 @@ impl Message for Listener { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct Feature { /// The minimum supported feature level. @@ -131,6 +141,14 @@ pub struct Feature { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for Feature { + type Builder = FeatureBuilder; + + fn builder() -> Self::Builder{ + FeatureBuilder::default() + } +} + impl MapEncodable for Feature { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -202,6 +220,7 @@ impl Message for Feature { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct BrokerRegistrationRequest { /// The broker ID. @@ -238,6 +257,14 @@ pub struct BrokerRegistrationRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for BrokerRegistrationRequest { + type Builder = BrokerRegistrationRequestBuilder; + + fn builder() -> Self::Builder{ + BrokerRegistrationRequestBuilder::default() + } +} + impl Encodable for BrokerRegistrationRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.broker_id)?; diff --git a/src/messages/broker_registration_response.rs b/src/messages/broker_registration_response.rs index b5d5601..64aca54 100644 --- a/src/messages/broker_registration_response.rs +++ b/src/messages/broker_registration_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct BrokerRegistrationResponse { /// Duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -39,6 +40,14 @@ pub struct BrokerRegistrationResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for BrokerRegistrationResponse { + type Builder = BrokerRegistrationResponseBuilder; + + fn builder() -> Self::Builder{ + BrokerRegistrationResponseBuilder::default() + } +} + impl Encodable for BrokerRegistrationResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/consumer_protocol_assignment.rs b/src/messages/consumer_protocol_assignment.rs index bf84ab8..6382ec8 100644 --- a/src/messages/consumer_protocol_assignment.rs +++ b/src/messages/consumer_protocol_assignment.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicPartition { /// @@ -27,6 +28,14 @@ pub struct TopicPartition { } +impl Builder for TopicPartition { + type Builder = TopicPartitionBuilder; + + fn builder() -> Self::Builder{ + TopicPartitionBuilder::default() + } +} + impl MapEncodable for TopicPartition { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -68,6 +77,7 @@ impl Message for TopicPartition { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ConsumerProtocolAssignment { /// @@ -82,6 +92,14 @@ pub struct ConsumerProtocolAssignment { } +impl Builder for ConsumerProtocolAssignment { + type Builder = ConsumerProtocolAssignmentBuilder; + + fn builder() -> Self::Builder{ + ConsumerProtocolAssignmentBuilder::default() + } +} + impl Encodable for ConsumerProtocolAssignment { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Array(types::Struct { version }).encode(buf, &self.assigned_partitions)?; diff --git a/src/messages/consumer_protocol_subscription.rs b/src/messages/consumer_protocol_subscription.rs index 5979418..19c65d8 100644 --- a/src/messages/consumer_protocol_subscription.rs +++ b/src/messages/consumer_protocol_subscription.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicPartition { /// @@ -27,6 +28,14 @@ pub struct TopicPartition { } +impl Builder for TopicPartition { + type Builder = TopicPartitionBuilder; + + fn builder() -> Self::Builder{ + TopicPartitionBuilder::default() + } +} + impl MapEncodable for TopicPartition { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -100,6 +109,7 @@ impl Message for TopicPartition { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ConsumerProtocolSubscription { /// @@ -119,6 +129,14 @@ pub struct ConsumerProtocolSubscription { } +impl Builder for ConsumerProtocolSubscription { + type Builder = ConsumerProtocolSubscriptionBuilder; + + fn builder() -> Self::Builder{ + ConsumerProtocolSubscriptionBuilder::default() + } +} + impl Encodable for ConsumerProtocolSubscription { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Array(types::String).encode(buf, &self.topics)?; diff --git a/src/messages/controlled_shutdown_request.rs b/src/messages/controlled_shutdown_request.rs index 5916d94..3b675f0 100644 --- a/src/messages/controlled_shutdown_request.rs +++ b/src/messages/controlled_shutdown_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ControlledShutdownRequest { /// The id of the broker for which controlled shutdown has been requested. @@ -34,6 +35,14 @@ pub struct ControlledShutdownRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ControlledShutdownRequest { + type Builder = ControlledShutdownRequestBuilder; + + fn builder() -> Self::Builder{ + ControlledShutdownRequestBuilder::default() + } +} + impl Encodable for ControlledShutdownRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.broker_id)?; diff --git a/src/messages/controlled_shutdown_response.rs b/src/messages/controlled_shutdown_response.rs index db6496f..d84c5b4 100644 --- a/src/messages/controlled_shutdown_response.rs +++ b/src/messages/controlled_shutdown_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct RemainingPartition { /// The name of the topic. @@ -34,6 +35,14 @@ pub struct RemainingPartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for RemainingPartition { + type Builder = RemainingPartitionBuilder; + + fn builder() -> Self::Builder{ + RemainingPartitionBuilder::default() + } +} + impl Encodable for RemainingPartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { @@ -118,6 +127,7 @@ impl Message for RemainingPartition { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ControlledShutdownResponse { /// The top-level error code. @@ -134,6 +144,14 @@ pub struct ControlledShutdownResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ControlledShutdownResponse { + type Builder = ControlledShutdownResponseBuilder; + + fn builder() -> Self::Builder{ + ControlledShutdownResponseBuilder::default() + } +} + impl Encodable for ControlledShutdownResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/create_acls_request.rs b/src/messages/create_acls_request.rs index ed9a4b7..578fe48 100644 --- a/src/messages/create_acls_request.rs +++ b/src/messages/create_acls_request.rs @@ -13,52 +13,61 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AclCreation { /// The type of the resource. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_type: i8, /// The resource name for the ACL. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_name: StrBytes, /// The pattern type for the ACL. /// - /// Supported API versions: 1-2 + /// Supported API versions: 1-3 pub resource_pattern_type: i8, /// The principal for the ACL. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal: StrBytes, /// The host for the ACL. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub host: StrBytes, /// The operation type for the ACL (read, write, etc.). /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub operation: i8, /// The permission type for the ACL (allow, deny, etc.). /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub permission_type: i8, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AclCreation { + type Builder = AclCreationBuilder; + + fn builder() -> Self::Builder{ + AclCreationBuilder::default() + } +} + impl Encodable for AclCreation { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int8.encode(buf, &self.resource_type)?; @@ -204,21 +213,30 @@ impl Default for AclCreation { } impl Message for AclCreation { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreateAclsRequest { /// The ACLs that we want to create. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub creations: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreateAclsRequest { + type Builder = CreateAclsRequestBuilder; + + fn builder() -> Self::Builder{ + CreateAclsRequestBuilder::default() + } +} + impl Encodable for CreateAclsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -294,7 +312,7 @@ impl Default for CreateAclsRequest { } impl Message for CreateAclsRequest { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for CreateAclsRequest { diff --git a/src/messages/create_acls_response.rs b/src/messages/create_acls_response.rs index ab9e56a..0102248 100644 --- a/src/messages/create_acls_response.rs +++ b/src/messages/create_acls_response.rs @@ -13,27 +13,36 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AclCreationResult { /// The result error, or zero if there was no error. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_code: i16, /// The result message, or null if there was no error. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_message: Option, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AclCreationResult { + type Builder = AclCreationResultBuilder; + + fn builder() -> Self::Builder{ + AclCreationResultBuilder::default() + } +} + impl Encodable for AclCreationResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -114,26 +123,35 @@ impl Default for AclCreationResult { } impl Message for AclCreationResult { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreateAclsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub throttle_time_ms: i32, /// The results for each ACL creation. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub results: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreateAclsResponse { + type Builder = CreateAclsResponseBuilder; + + fn builder() -> Self::Builder{ + CreateAclsResponseBuilder::default() + } +} + impl Encodable for CreateAclsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; @@ -214,7 +232,7 @@ impl Default for CreateAclsResponse { } impl Message for CreateAclsResponse { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for CreateAclsResponse { diff --git a/src/messages/create_delegation_token_request.rs b/src/messages/create_delegation_token_request.rs index 103843b..443a9a5 100644 --- a/src/messages/create_delegation_token_request.rs +++ b/src/messages/create_delegation_token_request.rs @@ -13,27 +13,36 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatableRenewers { /// The type of the Kafka principal. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_type: StrBytes, /// The name of the Kafka principal. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_name: StrBytes, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatableRenewers { + type Builder = CreatableRenewersBuilder; + + fn builder() -> Self::Builder{ + CreatableRenewersBuilder::default() + } +} + impl Encodable for CreatableRenewers { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -126,28 +135,61 @@ impl Default for CreatableRenewers { } impl Message for CreatableRenewers { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreateDelegationTokenRequest { + /// The principal type of the owner of the token. If it's null it defaults to the token request principal. + /// + /// Supported API versions: 3 + pub owner_principal_type: Option, + + /// The principal name of the owner of the token. If it's null it defaults to the token request principal. + /// + /// Supported API versions: 3 + pub owner_principal_name: Option, + /// A list of those who are allowed to renew this token before it expires. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub renewers: Vec, /// The maximum lifetime of the token in milliseconds, or -1 to use the server side default. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub max_lifetime_ms: i64, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreateDelegationTokenRequest { + type Builder = CreateDelegationTokenRequestBuilder; + + fn builder() -> Self::Builder{ + CreateDelegationTokenRequestBuilder::default() + } +} + impl Encodable for CreateDelegationTokenRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { + if version >= 3 { + types::CompactString.encode(buf, &self.owner_principal_type)?; + } else { + if !self.owner_principal_type.as_ref().map(|x| x.is_empty()).unwrap_or_default() { + return Err(EncodeError) + } + } + if version >= 3 { + types::CompactString.encode(buf, &self.owner_principal_name)?; + } else { + if !self.owner_principal_name.as_ref().map(|x| x.is_empty()).unwrap_or_default() { + return Err(EncodeError) + } + } if version >= 2 { types::CompactArray(types::Struct { version }).encode(buf, &self.renewers)?; } else { @@ -168,6 +210,20 @@ impl Encodable for CreateDelegationTokenRequest { } fn compute_size(&self, version: i16) -> Result { let mut total_size = 0; + if version >= 3 { + total_size += types::CompactString.compute_size(&self.owner_principal_type)?; + } else { + if !self.owner_principal_type.as_ref().map(|x| x.is_empty()).unwrap_or_default() { + return Err(EncodeError) + } + } + if version >= 3 { + total_size += types::CompactString.compute_size(&self.owner_principal_name)?; + } else { + if !self.owner_principal_name.as_ref().map(|x| x.is_empty()).unwrap_or_default() { + return Err(EncodeError) + } + } if version >= 2 { total_size += types::CompactArray(types::Struct { version }).compute_size(&self.renewers)?; } else { @@ -190,6 +246,16 @@ impl Encodable for CreateDelegationTokenRequest { impl Decodable for CreateDelegationTokenRequest { fn decode(buf: &mut B, version: i16) -> Result { + let owner_principal_type = if version >= 3 { + types::CompactString.decode(buf)? + } else { + Some(Default::default()) + }; + let owner_principal_name = if version >= 3 { + types::CompactString.decode(buf)? + } else { + Some(Default::default()) + }; let renewers = if version >= 2 { types::CompactArray(types::Struct { version }).decode(buf)? } else { @@ -208,6 +274,8 @@ impl Decodable for CreateDelegationTokenRequest { } } Ok(Self { + owner_principal_type, + owner_principal_name, renewers, max_lifetime_ms, unknown_tagged_fields, @@ -218,6 +286,8 @@ impl Decodable for CreateDelegationTokenRequest { impl Default for CreateDelegationTokenRequest { fn default() -> Self { Self { + owner_principal_type: Some(Default::default()), + owner_principal_name: Some(Default::default()), renewers: Default::default(), max_lifetime_ms: 0, unknown_tagged_fields: BTreeMap::new(), @@ -226,7 +296,7 @@ impl Default for CreateDelegationTokenRequest { } impl Message for CreateDelegationTokenRequest { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for CreateDelegationTokenRequest { diff --git a/src/messages/create_delegation_token_response.rs b/src/messages/create_delegation_token_response.rs index ab92cfe..c39577d 100644 --- a/src/messages/create_delegation_token_response.rs +++ b/src/messages/create_delegation_token_response.rs @@ -13,62 +13,81 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreateDelegationTokenResponse { /// The top-level error, or zero if there was no error. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_code: i16, /// The principal type of the token owner. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_type: StrBytes, /// The name of the token owner. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_name: StrBytes, + /// The principal type of the requester of the token. + /// + /// Supported API versions: 3 + pub token_requester_principal_type: StrBytes, + + /// The principal type of the requester of the token. + /// + /// Supported API versions: 3 + pub token_requester_principal_name: StrBytes, + /// When this token was generated. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub issue_timestamp_ms: i64, /// When this token expires. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub expiry_timestamp_ms: i64, /// The maximum lifetime of this token. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub max_timestamp_ms: i64, /// The token UUID. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub token_id: StrBytes, /// HMAC of the delegation token. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub hmac: Bytes, /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub throttle_time_ms: i32, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreateDelegationTokenResponse { + type Builder = CreateDelegationTokenResponseBuilder; + + fn builder() -> Self::Builder{ + CreateDelegationTokenResponseBuilder::default() + } +} + impl Encodable for CreateDelegationTokenResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -82,6 +101,20 @@ impl Encodable for CreateDelegationTokenResponse { } else { types::String.encode(buf, &self.principal_name)?; } + if version >= 3 { + types::CompactString.encode(buf, &self.token_requester_principal_type)?; + } else { + if !self.token_requester_principal_type.is_empty() { + return Err(EncodeError) + } + } + if version >= 3 { + types::CompactString.encode(buf, &self.token_requester_principal_name)?; + } else { + if !self.token_requester_principal_name.is_empty() { + return Err(EncodeError) + } + } types::Int64.encode(buf, &self.issue_timestamp_ms)?; types::Int64.encode(buf, &self.expiry_timestamp_ms)?; types::Int64.encode(buf, &self.max_timestamp_ms)?; @@ -121,6 +154,20 @@ impl Encodable for CreateDelegationTokenResponse { } else { total_size += types::String.compute_size(&self.principal_name)?; } + if version >= 3 { + total_size += types::CompactString.compute_size(&self.token_requester_principal_type)?; + } else { + if !self.token_requester_principal_type.is_empty() { + return Err(EncodeError) + } + } + if version >= 3 { + total_size += types::CompactString.compute_size(&self.token_requester_principal_name)?; + } else { + if !self.token_requester_principal_name.is_empty() { + return Err(EncodeError) + } + } total_size += types::Int64.compute_size(&self.issue_timestamp_ms)?; total_size += types::Int64.compute_size(&self.expiry_timestamp_ms)?; total_size += types::Int64.compute_size(&self.max_timestamp_ms)?; @@ -162,6 +209,16 @@ impl Decodable for CreateDelegationTokenResponse { } else { types::String.decode(buf)? }; + let token_requester_principal_type = if version >= 3 { + types::CompactString.decode(buf)? + } else { + Default::default() + }; + let token_requester_principal_name = if version >= 3 { + types::CompactString.decode(buf)? + } else { + Default::default() + }; let issue_timestamp_ms = types::Int64.decode(buf)?; let expiry_timestamp_ms = types::Int64.decode(buf)?; let max_timestamp_ms = types::Int64.decode(buf)?; @@ -191,6 +248,8 @@ impl Decodable for CreateDelegationTokenResponse { error_code, principal_type, principal_name, + token_requester_principal_type, + token_requester_principal_name, issue_timestamp_ms, expiry_timestamp_ms, max_timestamp_ms, @@ -208,6 +267,8 @@ impl Default for CreateDelegationTokenResponse { error_code: 0, principal_type: Default::default(), principal_name: Default::default(), + token_requester_principal_type: Default::default(), + token_requester_principal_name: Default::default(), issue_timestamp_ms: 0, expiry_timestamp_ms: 0, max_timestamp_ms: 0, @@ -220,7 +281,7 @@ impl Default for CreateDelegationTokenResponse { } impl Message for CreateDelegationTokenResponse { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for CreateDelegationTokenResponse { diff --git a/src/messages/create_partitions_request.rs b/src/messages/create_partitions_request.rs index 1f3e4cd..df24318 100644 --- a/src/messages/create_partitions_request.rs +++ b/src/messages/create_partitions_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatePartitionsAssignment { /// The assigned broker IDs. @@ -29,6 +30,14 @@ pub struct CreatePartitionsAssignment { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatePartitionsAssignment { + type Builder = CreatePartitionsAssignmentBuilder; + + fn builder() -> Self::Builder{ + CreatePartitionsAssignmentBuilder::default() + } +} + impl Encodable for CreatePartitionsAssignment { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -108,6 +117,7 @@ impl Message for CreatePartitionsAssignment { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatePartitionsTopic { /// The new partition count. @@ -124,6 +134,14 @@ pub struct CreatePartitionsTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatePartitionsTopic { + type Builder = CreatePartitionsTopicBuilder; + + fn builder() -> Self::Builder{ + CreatePartitionsTopicBuilder::default() + } +} + impl MapEncodable for CreatePartitionsTopic { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -225,6 +243,7 @@ impl Message for CreatePartitionsTopic { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatePartitionsRequest { /// Each topic that we want to create new partitions inside. @@ -246,6 +265,14 @@ pub struct CreatePartitionsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatePartitionsRequest { + type Builder = CreatePartitionsRequestBuilder; + + fn builder() -> Self::Builder{ + CreatePartitionsRequestBuilder::default() + } +} + impl Encodable for CreatePartitionsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/create_partitions_response.rs b/src/messages/create_partitions_response.rs index 13253dd..e3b9aa3 100644 --- a/src/messages/create_partitions_response.rs +++ b/src/messages/create_partitions_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatePartitionsTopicResult { /// The topic name. @@ -39,6 +40,14 @@ pub struct CreatePartitionsTopicResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatePartitionsTopicResult { + type Builder = CreatePartitionsTopicResultBuilder; + + fn builder() -> Self::Builder{ + CreatePartitionsTopicResultBuilder::default() + } +} + impl Encodable for CreatePartitionsTopicResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -140,6 +149,7 @@ impl Message for CreatePartitionsTopicResult { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatePartitionsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -156,6 +166,14 @@ pub struct CreatePartitionsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatePartitionsResponse { + type Builder = CreatePartitionsResponseBuilder; + + fn builder() -> Self::Builder{ + CreatePartitionsResponseBuilder::default() + } +} + impl Encodable for CreatePartitionsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/create_topics_request.rs b/src/messages/create_topics_request.rs index fe5e771..f7f7668 100644 --- a/src/messages/create_topics_request.rs +++ b/src/messages/create_topics_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatableReplicaAssignment { /// The brokers to place the partition on. @@ -29,6 +30,14 @@ pub struct CreatableReplicaAssignment { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatableReplicaAssignment { + type Builder = CreatableReplicaAssignmentBuilder; + + fn builder() -> Self::Builder{ + CreatableReplicaAssignmentBuilder::default() + } +} + impl MapEncodable for CreatableReplicaAssignment { type Key = i32; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -113,6 +122,7 @@ impl Message for CreatableReplicaAssignment { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreateableTopicConfig { /// The configuration value. @@ -124,6 +134,14 @@ pub struct CreateableTopicConfig { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreateableTopicConfig { + type Builder = CreateableTopicConfigBuilder; + + fn builder() -> Self::Builder{ + CreateableTopicConfigBuilder::default() + } +} + impl MapEncodable for CreateableTopicConfig { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -220,6 +238,7 @@ impl Message for CreateableTopicConfig { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatableTopic { /// The number of partitions to create in the topic, or -1 if we are either specifying a manual partition assignment or using the default partitions. @@ -246,6 +265,14 @@ pub struct CreatableTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatableTopic { + type Builder = CreatableTopicBuilder; + + fn builder() -> Self::Builder{ + CreatableTopicBuilder::default() + } +} + impl MapEncodable for CreatableTopic { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -369,6 +396,7 @@ impl Message for CreatableTopic { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreateTopicsRequest { /// The topics to create. @@ -390,6 +418,14 @@ pub struct CreateTopicsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreateTopicsRequest { + type Builder = CreateTopicsRequestBuilder; + + fn builder() -> Self::Builder{ + CreateTopicsRequestBuilder::default() + } +} + impl Encodable for CreateTopicsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 5 { diff --git a/src/messages/create_topics_response.rs b/src/messages/create_topics_response.rs index b37cdc1..edd6f70 100644 --- a/src/messages/create_topics_response.rs +++ b/src/messages/create_topics_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatableTopicConfigs { /// The configuration name. @@ -49,6 +50,14 @@ pub struct CreatableTopicConfigs { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatableTopicConfigs { + type Builder = CreatableTopicConfigsBuilder; + + fn builder() -> Self::Builder{ + CreatableTopicConfigsBuilder::default() + } +} + impl Encodable for CreatableTopicConfigs { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 5 { @@ -208,6 +217,7 @@ impl Message for CreatableTopicConfigs { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreatableTopicResult { /// The unique topic ID @@ -249,6 +259,14 @@ pub struct CreatableTopicResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreatableTopicResult { + type Builder = CreatableTopicResultBuilder; + + fn builder() -> Self::Builder{ + CreatableTopicResultBuilder::default() + } +} + impl MapEncodable for CreatableTopicResult { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -446,6 +464,7 @@ impl Message for CreatableTopicResult { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CreateTopicsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -462,6 +481,14 @@ pub struct CreateTopicsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CreateTopicsResponse { + type Builder = CreateTopicsResponseBuilder; + + fn builder() -> Self::Builder{ + CreateTopicsResponseBuilder::default() + } +} + impl Encodable for CreateTopicsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/default_principal_data.rs b/src/messages/default_principal_data.rs index d52f460..4a35d17 100644 --- a/src/messages/default_principal_data.rs +++ b/src/messages/default_principal_data.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DefaultPrincipalData { /// The principal type @@ -39,6 +40,14 @@ pub struct DefaultPrincipalData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DefaultPrincipalData { + type Builder = DefaultPrincipalDataBuilder; + + fn builder() -> Self::Builder{ + DefaultPrincipalDataBuilder::default() + } +} + impl Encodable for DefaultPrincipalData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self._type)?; diff --git a/src/messages/delete_acls_request.rs b/src/messages/delete_acls_request.rs index b2b393e..c0d67ac 100644 --- a/src/messages/delete_acls_request.rs +++ b/src/messages/delete_acls_request.rs @@ -13,52 +13,61 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteAclsFilter { /// The resource type. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_type_filter: i8, /// The resource name. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_name_filter: Option, /// The pattern type. /// - /// Supported API versions: 1-2 + /// Supported API versions: 1-3 pub pattern_type_filter: i8, /// The principal filter, or null to accept all principals. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_filter: Option, /// The host filter, or null to accept all hosts. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub host_filter: Option, /// The ACL operation. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub operation: i8, /// The permission type. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub permission_type: i8, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteAclsFilter { + type Builder = DeleteAclsFilterBuilder; + + fn builder() -> Self::Builder{ + DeleteAclsFilterBuilder::default() + } +} + impl Encodable for DeleteAclsFilter { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int8.encode(buf, &self.resource_type_filter)?; @@ -204,21 +213,30 @@ impl Default for DeleteAclsFilter { } impl Message for DeleteAclsFilter { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteAclsRequest { /// The filters to use when deleting ACLs. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub filters: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteAclsRequest { + type Builder = DeleteAclsRequestBuilder; + + fn builder() -> Self::Builder{ + DeleteAclsRequestBuilder::default() + } +} + impl Encodable for DeleteAclsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -294,7 +312,7 @@ impl Default for DeleteAclsRequest { } impl Message for DeleteAclsRequest { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for DeleteAclsRequest { diff --git a/src/messages/delete_acls_response.rs b/src/messages/delete_acls_response.rs index 991224f..406230a 100644 --- a/src/messages/delete_acls_response.rs +++ b/src/messages/delete_acls_response.rs @@ -13,62 +13,71 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteAclsMatchingAcl { /// The deletion error code, or 0 if the deletion succeeded. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_code: i16, /// The deletion error message, or null if the deletion succeeded. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_message: Option, /// The ACL resource type. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_type: i8, /// The ACL resource name. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_name: StrBytes, /// The ACL resource pattern type. /// - /// Supported API versions: 1-2 + /// Supported API versions: 1-3 pub pattern_type: i8, /// The ACL principal. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal: StrBytes, /// The ACL host. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub host: StrBytes, /// The ACL operation. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub operation: i8, /// The ACL permission type. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub permission_type: i8, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteAclsMatchingAcl { + type Builder = DeleteAclsMatchingAclBuilder; + + fn builder() -> Self::Builder{ + DeleteAclsMatchingAclBuilder::default() + } +} + impl Encodable for DeleteAclsMatchingAcl { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -236,31 +245,40 @@ impl Default for DeleteAclsMatchingAcl { } impl Message for DeleteAclsMatchingAcl { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteAclsFilterResult { /// The error code, or 0 if the filter succeeded. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_code: i16, /// The error message, or null if the filter succeeded. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_message: Option, /// The ACLs which matched this filter. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub matching_acls: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteAclsFilterResult { + type Builder = DeleteAclsFilterResultBuilder; + + fn builder() -> Self::Builder{ + DeleteAclsFilterResultBuilder::default() + } +} + impl Encodable for DeleteAclsFilterResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -358,26 +376,35 @@ impl Default for DeleteAclsFilterResult { } impl Message for DeleteAclsFilterResult { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteAclsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub throttle_time_ms: i32, /// The results for each filter. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub filter_results: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteAclsResponse { + type Builder = DeleteAclsResponseBuilder; + + fn builder() -> Self::Builder{ + DeleteAclsResponseBuilder::default() + } +} + impl Encodable for DeleteAclsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; @@ -458,7 +485,7 @@ impl Default for DeleteAclsResponse { } impl Message for DeleteAclsResponse { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for DeleteAclsResponse { diff --git a/src/messages/delete_groups_request.rs b/src/messages/delete_groups_request.rs index f54d946..2219ed3 100644 --- a/src/messages/delete_groups_request.rs +++ b/src/messages/delete_groups_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteGroupsRequest { /// The group names to delete. @@ -29,6 +30,14 @@ pub struct DeleteGroupsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteGroupsRequest { + type Builder = DeleteGroupsRequestBuilder; + + fn builder() -> Self::Builder{ + DeleteGroupsRequestBuilder::default() + } +} + impl Encodable for DeleteGroupsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/delete_groups_response.rs b/src/messages/delete_groups_response.rs index 44e6f14..8d4df1f 100644 --- a/src/messages/delete_groups_response.rs +++ b/src/messages/delete_groups_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeletableGroupResult { /// The deletion error, or 0 if the deletion succeeded. @@ -29,6 +30,14 @@ pub struct DeletableGroupResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeletableGroupResult { + type Builder = DeletableGroupResultBuilder; + + fn builder() -> Self::Builder{ + DeletableGroupResultBuilder::default() + } +} + impl MapEncodable for DeletableGroupResult { type Key = super::GroupId; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -113,6 +122,7 @@ impl Message for DeletableGroupResult { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteGroupsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -129,6 +139,14 @@ pub struct DeleteGroupsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteGroupsResponse { + type Builder = DeleteGroupsResponseBuilder; + + fn builder() -> Self::Builder{ + DeleteGroupsResponseBuilder::default() + } +} + impl Encodable for DeleteGroupsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/delete_records_request.rs b/src/messages/delete_records_request.rs index bc20286..6cd9f90 100644 --- a/src/messages/delete_records_request.rs +++ b/src/messages/delete_records_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteRecordsPartition { /// The partition index. @@ -34,6 +35,14 @@ pub struct DeleteRecordsPartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteRecordsPartition { + type Builder = DeleteRecordsPartitionBuilder; + + fn builder() -> Self::Builder{ + DeleteRecordsPartitionBuilder::default() + } +} + impl Encodable for DeleteRecordsPartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -106,6 +115,7 @@ impl Message for DeleteRecordsPartition { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteRecordsTopic { /// The topic name. @@ -122,6 +132,14 @@ pub struct DeleteRecordsTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteRecordsTopic { + type Builder = DeleteRecordsTopicBuilder; + + fn builder() -> Self::Builder{ + DeleteRecordsTopicBuilder::default() + } +} + impl Encodable for DeleteRecordsTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -218,6 +236,7 @@ impl Message for DeleteRecordsTopic { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteRecordsRequest { /// Each topic that we want to delete records from. @@ -234,6 +253,14 @@ pub struct DeleteRecordsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteRecordsRequest { + type Builder = DeleteRecordsRequestBuilder; + + fn builder() -> Self::Builder{ + DeleteRecordsRequestBuilder::default() + } +} + impl Encodable for DeleteRecordsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/delete_records_response.rs b/src/messages/delete_records_response.rs index 147e784..d434e60 100644 --- a/src/messages/delete_records_response.rs +++ b/src/messages/delete_records_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteRecordsPartitionResult { /// The partition low water mark. @@ -34,6 +35,14 @@ pub struct DeleteRecordsPartitionResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteRecordsPartitionResult { + type Builder = DeleteRecordsPartitionResultBuilder; + + fn builder() -> Self::Builder{ + DeleteRecordsPartitionResultBuilder::default() + } +} + impl MapEncodable for DeleteRecordsPartitionResult { type Key = i32; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -111,6 +120,7 @@ impl Message for DeleteRecordsPartitionResult { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteRecordsTopicResult { /// Each partition that we wanted to delete records from. @@ -122,6 +132,14 @@ pub struct DeleteRecordsTopicResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteRecordsTopicResult { + type Builder = DeleteRecordsTopicResultBuilder; + + fn builder() -> Self::Builder{ + DeleteRecordsTopicResultBuilder::default() + } +} + impl MapEncodable for DeleteRecordsTopicResult { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -218,6 +236,7 @@ impl Message for DeleteRecordsTopicResult { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteRecordsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -234,6 +253,14 @@ pub struct DeleteRecordsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteRecordsResponse { + type Builder = DeleteRecordsResponseBuilder; + + fn builder() -> Self::Builder{ + DeleteRecordsResponseBuilder::default() + } +} + impl Encodable for DeleteRecordsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/delete_topics_request.rs b/src/messages/delete_topics_request.rs index 9b1f0bf..2111260 100644 --- a/src/messages/delete_topics_request.rs +++ b/src/messages/delete_topics_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteTopicState { /// The topic name @@ -34,6 +35,14 @@ pub struct DeleteTopicState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteTopicState { + type Builder = DeleteTopicStateBuilder; + + fn builder() -> Self::Builder{ + DeleteTopicStateBuilder::default() + } +} + impl Encodable for DeleteTopicState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 6 { @@ -138,6 +147,7 @@ impl Message for DeleteTopicState { } /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteTopicsRequest { /// The name or topic ID of the topic @@ -159,6 +169,14 @@ pub struct DeleteTopicsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteTopicsRequest { + type Builder = DeleteTopicsRequestBuilder; + + fn builder() -> Self::Builder{ + DeleteTopicsRequestBuilder::default() + } +} + impl Encodable for DeleteTopicsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 6 { diff --git a/src/messages/delete_topics_response.rs b/src/messages/delete_topics_response.rs index d6e8536..1b021b2 100644 --- a/src/messages/delete_topics_response.rs +++ b/src/messages/delete_topics_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeletableTopicResult { /// the unique topic ID @@ -39,6 +40,14 @@ pub struct DeletableTopicResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeletableTopicResult { + type Builder = DeletableTopicResultBuilder; + + fn builder() -> Self::Builder{ + DeletableTopicResultBuilder::default() + } +} + impl MapEncodable for DeletableTopicResult { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -149,6 +158,7 @@ impl Message for DeletableTopicResult { } /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DeleteTopicsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -165,6 +175,14 @@ pub struct DeleteTopicsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DeleteTopicsResponse { + type Builder = DeleteTopicsResponseBuilder; + + fn builder() -> Self::Builder{ + DeleteTopicsResponseBuilder::default() + } +} + impl Encodable for DeleteTopicsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/describe_acls_request.rs b/src/messages/describe_acls_request.rs index c349abc..386e919 100644 --- a/src/messages/describe_acls_request.rs +++ b/src/messages/describe_acls_request.rs @@ -13,52 +13,61 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeAclsRequest { /// The resource type. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_type_filter: i8, /// The resource name, or null to match any resource name. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_name_filter: Option, /// The resource pattern to match. /// - /// Supported API versions: 1-2 + /// Supported API versions: 1-3 pub pattern_type_filter: i8, /// The principal to match, or null to match any principal. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_filter: Option, /// The host to match, or null to match any host. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub host_filter: Option, /// The operation to match. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub operation: i8, /// The permission type to match. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub permission_type: i8, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeAclsRequest { + type Builder = DescribeAclsRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeAclsRequestBuilder::default() + } +} + impl Encodable for DescribeAclsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int8.encode(buf, &self.resource_type_filter)?; @@ -204,7 +213,7 @@ impl Default for DescribeAclsRequest { } impl Message for DescribeAclsRequest { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for DescribeAclsRequest { diff --git a/src/messages/describe_acls_response.rs b/src/messages/describe_acls_response.rs index f948ce9..9055940 100644 --- a/src/messages/describe_acls_response.rs +++ b/src/messages/describe_acls_response.rs @@ -13,37 +13,46 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AclDescription { /// The ACL principal. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal: StrBytes, /// The ACL host. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub host: StrBytes, /// The ACL operation. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub operation: i8, /// The ACL permission type. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub permission_type: i8, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AclDescription { + type Builder = AclDescriptionBuilder; + + fn builder() -> Self::Builder{ + AclDescriptionBuilder::default() + } +} + impl Encodable for AclDescription { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -146,36 +155,45 @@ impl Default for AclDescription { } impl Message for AclDescription { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeAclsResource { /// The resource type. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_type: i8, /// The resource name. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resource_name: StrBytes, /// The resource pattern type. /// - /// Supported API versions: 1-2 + /// Supported API versions: 1-3 pub pattern_type: i8, /// The ACLs. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub acls: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeAclsResource { + type Builder = DescribeAclsResourceBuilder; + + fn builder() -> Self::Builder{ + DescribeAclsResourceBuilder::default() + } +} + impl Encodable for DescribeAclsResource { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int8.encode(buf, &self.resource_type)?; @@ -294,36 +312,45 @@ impl Default for DescribeAclsResource { } impl Message for DescribeAclsResource { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeAclsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub throttle_time_ms: i32, /// The error code, or 0 if there was no error. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_code: i16, /// The error message, or null if there was no error. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_message: Option, /// Each Resource that is referenced in an ACL. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub resources: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeAclsResponse { + type Builder = DescribeAclsResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeAclsResponseBuilder::default() + } +} + impl Encodable for DescribeAclsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; @@ -426,7 +453,7 @@ impl Default for DescribeAclsResponse { } impl Message for DescribeAclsResponse { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for DescribeAclsResponse { diff --git a/src/messages/describe_client_quotas_request.rs b/src/messages/describe_client_quotas_request.rs index 6d47874..aace3bf 100644 --- a/src/messages/describe_client_quotas_request.rs +++ b/src/messages/describe_client_quotas_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ComponentData { /// The entity type that the filter component applies to. @@ -39,6 +40,14 @@ pub struct ComponentData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ComponentData { + type Builder = ComponentDataBuilder; + + fn builder() -> Self::Builder{ + ComponentDataBuilder::default() + } +} + impl Encodable for ComponentData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -140,6 +149,7 @@ impl Message for ComponentData { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeClientQuotasRequest { /// Filter components to apply to quota entities. @@ -156,6 +166,14 @@ pub struct DescribeClientQuotasRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeClientQuotasRequest { + type Builder = DescribeClientQuotasRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeClientQuotasRequestBuilder::default() + } +} + impl Encodable for DescribeClientQuotasRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/describe_client_quotas_response.rs b/src/messages/describe_client_quotas_response.rs index a8eff16..26f3cfe 100644 --- a/src/messages/describe_client_quotas_response.rs +++ b/src/messages/describe_client_quotas_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EntityData { /// The entity type. @@ -34,6 +35,14 @@ pub struct EntityData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EntityData { + type Builder = EntityDataBuilder; + + fn builder() -> Self::Builder{ + EntityDataBuilder::default() + } +} + impl Encodable for EntityData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -130,6 +139,7 @@ impl Message for EntityData { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ValueData { /// The quota configuration key. @@ -146,6 +156,14 @@ pub struct ValueData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ValueData { + type Builder = ValueDataBuilder; + + fn builder() -> Self::Builder{ + ValueDataBuilder::default() + } +} + impl Encodable for ValueData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -230,6 +248,7 @@ impl Message for ValueData { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EntryData { /// The quota entity description. @@ -246,6 +265,14 @@ pub struct EntryData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EntryData { + type Builder = EntryDataBuilder; + + fn builder() -> Self::Builder{ + EntryDataBuilder::default() + } +} + impl Encodable for EntryData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -342,6 +369,7 @@ impl Message for EntryData { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeClientQuotasResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -368,6 +396,14 @@ pub struct DescribeClientQuotasResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeClientQuotasResponse { + type Builder = DescribeClientQuotasResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeClientQuotasResponseBuilder::default() + } +} + impl Encodable for DescribeClientQuotasResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/describe_cluster_request.rs b/src/messages/describe_cluster_request.rs index 1bd02f8..cc36284 100644 --- a/src/messages/describe_cluster_request.rs +++ b/src/messages/describe_cluster_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeClusterRequest { /// Whether to include cluster authorized operations. @@ -29,6 +30,14 @@ pub struct DescribeClusterRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeClusterRequest { + type Builder = DescribeClusterRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeClusterRequestBuilder::default() + } +} + impl Encodable for DescribeClusterRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Boolean.encode(buf, &self.include_cluster_authorized_operations)?; diff --git a/src/messages/describe_cluster_response.rs b/src/messages/describe_cluster_response.rs index 8ed7fa0..120947f 100644 --- a/src/messages/describe_cluster_response.rs +++ b/src/messages/describe_cluster_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeClusterBroker { /// The broker hostname. @@ -39,6 +40,14 @@ pub struct DescribeClusterBroker { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeClusterBroker { + type Builder = DescribeClusterBrokerBuilder; + + fn builder() -> Self::Builder{ + DescribeClusterBrokerBuilder::default() + } +} + impl MapEncodable for DescribeClusterBroker { type Key = super::BrokerId; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -115,6 +124,7 @@ impl Message for DescribeClusterBroker { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeClusterResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -156,6 +166,14 @@ pub struct DescribeClusterResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeClusterResponse { + type Builder = DescribeClusterResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeClusterResponseBuilder::default() + } +} + impl Encodable for DescribeClusterResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/describe_configs_request.rs b/src/messages/describe_configs_request.rs index f6e40fd..553d5ec 100644 --- a/src/messages/describe_configs_request.rs +++ b/src/messages/describe_configs_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeConfigsResource { /// The resource type. @@ -39,6 +40,14 @@ pub struct DescribeConfigsResource { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeConfigsResource { + type Builder = DescribeConfigsResourceBuilder; + + fn builder() -> Self::Builder{ + DescribeConfigsResourceBuilder::default() + } +} + impl Encodable for DescribeConfigsResource { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int8.encode(buf, &self.resource_type)?; @@ -140,6 +149,7 @@ impl Message for DescribeConfigsResource { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeConfigsRequest { /// The resources whose configurations we want to describe. @@ -161,6 +171,14 @@ pub struct DescribeConfigsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeConfigsRequest { + type Builder = DescribeConfigsRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeConfigsRequestBuilder::default() + } +} + impl Encodable for DescribeConfigsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 4 { diff --git a/src/messages/describe_configs_response.rs b/src/messages/describe_configs_response.rs index 3497806..cbb47c3 100644 --- a/src/messages/describe_configs_response.rs +++ b/src/messages/describe_configs_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeConfigsSynonym { /// The synonym name. @@ -39,6 +40,14 @@ pub struct DescribeConfigsSynonym { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeConfigsSynonym { + type Builder = DescribeConfigsSynonymBuilder; + + fn builder() -> Self::Builder{ + DescribeConfigsSynonymBuilder::default() + } +} + impl Encodable for DescribeConfigsSynonym { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -188,6 +197,7 @@ impl Message for DescribeConfigsSynonym { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeConfigsResourceResult { /// The configuration name. @@ -239,6 +249,14 @@ pub struct DescribeConfigsResourceResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeConfigsResourceResult { + type Builder = DescribeConfigsResourceResultBuilder; + + fn builder() -> Self::Builder{ + DescribeConfigsResourceResultBuilder::default() + } +} + impl Encodable for DescribeConfigsResourceResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 4 { @@ -442,6 +460,7 @@ impl Message for DescribeConfigsResourceResult { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeConfigsResult { /// The error code, or 0 if we were able to successfully describe the configurations. @@ -473,6 +492,14 @@ pub struct DescribeConfigsResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeConfigsResult { + type Builder = DescribeConfigsResultBuilder; + + fn builder() -> Self::Builder{ + DescribeConfigsResultBuilder::default() + } +} + impl Encodable for DescribeConfigsResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -596,6 +623,7 @@ impl Message for DescribeConfigsResult { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeConfigsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -612,6 +640,14 @@ pub struct DescribeConfigsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeConfigsResponse { + type Builder = DescribeConfigsResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeConfigsResponseBuilder::default() + } +} + impl Encodable for DescribeConfigsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/describe_delegation_token_request.rs b/src/messages/describe_delegation_token_request.rs index 60a8f15..42c4e61 100644 --- a/src/messages/describe_delegation_token_request.rs +++ b/src/messages/describe_delegation_token_request.rs @@ -13,27 +13,36 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeDelegationTokenOwner { /// The owner principal type. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_type: StrBytes, /// The owner principal name. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_name: StrBytes, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeDelegationTokenOwner { + type Builder = DescribeDelegationTokenOwnerBuilder; + + fn builder() -> Self::Builder{ + DescribeDelegationTokenOwnerBuilder::default() + } +} + impl Encodable for DescribeDelegationTokenOwner { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -126,21 +135,30 @@ impl Default for DescribeDelegationTokenOwner { } impl Message for DescribeDelegationTokenOwner { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeDelegationTokenRequest { /// Each owner that we want to describe delegation tokens for, or null to describe all tokens. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub owners: Option>, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeDelegationTokenRequest { + type Builder = DescribeDelegationTokenRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeDelegationTokenRequestBuilder::default() + } +} + impl Encodable for DescribeDelegationTokenRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -216,7 +234,7 @@ impl Default for DescribeDelegationTokenRequest { } impl Message for DescribeDelegationTokenRequest { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for DescribeDelegationTokenRequest { diff --git a/src/messages/describe_delegation_token_response.rs b/src/messages/describe_delegation_token_response.rs index d22aa71..5bce9e1 100644 --- a/src/messages/describe_delegation_token_response.rs +++ b/src/messages/describe_delegation_token_response.rs @@ -13,27 +13,36 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribedDelegationTokenRenewer { /// The renewer principal type /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_type: StrBytes, /// The renewer principal name /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_name: StrBytes, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribedDelegationTokenRenewer { + type Builder = DescribedDelegationTokenRenewerBuilder; + + fn builder() -> Self::Builder{ + DescribedDelegationTokenRenewerBuilder::default() + } +} + impl Encodable for DescribedDelegationTokenRenewer { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -126,56 +135,75 @@ impl Default for DescribedDelegationTokenRenewer { } impl Message for DescribedDelegationTokenRenewer { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribedDelegationToken { /// The token principal type. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_type: StrBytes, /// The token principal name. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub principal_name: StrBytes, + /// The principal type of the requester of the token. + /// + /// Supported API versions: 3 + pub token_requester_principal_type: StrBytes, + + /// The principal type of the requester of the token. + /// + /// Supported API versions: 3 + pub token_requester_principal_name: StrBytes, + /// The token issue timestamp in milliseconds. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub issue_timestamp: i64, /// The token expiry timestamp in milliseconds. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub expiry_timestamp: i64, /// The token maximum timestamp length in milliseconds. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub max_timestamp: i64, /// The token ID. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub token_id: StrBytes, /// The token HMAC. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub hmac: Bytes, /// Those who are able to renew this token before it expires. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub renewers: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribedDelegationToken { + type Builder = DescribedDelegationTokenBuilder; + + fn builder() -> Self::Builder{ + DescribedDelegationTokenBuilder::default() + } +} + impl Encodable for DescribedDelegationToken { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -188,6 +216,20 @@ impl Encodable for DescribedDelegationToken { } else { types::String.encode(buf, &self.principal_name)?; } + if version >= 3 { + types::CompactString.encode(buf, &self.token_requester_principal_type)?; + } else { + if !self.token_requester_principal_type.is_empty() { + return Err(EncodeError) + } + } + if version >= 3 { + types::CompactString.encode(buf, &self.token_requester_principal_name)?; + } else { + if !self.token_requester_principal_name.is_empty() { + return Err(EncodeError) + } + } types::Int64.encode(buf, &self.issue_timestamp)?; types::Int64.encode(buf, &self.expiry_timestamp)?; types::Int64.encode(buf, &self.max_timestamp)?; @@ -230,6 +272,20 @@ impl Encodable for DescribedDelegationToken { } else { total_size += types::String.compute_size(&self.principal_name)?; } + if version >= 3 { + total_size += types::CompactString.compute_size(&self.token_requester_principal_type)?; + } else { + if !self.token_requester_principal_type.is_empty() { + return Err(EncodeError) + } + } + if version >= 3 { + total_size += types::CompactString.compute_size(&self.token_requester_principal_name)?; + } else { + if !self.token_requester_principal_name.is_empty() { + return Err(EncodeError) + } + } total_size += types::Int64.compute_size(&self.issue_timestamp)?; total_size += types::Int64.compute_size(&self.expiry_timestamp)?; total_size += types::Int64.compute_size(&self.max_timestamp)?; @@ -274,6 +330,16 @@ impl Decodable for DescribedDelegationToken { } else { types::String.decode(buf)? }; + let token_requester_principal_type = if version >= 3 { + types::CompactString.decode(buf)? + } else { + Default::default() + }; + let token_requester_principal_name = if version >= 3 { + types::CompactString.decode(buf)? + } else { + Default::default() + }; let issue_timestamp = types::Int64.decode(buf)?; let expiry_timestamp = types::Int64.decode(buf)?; let max_timestamp = types::Int64.decode(buf)?; @@ -306,6 +372,8 @@ impl Decodable for DescribedDelegationToken { Ok(Self { principal_type, principal_name, + token_requester_principal_type, + token_requester_principal_name, issue_timestamp, expiry_timestamp, max_timestamp, @@ -322,6 +390,8 @@ impl Default for DescribedDelegationToken { Self { principal_type: Default::default(), principal_name: Default::default(), + token_requester_principal_type: Default::default(), + token_requester_principal_name: Default::default(), issue_timestamp: 0, expiry_timestamp: 0, max_timestamp: 0, @@ -334,31 +404,40 @@ impl Default for DescribedDelegationToken { } impl Message for DescribedDelegationToken { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } -/// Valid versions: 0-2 +/// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeDelegationTokenResponse { /// The error code, or 0 if there was no error. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub error_code: i16, /// The tokens. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub tokens: Vec, /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. /// - /// Supported API versions: 0-2 + /// Supported API versions: 0-3 pub throttle_time_ms: i32, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeDelegationTokenResponse { + type Builder = DescribeDelegationTokenResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeDelegationTokenResponseBuilder::default() + } +} + impl Encodable for DescribeDelegationTokenResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -444,7 +523,7 @@ impl Default for DescribeDelegationTokenResponse { } impl Message for DescribeDelegationTokenResponse { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 2 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; } impl HeaderVersion for DescribeDelegationTokenResponse { diff --git a/src/messages/describe_groups_request.rs b/src/messages/describe_groups_request.rs index a5d3113..b76a9b1 100644 --- a/src/messages/describe_groups_request.rs +++ b/src/messages/describe_groups_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeGroupsRequest { /// The names of the groups to describe @@ -34,6 +35,14 @@ pub struct DescribeGroupsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeGroupsRequest { + type Builder = DescribeGroupsRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeGroupsRequestBuilder::default() + } +} + impl Encodable for DescribeGroupsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 5 { diff --git a/src/messages/describe_groups_response.rs b/src/messages/describe_groups_response.rs index d360a85..acdf741 100644 --- a/src/messages/describe_groups_response.rs +++ b/src/messages/describe_groups_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribedGroupMember { /// The member ID assigned by the group coordinator. @@ -54,6 +55,14 @@ pub struct DescribedGroupMember { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribedGroupMember { + type Builder = DescribedGroupMemberBuilder; + + fn builder() -> Self::Builder{ + DescribedGroupMemberBuilder::default() + } +} + impl Encodable for DescribedGroupMember { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 5 { @@ -226,6 +235,7 @@ impl Message for DescribedGroupMember { } /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribedGroup { /// The describe error, or 0 if there was no error. @@ -267,6 +277,14 @@ pub struct DescribedGroup { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribedGroup { + type Builder = DescribedGroupBuilder; + + fn builder() -> Self::Builder{ + DescribedGroupBuilder::default() + } +} + impl Encodable for DescribedGroup { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -440,6 +458,7 @@ impl Message for DescribedGroup { } /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeGroupsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -456,6 +475,14 @@ pub struct DescribeGroupsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeGroupsResponse { + type Builder = DescribeGroupsResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeGroupsResponseBuilder::default() + } +} + impl Encodable for DescribeGroupsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/describe_log_dirs_request.rs b/src/messages/describe_log_dirs_request.rs index eaee56a..a744894 100644 --- a/src/messages/describe_log_dirs_request.rs +++ b/src/messages/describe_log_dirs_request.rs @@ -13,22 +13,31 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-3 +/// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribableLogDirTopic { /// The partition indexes. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub partitions: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribableLogDirTopic { + type Builder = DescribableLogDirTopicBuilder; + + fn builder() -> Self::Builder{ + DescribableLogDirTopicBuilder::default() + } +} + impl MapEncodable for DescribableLogDirTopic { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -121,21 +130,30 @@ impl Default for DescribableLogDirTopic { } impl Message for DescribableLogDirTopic { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 4 }; } -/// Valid versions: 0-3 +/// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeLogDirsRequest { /// Each topic that we want to describe log directories for, or null for all topics. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub topics: Option>, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeLogDirsRequest { + type Builder = DescribeLogDirsRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeLogDirsRequestBuilder::default() + } +} + impl Encodable for DescribeLogDirsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -211,7 +229,7 @@ impl Default for DescribeLogDirsRequest { } impl Message for DescribeLogDirsRequest { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 4 }; } impl HeaderVersion for DescribeLogDirsRequest { diff --git a/src/messages/describe_log_dirs_response.rs b/src/messages/describe_log_dirs_response.rs index edb4b8b..74348ab 100644 --- a/src/messages/describe_log_dirs_response.rs +++ b/src/messages/describe_log_dirs_response.rs @@ -13,37 +13,46 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0-3 +/// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeLogDirsPartition { /// The partition index. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub partition_index: i32, /// The size of the log segments in this partition in bytes. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub partition_size: i64, /// The lag of the log's LEO w.r.t. partition's HW (if it is the current log for the partition) or current replica's LEO (if it is the future log for the partition) /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub offset_lag: i64, /// True if this log is created by AlterReplicaLogDirsRequest and will replace the current log of the replica in the future. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub is_future_key: bool, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeLogDirsPartition { + type Builder = DescribeLogDirsPartitionBuilder; + + fn builder() -> Self::Builder{ + DescribeLogDirsPartitionBuilder::default() + } +} + impl Encodable for DescribeLogDirsPartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -122,26 +131,35 @@ impl Default for DescribeLogDirsPartition { } impl Message for DescribeLogDirsPartition { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 4 }; } -/// Valid versions: 0-3 +/// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeLogDirsTopic { /// The topic name. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub name: super::TopicName, /// /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub partitions: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeLogDirsTopic { + type Builder = DescribeLogDirsTopicBuilder; + + fn builder() -> Self::Builder{ + DescribeLogDirsTopicBuilder::default() + } +} + impl Encodable for DescribeLogDirsTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -234,31 +252,50 @@ impl Default for DescribeLogDirsTopic { } impl Message for DescribeLogDirsTopic { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 4 }; } -/// Valid versions: 0-3 +/// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeLogDirsResult { /// The error code, or 0 if there was no error. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub error_code: i16, /// The absolute log directory path. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub log_dir: StrBytes, /// Each topic. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub topics: Vec, + /// The total size in bytes of the volume the log directory is in. + /// + /// Supported API versions: 4 + pub total_bytes: i64, + + /// The usable size in bytes of the volume the log directory is in. + /// + /// Supported API versions: 4 + pub usable_bytes: i64, + /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeLogDirsResult { + type Builder = DescribeLogDirsResultBuilder; + + fn builder() -> Self::Builder{ + DescribeLogDirsResultBuilder::default() + } +} + impl Encodable for DescribeLogDirsResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -272,6 +309,12 @@ impl Encodable for DescribeLogDirsResult { } else { types::Array(types::Struct { version }).encode(buf, &self.topics)?; } + if version >= 4 { + types::Int64.encode(buf, &self.total_bytes)?; + } + if version >= 4 { + types::Int64.encode(buf, &self.usable_bytes)?; + } if version >= 2 { let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { @@ -297,6 +340,12 @@ impl Encodable for DescribeLogDirsResult { } else { total_size += types::Array(types::Struct { version }).compute_size(&self.topics)?; } + if version >= 4 { + total_size += types::Int64.compute_size(&self.total_bytes)?; + } + if version >= 4 { + total_size += types::Int64.compute_size(&self.usable_bytes)?; + } if version >= 2 { let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { @@ -324,6 +373,16 @@ impl Decodable for DescribeLogDirsResult { } else { types::Array(types::Struct { version }).decode(buf)? }; + let total_bytes = if version >= 4 { + types::Int64.decode(buf)? + } else { + -1 + }; + let usable_bytes = if version >= 4 { + types::Int64.decode(buf)? + } else { + -1 + }; let mut unknown_tagged_fields = BTreeMap::new(); if version >= 2 { let num_tagged_fields = types::UnsignedVarInt.decode(buf)?; @@ -339,6 +398,8 @@ impl Decodable for DescribeLogDirsResult { error_code, log_dir, topics, + total_bytes, + usable_bytes, unknown_tagged_fields, }) } @@ -350,37 +411,48 @@ impl Default for DescribeLogDirsResult { error_code: 0, log_dir: Default::default(), topics: Default::default(), + total_bytes: -1, + usable_bytes: -1, unknown_tagged_fields: BTreeMap::new(), } } } impl Message for DescribeLogDirsResult { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 4 }; } -/// Valid versions: 0-3 +/// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeLogDirsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub throttle_time_ms: i32, /// The error code, or 0 if there was no error. /// - /// Supported API versions: 3 + /// Supported API versions: 3-4 pub error_code: i16, /// The log directories. /// - /// Supported API versions: 0-3 + /// Supported API versions: 0-4 pub results: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeLogDirsResponse { + type Builder = DescribeLogDirsResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeLogDirsResponseBuilder::default() + } +} + impl Encodable for DescribeLogDirsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; @@ -474,7 +546,7 @@ impl Default for DescribeLogDirsResponse { } impl Message for DescribeLogDirsResponse { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 3 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 4 }; } impl HeaderVersion for DescribeLogDirsResponse { diff --git a/src/messages/describe_producers_request.rs b/src/messages/describe_producers_request.rs index bc859bb..23fc35d 100644 --- a/src/messages/describe_producers_request.rs +++ b/src/messages/describe_producers_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicRequest { /// The topic name. @@ -34,6 +35,14 @@ pub struct TopicRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicRequest { + type Builder = TopicRequestBuilder; + + fn builder() -> Self::Builder{ + TopicRequestBuilder::default() + } +} + impl Encodable for TopicRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -100,6 +109,7 @@ impl Message for TopicRequest { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeProducersRequest { /// @@ -111,6 +121,14 @@ pub struct DescribeProducersRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeProducersRequest { + type Builder = DescribeProducersRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeProducersRequestBuilder::default() + } +} + impl Encodable for DescribeProducersRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactArray(types::Struct { version }).encode(buf, &self.topics)?; diff --git a/src/messages/describe_producers_response.rs b/src/messages/describe_producers_response.rs index 5309c0c..5405dcf 100644 --- a/src/messages/describe_producers_response.rs +++ b/src/messages/describe_producers_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ProducerState { /// @@ -54,6 +55,14 @@ pub struct ProducerState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ProducerState { + type Builder = ProducerStateBuilder; + + fn builder() -> Self::Builder{ + ProducerStateBuilder::default() + } +} + impl Encodable for ProducerState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int64.encode(buf, &self.producer_id)?; @@ -140,6 +149,7 @@ impl Message for ProducerState { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionResponse { /// The partition index. @@ -166,6 +176,14 @@ pub struct PartitionResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionResponse { + type Builder = PartitionResponseBuilder; + + fn builder() -> Self::Builder{ + PartitionResponseBuilder::default() + } +} + impl Encodable for PartitionResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -242,6 +260,7 @@ impl Message for PartitionResponse { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicResponse { /// The topic name @@ -258,6 +277,14 @@ pub struct TopicResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicResponse { + type Builder = TopicResponseBuilder; + + fn builder() -> Self::Builder{ + TopicResponseBuilder::default() + } +} + impl Encodable for TopicResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -324,6 +351,7 @@ impl Message for TopicResponse { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeProducersResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -340,6 +368,14 @@ pub struct DescribeProducersResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeProducersResponse { + type Builder = DescribeProducersResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeProducersResponseBuilder::default() + } +} + impl Encodable for DescribeProducersResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/describe_quorum_request.rs b/src/messages/describe_quorum_request.rs index 67b695d..fa573fb 100644 --- a/src/messages/describe_quorum_request.rs +++ b/src/messages/describe_quorum_request.rs @@ -13,22 +13,31 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub partition_index: i32, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -86,26 +95,35 @@ impl Default for PartitionData { } impl Message for PartitionData { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The topic name. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub topic_name: super::TopicName, /// /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub partitions: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.topic_name)?; @@ -168,21 +186,30 @@ impl Default for TopicData { } impl Message for TopicData { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeQuorumRequest { /// /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub topics: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeQuorumRequest { + type Builder = DescribeQuorumRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeQuorumRequestBuilder::default() + } +} + impl Encodable for DescribeQuorumRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactArray(types::Struct { version }).encode(buf, &self.topics)?; @@ -240,7 +267,7 @@ impl Default for DescribeQuorumRequest { } impl Message for DescribeQuorumRequest { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } impl HeaderVersion for DescribeQuorumRequest { diff --git a/src/messages/describe_quorum_response.rs b/src/messages/describe_quorum_response.rs index 0566301..ed327d7 100644 --- a/src/messages/describe_quorum_response.rs +++ b/src/messages/describe_quorum_response.rs @@ -13,31 +13,56 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ReplicaState { /// /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub replica_id: super::BrokerId, /// The last known log end offset of the follower or -1 if it is unknown /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub log_end_offset: i64, + /// The last known leader wall clock time time when a follower fetched from the leader. This is reported as -1 both for the current leader or if it is unknown for a voter + /// + /// Supported API versions: 1 + pub last_fetch_timestamp: i64, + + /// The leader wall clock append time of the offset for which the follower made the most recent fetch request. This is reported as the current time for the leader and -1 if unknown for a voter + /// + /// Supported API versions: 1 + pub last_caught_up_timestamp: i64, + /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ReplicaState { + type Builder = ReplicaStateBuilder; + + fn builder() -> Self::Builder{ + ReplicaStateBuilder::default() + } +} + impl Encodable for ReplicaState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.replica_id)?; types::Int64.encode(buf, &self.log_end_offset)?; + if version >= 1 { + types::Int64.encode(buf, &self.last_fetch_timestamp)?; + } + if version >= 1 { + types::Int64.encode(buf, &self.last_caught_up_timestamp)?; + } let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { error!("Too many tagged fields to encode ({} fields)", num_tagged_fields); @@ -52,6 +77,12 @@ impl Encodable for ReplicaState { let mut total_size = 0; total_size += types::Int32.compute_size(&self.replica_id)?; total_size += types::Int64.compute_size(&self.log_end_offset)?; + if version >= 1 { + total_size += types::Int64.compute_size(&self.last_fetch_timestamp)?; + } + if version >= 1 { + total_size += types::Int64.compute_size(&self.last_caught_up_timestamp)?; + } let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { error!("Too many tagged fields to encode ({} fields)", num_tagged_fields); @@ -68,6 +99,16 @@ impl Decodable for ReplicaState { fn decode(buf: &mut B, version: i16) -> Result { let replica_id = types::Int32.decode(buf)?; let log_end_offset = types::Int64.decode(buf)?; + let last_fetch_timestamp = if version >= 1 { + types::Int64.decode(buf)? + } else { + -1 + }; + let last_caught_up_timestamp = if version >= 1 { + types::Int64.decode(buf)? + } else { + -1 + }; let mut unknown_tagged_fields = BTreeMap::new(); let num_tagged_fields = types::UnsignedVarInt.decode(buf)?; for _ in 0..num_tagged_fields { @@ -80,6 +121,8 @@ impl Decodable for ReplicaState { Ok(Self { replica_id, log_end_offset, + last_fetch_timestamp, + last_caught_up_timestamp, unknown_tagged_fields, }) } @@ -90,57 +133,68 @@ impl Default for ReplicaState { Self { replica_id: (0).into(), log_end_offset: 0, + last_fetch_timestamp: -1, + last_caught_up_timestamp: -1, unknown_tagged_fields: BTreeMap::new(), } } } impl Message for ReplicaState { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub partition_index: i32, /// /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub error_code: i16, /// The ID of the current leader or -1 if the leader is unknown. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub leader_id: super::BrokerId, /// The latest known leader epoch /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub leader_epoch: i32, /// /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub high_watermark: i64, /// /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub current_voters: Vec, /// /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub observers: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -228,26 +282,35 @@ impl Default for PartitionData { } impl Message for PartitionData { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The topic name. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub topic_name: super::TopicName, /// /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub partitions: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.topic_name)?; @@ -310,26 +373,35 @@ impl Default for TopicData { } impl Message for TopicData { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeQuorumResponse { /// The top level error code. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub error_code: i16, /// /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub topics: Vec, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeQuorumResponse { + type Builder = DescribeQuorumResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeQuorumResponseBuilder::default() + } +} + impl Encodable for DescribeQuorumResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -392,7 +464,7 @@ impl Default for DescribeQuorumResponse { } impl Message for DescribeQuorumResponse { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } impl HeaderVersion for DescribeQuorumResponse { diff --git a/src/messages/describe_transactions_request.rs b/src/messages/describe_transactions_request.rs index 92fd182..4ff65a3 100644 --- a/src/messages/describe_transactions_request.rs +++ b/src/messages/describe_transactions_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeTransactionsRequest { /// Array of transactionalIds to include in describe results. If empty, then no results will be returned. @@ -29,6 +30,14 @@ pub struct DescribeTransactionsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeTransactionsRequest { + type Builder = DescribeTransactionsRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeTransactionsRequestBuilder::default() + } +} + impl Encodable for DescribeTransactionsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactArray(types::CompactString).encode(buf, &self.transactional_ids)?; diff --git a/src/messages/describe_transactions_response.rs b/src/messages/describe_transactions_response.rs index bff7d8f..8a46147 100644 --- a/src/messages/describe_transactions_response.rs +++ b/src/messages/describe_transactions_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// @@ -29,6 +30,14 @@ pub struct TopicData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl MapEncodable for TopicData { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -95,6 +104,7 @@ impl Message for TopicData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TransactionState { /// @@ -141,6 +151,14 @@ pub struct TransactionState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TransactionState { + type Builder = TransactionStateBuilder; + + fn builder() -> Self::Builder{ + TransactionStateBuilder::default() + } +} + impl Encodable for TransactionState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -237,6 +255,7 @@ impl Message for TransactionState { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeTransactionsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -253,6 +272,14 @@ pub struct DescribeTransactionsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeTransactionsResponse { + type Builder = DescribeTransactionsResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeTransactionsResponseBuilder::default() + } +} + impl Encodable for DescribeTransactionsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/describe_user_scram_credentials_request.rs b/src/messages/describe_user_scram_credentials_request.rs index 421c144..7ae5b94 100644 --- a/src/messages/describe_user_scram_credentials_request.rs +++ b/src/messages/describe_user_scram_credentials_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UserName { /// The user name. @@ -29,6 +30,14 @@ pub struct UserName { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UserName { + type Builder = UserNameBuilder; + + fn builder() -> Self::Builder{ + UserNameBuilder::default() + } +} + impl Encodable for UserName { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -90,6 +99,7 @@ impl Message for UserName { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeUserScramCredentialsRequest { /// The users to describe, or null/empty to describe all users. @@ -101,6 +111,14 @@ pub struct DescribeUserScramCredentialsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeUserScramCredentialsRequest { + type Builder = DescribeUserScramCredentialsRequestBuilder; + + fn builder() -> Self::Builder{ + DescribeUserScramCredentialsRequestBuilder::default() + } +} + impl Encodable for DescribeUserScramCredentialsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactArray(types::Struct { version }).encode(buf, &self.users)?; diff --git a/src/messages/describe_user_scram_credentials_response.rs b/src/messages/describe_user_scram_credentials_response.rs index 853b676..f896ffc 100644 --- a/src/messages/describe_user_scram_credentials_response.rs +++ b/src/messages/describe_user_scram_credentials_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct CredentialInfo { /// The SCRAM mechanism. @@ -34,6 +35,14 @@ pub struct CredentialInfo { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for CredentialInfo { + type Builder = CredentialInfoBuilder; + + fn builder() -> Self::Builder{ + CredentialInfoBuilder::default() + } +} + impl Encodable for CredentialInfo { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int8.encode(buf, &self.mechanism)?; @@ -100,6 +109,7 @@ impl Message for CredentialInfo { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeUserScramCredentialsResult { /// The user name. @@ -126,6 +136,14 @@ pub struct DescribeUserScramCredentialsResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeUserScramCredentialsResult { + type Builder = DescribeUserScramCredentialsResultBuilder; + + fn builder() -> Self::Builder{ + DescribeUserScramCredentialsResultBuilder::default() + } +} + impl Encodable for DescribeUserScramCredentialsResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.user)?; @@ -202,6 +220,7 @@ impl Message for DescribeUserScramCredentialsResult { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct DescribeUserScramCredentialsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -228,6 +247,14 @@ pub struct DescribeUserScramCredentialsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for DescribeUserScramCredentialsResponse { + type Builder = DescribeUserScramCredentialsResponseBuilder; + + fn builder() -> Self::Builder{ + DescribeUserScramCredentialsResponseBuilder::default() + } +} + impl Encodable for DescribeUserScramCredentialsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/elect_leaders_request.rs b/src/messages/elect_leaders_request.rs index de8987c..96fd62b 100644 --- a/src/messages/elect_leaders_request.rs +++ b/src/messages/elect_leaders_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicPartitions { /// The partitions of this topic whose leader should be elected. @@ -29,6 +30,14 @@ pub struct TopicPartitions { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicPartitions { + type Builder = TopicPartitionsBuilder; + + fn builder() -> Self::Builder{ + TopicPartitionsBuilder::default() + } +} + impl MapEncodable for TopicPartitions { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -125,6 +134,7 @@ impl Message for TopicPartitions { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ElectLeadersRequest { /// Type of elections to conduct for the partition. A value of '0' elects the preferred replica. A value of '1' elects the first live replica if there are no in-sync replica. @@ -146,6 +156,14 @@ pub struct ElectLeadersRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ElectLeadersRequest { + type Builder = ElectLeadersRequestBuilder; + + fn builder() -> Self::Builder{ + ElectLeadersRequestBuilder::default() + } +} + impl Encodable for ElectLeadersRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/elect_leaders_response.rs b/src/messages/elect_leaders_response.rs index 2695e76..25d65c4 100644 --- a/src/messages/elect_leaders_response.rs +++ b/src/messages/elect_leaders_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionResult { /// The partition id @@ -39,6 +40,14 @@ pub struct PartitionResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionResult { + type Builder = PartitionResultBuilder; + + fn builder() -> Self::Builder{ + PartitionResultBuilder::default() + } +} + impl Encodable for PartitionResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_id)?; @@ -128,6 +137,7 @@ impl Message for PartitionResult { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ReplicaElectionResult { /// The topic name @@ -144,6 +154,14 @@ pub struct ReplicaElectionResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ReplicaElectionResult { + type Builder = ReplicaElectionResultBuilder; + + fn builder() -> Self::Builder{ + ReplicaElectionResultBuilder::default() + } +} + impl Encodable for ReplicaElectionResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -240,6 +258,7 @@ impl Message for ReplicaElectionResult { } /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ElectLeadersResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -261,6 +280,14 @@ pub struct ElectLeadersResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ElectLeadersResponse { + type Builder = ElectLeadersResponseBuilder; + + fn builder() -> Self::Builder{ + ElectLeadersResponseBuilder::default() + } +} + impl Encodable for ElectLeadersResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/end_quorum_epoch_request.rs b/src/messages/end_quorum_epoch_request.rs index 04dcfbb..58ba1b3 100644 --- a/src/messages/end_quorum_epoch_request.rs +++ b/src/messages/end_quorum_epoch_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index. @@ -42,6 +43,14 @@ pub struct PartitionData { } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -93,6 +102,7 @@ impl Message for PartitionData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The topic name. @@ -107,6 +117,14 @@ pub struct TopicData { } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::String.encode(buf, &self.topic_name)?; @@ -148,6 +166,7 @@ impl Message for TopicData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EndQuorumEpochRequest { /// @@ -162,6 +181,14 @@ pub struct EndQuorumEpochRequest { } +impl Builder for EndQuorumEpochRequest { + type Builder = EndQuorumEpochRequestBuilder; + + fn builder() -> Self::Builder{ + EndQuorumEpochRequestBuilder::default() + } +} + impl Encodable for EndQuorumEpochRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::String.encode(buf, &self.cluster_id)?; diff --git a/src/messages/end_quorum_epoch_response.rs b/src/messages/end_quorum_epoch_response.rs index eaef259..e1db7ea 100644 --- a/src/messages/end_quorum_epoch_response.rs +++ b/src/messages/end_quorum_epoch_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index. @@ -42,6 +43,14 @@ pub struct PartitionData { } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -93,6 +102,7 @@ impl Message for PartitionData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The topic name. @@ -107,6 +117,14 @@ pub struct TopicData { } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::String.encode(buf, &self.topic_name)?; @@ -148,6 +166,7 @@ impl Message for TopicData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EndQuorumEpochResponse { /// The top level error code. @@ -162,6 +181,14 @@ pub struct EndQuorumEpochResponse { } +impl Builder for EndQuorumEpochResponse { + type Builder = EndQuorumEpochResponseBuilder; + + fn builder() -> Self::Builder{ + EndQuorumEpochResponseBuilder::default() + } +} + impl Encodable for EndQuorumEpochResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/end_txn_request.rs b/src/messages/end_txn_request.rs index 1899429..cace7c9 100644 --- a/src/messages/end_txn_request.rs +++ b/src/messages/end_txn_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EndTxnRequest { /// The ID of the transaction to end. @@ -44,6 +45,14 @@ pub struct EndTxnRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EndTxnRequest { + type Builder = EndTxnRequestBuilder; + + fn builder() -> Self::Builder{ + EndTxnRequestBuilder::default() + } +} + impl Encodable for EndTxnRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/end_txn_response.rs b/src/messages/end_txn_response.rs index da048c8..cff99aa 100644 --- a/src/messages/end_txn_response.rs +++ b/src/messages/end_txn_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EndTxnResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -34,6 +35,14 @@ pub struct EndTxnResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EndTxnResponse { + type Builder = EndTxnResponseBuilder; + + fn builder() -> Self::Builder{ + EndTxnResponseBuilder::default() + } +} + impl Encodable for EndTxnResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/envelope_request.rs b/src/messages/envelope_request.rs index c7587af..227df85 100644 --- a/src/messages/envelope_request.rs +++ b/src/messages/envelope_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EnvelopeRequest { /// The embedded request header and data. @@ -39,6 +40,14 @@ pub struct EnvelopeRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EnvelopeRequest { + type Builder = EnvelopeRequestBuilder; + + fn builder() -> Self::Builder{ + EnvelopeRequestBuilder::default() + } +} + impl Encodable for EnvelopeRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactBytes.encode(buf, &self.request_data)?; diff --git a/src/messages/envelope_response.rs b/src/messages/envelope_response.rs index 781a37b..5b7e12e 100644 --- a/src/messages/envelope_response.rs +++ b/src/messages/envelope_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EnvelopeResponse { /// The embedded response header and data. @@ -34,6 +35,14 @@ pub struct EnvelopeResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EnvelopeResponse { + type Builder = EnvelopeResponseBuilder; + + fn builder() -> Self::Builder{ + EnvelopeResponseBuilder::default() + } +} + impl Encodable for EnvelopeResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactBytes.encode(buf, &self.response_data)?; diff --git a/src/messages/expire_delegation_token_request.rs b/src/messages/expire_delegation_token_request.rs index 265ea6e..fe61198 100644 --- a/src/messages/expire_delegation_token_request.rs +++ b/src/messages/expire_delegation_token_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ExpireDelegationTokenRequest { /// The HMAC of the delegation token to be expired. @@ -34,6 +35,14 @@ pub struct ExpireDelegationTokenRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ExpireDelegationTokenRequest { + type Builder = ExpireDelegationTokenRequestBuilder; + + fn builder() -> Self::Builder{ + ExpireDelegationTokenRequestBuilder::default() + } +} + impl Encodable for ExpireDelegationTokenRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/expire_delegation_token_response.rs b/src/messages/expire_delegation_token_response.rs index ee1b776..694719d 100644 --- a/src/messages/expire_delegation_token_response.rs +++ b/src/messages/expire_delegation_token_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ExpireDelegationTokenResponse { /// The error code, or 0 if there was no error. @@ -39,6 +40,14 @@ pub struct ExpireDelegationTokenResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ExpireDelegationTokenResponse { + type Builder = ExpireDelegationTokenResponseBuilder; + + fn builder() -> Self::Builder{ + ExpireDelegationTokenResponseBuilder::default() + } +} + impl Encodable for ExpireDelegationTokenResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/fetch_request.rs b/src/messages/fetch_request.rs index ac9e0bd..f46c2ad 100644 --- a/src/messages/fetch_request.rs +++ b/src/messages/fetch_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FetchPartition { /// The partition index. @@ -54,6 +55,14 @@ pub struct FetchPartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FetchPartition { + type Builder = FetchPartitionBuilder; + + fn builder() -> Self::Builder{ + FetchPartitionBuilder::default() + } +} + impl Encodable for FetchPartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition)?; @@ -178,6 +187,7 @@ impl Message for FetchPartition { } /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FetchTopic { /// The name of the topic to fetch. @@ -199,6 +209,14 @@ pub struct FetchTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FetchTopic { + type Builder = FetchTopicBuilder; + + fn builder() -> Self::Builder{ + FetchTopicBuilder::default() + } +} + impl Encodable for FetchTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 12 { @@ -316,6 +334,7 @@ impl Message for FetchTopic { } /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ForgottenTopic { /// The topic name. @@ -337,6 +356,14 @@ pub struct ForgottenTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ForgottenTopic { + type Builder = ForgottenTopicBuilder; + + fn builder() -> Self::Builder{ + ForgottenTopicBuilder::default() + } +} + impl Encodable for ForgottenTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 7 && version <= 12 { @@ -470,6 +497,7 @@ impl Message for ForgottenTopic { } /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FetchRequest { /// The clusterId if known. This is used to validate metadata fetches prior to broker registration. @@ -531,6 +559,14 @@ pub struct FetchRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FetchRequest { + type Builder = FetchRequestBuilder; + + fn builder() -> Self::Builder{ + FetchRequestBuilder::default() + } +} + impl Encodable for FetchRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.replica_id)?; diff --git a/src/messages/fetch_response.rs b/src/messages/fetch_response.rs index 1eb3ff4..8c15893 100644 --- a/src/messages/fetch_response.rs +++ b/src/messages/fetch_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EpochEndOffset { /// @@ -34,6 +35,14 @@ pub struct EpochEndOffset { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EpochEndOffset { + type Builder = EpochEndOffsetBuilder; + + fn builder() -> Self::Builder{ + EpochEndOffsetBuilder::default() + } +} + impl Encodable for EpochEndOffset { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 12 { @@ -138,6 +147,7 @@ impl Message for EpochEndOffset { } /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderIdAndEpoch { /// The ID of the current leader or -1 if the leader is unknown. @@ -154,6 +164,14 @@ pub struct LeaderIdAndEpoch { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderIdAndEpoch { + type Builder = LeaderIdAndEpochBuilder; + + fn builder() -> Self::Builder{ + LeaderIdAndEpochBuilder::default() + } +} + impl Encodable for LeaderIdAndEpoch { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 12 { @@ -258,6 +276,7 @@ impl Message for LeaderIdAndEpoch { } /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SnapshotId { /// @@ -274,6 +293,14 @@ pub struct SnapshotId { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SnapshotId { + type Builder = SnapshotIdBuilder; + + fn builder() -> Self::Builder{ + SnapshotIdBuilder::default() + } +} + impl Encodable for SnapshotId { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int64.encode(buf, &self.end_offset)?; @@ -346,6 +373,7 @@ impl Message for SnapshotId { } /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AbortedTransaction { /// The producer id associated with the aborted transaction. @@ -362,6 +390,14 @@ pub struct AbortedTransaction { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AbortedTransaction { + type Builder = AbortedTransactionBuilder; + + fn builder() -> Self::Builder{ + AbortedTransactionBuilder::default() + } +} + impl Encodable for AbortedTransaction { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 4 { @@ -466,6 +502,7 @@ impl Message for AbortedTransaction { } /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index. @@ -527,6 +564,14 @@ pub struct PartitionData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -793,6 +838,7 @@ impl Message for PartitionData { } /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FetchableTopicResponse { /// The topic name. @@ -814,6 +860,14 @@ pub struct FetchableTopicResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FetchableTopicResponse { + type Builder = FetchableTopicResponseBuilder; + + fn builder() -> Self::Builder{ + FetchableTopicResponseBuilder::default() + } +} + impl Encodable for FetchableTopicResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 12 { @@ -931,6 +985,7 @@ impl Message for FetchableTopicResponse { } /// Valid versions: 0-13 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FetchResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -957,6 +1012,14 @@ pub struct FetchResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FetchResponse { + type Builder = FetchResponseBuilder; + + fn builder() -> Self::Builder{ + FetchResponseBuilder::default() + } +} + impl Encodable for FetchResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/fetch_snapshot_request.rs b/src/messages/fetch_snapshot_request.rs index 5dfdf81..6c30052 100644 --- a/src/messages/fetch_snapshot_request.rs +++ b/src/messages/fetch_snapshot_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SnapshotId { /// @@ -34,6 +35,14 @@ pub struct SnapshotId { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SnapshotId { + type Builder = SnapshotIdBuilder; + + fn builder() -> Self::Builder{ + SnapshotIdBuilder::default() + } +} + impl Encodable for SnapshotId { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int64.encode(buf, &self.end_offset)?; @@ -100,6 +109,7 @@ impl Message for SnapshotId { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionSnapshot { /// The partition index @@ -126,6 +136,14 @@ pub struct PartitionSnapshot { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionSnapshot { + type Builder = PartitionSnapshotBuilder; + + fn builder() -> Self::Builder{ + PartitionSnapshotBuilder::default() + } +} + impl Encodable for PartitionSnapshot { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition)?; @@ -202,6 +220,7 @@ impl Message for PartitionSnapshot { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicSnapshot { /// The name of the topic to fetch @@ -218,6 +237,14 @@ pub struct TopicSnapshot { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicSnapshot { + type Builder = TopicSnapshotBuilder; + + fn builder() -> Self::Builder{ + TopicSnapshotBuilder::default() + } +} + impl Encodable for TopicSnapshot { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -284,6 +311,7 @@ impl Message for TopicSnapshot { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FetchSnapshotRequest { /// The clusterId if known, this is used to validate metadata fetches prior to broker registration @@ -310,6 +338,14 @@ pub struct FetchSnapshotRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FetchSnapshotRequest { + type Builder = FetchSnapshotRequestBuilder; + + fn builder() -> Self::Builder{ + FetchSnapshotRequestBuilder::default() + } +} + impl Encodable for FetchSnapshotRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.replica_id)?; diff --git a/src/messages/fetch_snapshot_response.rs b/src/messages/fetch_snapshot_response.rs index 904c774..000ab79 100644 --- a/src/messages/fetch_snapshot_response.rs +++ b/src/messages/fetch_snapshot_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SnapshotId { /// @@ -34,6 +35,14 @@ pub struct SnapshotId { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SnapshotId { + type Builder = SnapshotIdBuilder; + + fn builder() -> Self::Builder{ + SnapshotIdBuilder::default() + } +} + impl Encodable for SnapshotId { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int64.encode(buf, &self.end_offset)?; @@ -100,6 +109,7 @@ impl Message for SnapshotId { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderIdAndEpoch { /// The ID of the current leader or -1 if the leader is unknown. @@ -116,6 +126,14 @@ pub struct LeaderIdAndEpoch { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderIdAndEpoch { + type Builder = LeaderIdAndEpochBuilder; + + fn builder() -> Self::Builder{ + LeaderIdAndEpochBuilder::default() + } +} + impl Encodable for LeaderIdAndEpoch { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.leader_id)?; @@ -182,6 +200,7 @@ impl Message for LeaderIdAndEpoch { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionSnapshot { /// The partition index. @@ -223,6 +242,14 @@ pub struct PartitionSnapshot { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionSnapshot { + type Builder = PartitionSnapshotBuilder; + + fn builder() -> Self::Builder{ + PartitionSnapshotBuilder::default() + } +} + impl Encodable for PartitionSnapshot { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.index)?; @@ -345,6 +372,7 @@ impl Message for PartitionSnapshot { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicSnapshot { /// The name of the topic to fetch. @@ -361,6 +389,14 @@ pub struct TopicSnapshot { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicSnapshot { + type Builder = TopicSnapshotBuilder; + + fn builder() -> Self::Builder{ + TopicSnapshotBuilder::default() + } +} + impl Encodable for TopicSnapshot { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -427,6 +463,7 @@ impl Message for TopicSnapshot { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FetchSnapshotResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -448,6 +485,14 @@ pub struct FetchSnapshotResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FetchSnapshotResponse { + type Builder = FetchSnapshotResponseBuilder; + + fn builder() -> Self::Builder{ + FetchSnapshotResponseBuilder::default() + } +} + impl Encodable for FetchSnapshotResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/find_coordinator_request.rs b/src/messages/find_coordinator_request.rs index e2bd222..ec28bf9 100644 --- a/src/messages/find_coordinator_request.rs +++ b/src/messages/find_coordinator_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FindCoordinatorRequest { /// The coordinator key. @@ -39,6 +40,14 @@ pub struct FindCoordinatorRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FindCoordinatorRequest { + type Builder = FindCoordinatorRequestBuilder; + + fn builder() -> Self::Builder{ + FindCoordinatorRequestBuilder::default() + } +} + impl Encodable for FindCoordinatorRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 3 { diff --git a/src/messages/find_coordinator_response.rs b/src/messages/find_coordinator_response.rs index 321f074..faf42c2 100644 --- a/src/messages/find_coordinator_response.rs +++ b/src/messages/find_coordinator_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct Coordinator { /// The coordinator key. @@ -54,6 +55,14 @@ pub struct Coordinator { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for Coordinator { + type Builder = CoordinatorBuilder; + + fn builder() -> Self::Builder{ + CoordinatorBuilder::default() + } +} + impl Encodable for Coordinator { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 4 { @@ -234,6 +243,7 @@ impl Message for Coordinator { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FindCoordinatorResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -275,6 +285,14 @@ pub struct FindCoordinatorResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FindCoordinatorResponse { + type Builder = FindCoordinatorResponseBuilder; + + fn builder() -> Self::Builder{ + FindCoordinatorResponseBuilder::default() + } +} + impl Encodable for FindCoordinatorResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/heartbeat_request.rs b/src/messages/heartbeat_request.rs index 5c22bf7..68a3db7 100644 --- a/src/messages/heartbeat_request.rs +++ b/src/messages/heartbeat_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct HeartbeatRequest { /// The group id. @@ -44,6 +45,14 @@ pub struct HeartbeatRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for HeartbeatRequest { + type Builder = HeartbeatRequestBuilder; + + fn builder() -> Self::Builder{ + HeartbeatRequestBuilder::default() + } +} + impl Encodable for HeartbeatRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 4 { diff --git a/src/messages/heartbeat_response.rs b/src/messages/heartbeat_response.rs index ad1e5bf..903f520 100644 --- a/src/messages/heartbeat_response.rs +++ b/src/messages/heartbeat_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct HeartbeatResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -34,6 +35,14 @@ pub struct HeartbeatResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for HeartbeatResponse { + type Builder = HeartbeatResponseBuilder; + + fn builder() -> Self::Builder{ + HeartbeatResponseBuilder::default() + } +} + impl Encodable for HeartbeatResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/incremental_alter_configs_request.rs b/src/messages/incremental_alter_configs_request.rs index 266d6ae..8ee7fb1 100644 --- a/src/messages/incremental_alter_configs_request.rs +++ b/src/messages/incremental_alter_configs_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterableConfig { /// The configuration key name. @@ -39,6 +40,14 @@ pub struct AlterableConfig { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterableConfig { + type Builder = AlterableConfigBuilder; + + fn builder() -> Self::Builder{ + AlterableConfigBuilder::default() + } +} + impl Encodable for AlterableConfig { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -140,6 +149,7 @@ impl Message for AlterableConfig { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterConfigsResource { /// The resource type. @@ -161,6 +171,14 @@ pub struct AlterConfigsResource { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterConfigsResource { + type Builder = AlterConfigsResourceBuilder; + + fn builder() -> Self::Builder{ + AlterConfigsResourceBuilder::default() + } +} + impl Encodable for AlterConfigsResource { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int8.encode(buf, &self.resource_type)?; @@ -262,6 +280,7 @@ impl Message for AlterConfigsResource { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct IncrementalAlterConfigsRequest { /// The incremental updates for each resource. @@ -278,6 +297,14 @@ pub struct IncrementalAlterConfigsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for IncrementalAlterConfigsRequest { + type Builder = IncrementalAlterConfigsRequestBuilder; + + fn builder() -> Self::Builder{ + IncrementalAlterConfigsRequestBuilder::default() + } +} + impl Encodable for IncrementalAlterConfigsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/incremental_alter_configs_response.rs b/src/messages/incremental_alter_configs_response.rs index 57f5477..c768f6f 100644 --- a/src/messages/incremental_alter_configs_response.rs +++ b/src/messages/incremental_alter_configs_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct AlterConfigsResourceResponse { /// The resource error code. @@ -44,6 +45,14 @@ pub struct AlterConfigsResourceResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for AlterConfigsResourceResponse { + type Builder = AlterConfigsResourceResponseBuilder; + + fn builder() -> Self::Builder{ + AlterConfigsResourceResponseBuilder::default() + } +} + impl Encodable for AlterConfigsResourceResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -150,6 +159,7 @@ impl Message for AlterConfigsResourceResponse { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct IncrementalAlterConfigsResponse { /// Duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -166,6 +176,14 @@ pub struct IncrementalAlterConfigsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for IncrementalAlterConfigsResponse { + type Builder = IncrementalAlterConfigsResponseBuilder; + + fn builder() -> Self::Builder{ + IncrementalAlterConfigsResponseBuilder::default() + } +} + impl Encodable for IncrementalAlterConfigsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/init_producer_id_request.rs b/src/messages/init_producer_id_request.rs index e56a530..1111749 100644 --- a/src/messages/init_producer_id_request.rs +++ b/src/messages/init_producer_id_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct InitProducerIdRequest { /// The transactional id, or null if the producer is not transactional. @@ -44,6 +45,14 @@ pub struct InitProducerIdRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for InitProducerIdRequest { + type Builder = InitProducerIdRequestBuilder; + + fn builder() -> Self::Builder{ + InitProducerIdRequestBuilder::default() + } +} + impl Encodable for InitProducerIdRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/init_producer_id_response.rs b/src/messages/init_producer_id_response.rs index 1761507..7844f01 100644 --- a/src/messages/init_producer_id_response.rs +++ b/src/messages/init_producer_id_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct InitProducerIdResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -44,6 +45,14 @@ pub struct InitProducerIdResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for InitProducerIdResponse { + type Builder = InitProducerIdResponseBuilder; + + fn builder() -> Self::Builder{ + InitProducerIdResponseBuilder::default() + } +} + impl Encodable for InitProducerIdResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/join_group_request.rs b/src/messages/join_group_request.rs index 3f39b94..9ee88aa 100644 --- a/src/messages/join_group_request.rs +++ b/src/messages/join_group_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct JoinGroupRequestProtocol { /// The protocol metadata. @@ -29,6 +30,14 @@ pub struct JoinGroupRequestProtocol { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for JoinGroupRequestProtocol { + type Builder = JoinGroupRequestProtocolBuilder; + + fn builder() -> Self::Builder{ + JoinGroupRequestProtocolBuilder::default() + } +} + impl MapEncodable for JoinGroupRequestProtocol { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -125,6 +134,7 @@ impl Message for JoinGroupRequestProtocol { } /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct JoinGroupRequest { /// The group identifier. @@ -171,6 +181,14 @@ pub struct JoinGroupRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for JoinGroupRequest { + type Builder = JoinGroupRequestBuilder; + + fn builder() -> Self::Builder{ + JoinGroupRequestBuilder::default() + } +} + impl Encodable for JoinGroupRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 6 { diff --git a/src/messages/join_group_response.rs b/src/messages/join_group_response.rs index f3c081e..97cff6f 100644 --- a/src/messages/join_group_response.rs +++ b/src/messages/join_group_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct JoinGroupResponseMember { /// The group member ID. @@ -39,6 +40,14 @@ pub struct JoinGroupResponseMember { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for JoinGroupResponseMember { + type Builder = JoinGroupResponseMemberBuilder; + + fn builder() -> Self::Builder{ + JoinGroupResponseMemberBuilder::default() + } +} + impl Encodable for JoinGroupResponseMember { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 6 { @@ -52,10 +61,6 @@ impl Encodable for JoinGroupResponseMember { } else { types::String.encode(buf, &self.group_instance_id)?; } - } else { - if !self.group_instance_id.is_none() { - return Err(EncodeError) - } } if version >= 6 { types::CompactBytes.encode(buf, &self.metadata)?; @@ -87,10 +92,6 @@ impl Encodable for JoinGroupResponseMember { } else { total_size += types::String.compute_size(&self.group_instance_id)?; } - } else { - if !self.group_instance_id.is_none() { - return Err(EncodeError) - } } if version >= 6 { total_size += types::CompactBytes.compute_size(&self.metadata)?; @@ -168,6 +169,7 @@ impl Message for JoinGroupResponseMember { } /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct JoinGroupResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -219,6 +221,14 @@ pub struct JoinGroupResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for JoinGroupResponse { + type Builder = JoinGroupResponseBuilder; + + fn builder() -> Self::Builder{ + JoinGroupResponseBuilder::default() + } +} + impl Encodable for JoinGroupResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/leader_and_isr_request.rs b/src/messages/leader_and_isr_request.rs index c49a164..6225815 100644 --- a/src/messages/leader_and_isr_request.rs +++ b/src/messages/leader_and_isr_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderAndIsrPartitionState { /// The topic name. This is only present in v0 or v1. @@ -50,10 +51,10 @@ pub struct LeaderAndIsrPartitionState { /// Supported API versions: 0-6 pub isr: Vec, - /// The ZooKeeper version. + /// The current epoch for the partition. The epoch is a monotonically increasing value which is incremented after every partition change. (Since the LeaderAndIsr request is only used by the legacy controller, this corresponds to the zkVersion) /// /// Supported API versions: 0-6 - pub zk_version: i32, + pub partition_epoch: i32, /// The replica IDs. /// @@ -84,6 +85,14 @@ pub struct LeaderAndIsrPartitionState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderAndIsrPartitionState { + type Builder = LeaderAndIsrPartitionStateBuilder; + + fn builder() -> Self::Builder{ + LeaderAndIsrPartitionStateBuilder::default() + } +} + impl Encodable for LeaderAndIsrPartitionState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 1 { @@ -98,7 +107,7 @@ impl Encodable for LeaderAndIsrPartitionState { } else { types::Array(types::Int32).encode(buf, &self.isr)?; } - types::Int32.encode(buf, &self.zk_version)?; + types::Int32.encode(buf, &self.partition_epoch)?; if version >= 4 { types::CompactArray(types::Int32).encode(buf, &self.replicas)?; } else { @@ -154,7 +163,7 @@ impl Encodable for LeaderAndIsrPartitionState { } else { total_size += types::Array(types::Int32).compute_size(&self.isr)?; } - total_size += types::Int32.compute_size(&self.zk_version)?; + total_size += types::Int32.compute_size(&self.partition_epoch)?; if version >= 4 { total_size += types::CompactArray(types::Int32).compute_size(&self.replicas)?; } else { @@ -214,7 +223,7 @@ impl Decodable for LeaderAndIsrPartitionState { } else { types::Array(types::Int32).decode(buf)? }; - let zk_version = types::Int32.decode(buf)?; + let partition_epoch = types::Int32.decode(buf)?; let replicas = if version >= 4 { types::CompactArray(types::Int32).decode(buf)? } else { @@ -266,7 +275,7 @@ impl Decodable for LeaderAndIsrPartitionState { leader, leader_epoch, isr, - zk_version, + partition_epoch, replicas, adding_replicas, removing_replicas, @@ -286,7 +295,7 @@ impl Default for LeaderAndIsrPartitionState { leader: (0).into(), leader_epoch: 0, isr: Default::default(), - zk_version: 0, + partition_epoch: 0, replicas: Default::default(), adding_replicas: Default::default(), removing_replicas: Default::default(), @@ -302,6 +311,7 @@ impl Message for LeaderAndIsrPartitionState { } /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderAndIsrTopicState { /// The topic name. @@ -323,6 +333,14 @@ pub struct LeaderAndIsrTopicState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderAndIsrTopicState { + type Builder = LeaderAndIsrTopicStateBuilder; + + fn builder() -> Self::Builder{ + LeaderAndIsrTopicStateBuilder::default() + } +} + impl Encodable for LeaderAndIsrTopicState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -464,6 +482,7 @@ impl Message for LeaderAndIsrTopicState { } /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderAndIsrLiveLeader { /// The leader's broker ID. @@ -485,6 +504,14 @@ pub struct LeaderAndIsrLiveLeader { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderAndIsrLiveLeader { + type Builder = LeaderAndIsrLiveLeaderBuilder; + + fn builder() -> Self::Builder{ + LeaderAndIsrLiveLeaderBuilder::default() + } +} + impl Encodable for LeaderAndIsrLiveLeader { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.broker_id)?; @@ -574,6 +601,7 @@ impl Message for LeaderAndIsrLiveLeader { } /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderAndIsrRequest { /// The current controller ID. @@ -615,6 +643,14 @@ pub struct LeaderAndIsrRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderAndIsrRequest { + type Builder = LeaderAndIsrRequestBuilder; + + fn builder() -> Self::Builder{ + LeaderAndIsrRequestBuilder::default() + } +} + impl Encodable for LeaderAndIsrRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.controller_id)?; diff --git a/src/messages/leader_and_isr_response.rs b/src/messages/leader_and_isr_response.rs index fada4e8..c78067f 100644 --- a/src/messages/leader_and_isr_response.rs +++ b/src/messages/leader_and_isr_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderAndIsrPartitionError { /// The topic name. @@ -39,6 +40,14 @@ pub struct LeaderAndIsrPartitionError { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderAndIsrPartitionError { + type Builder = LeaderAndIsrPartitionErrorBuilder; + + fn builder() -> Self::Builder{ + LeaderAndIsrPartitionErrorBuilder::default() + } +} + impl Encodable for LeaderAndIsrPartitionError { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 4 { @@ -136,6 +145,7 @@ impl Message for LeaderAndIsrPartitionError { } /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderAndIsrTopicError { /// Each partition. @@ -147,6 +157,14 @@ pub struct LeaderAndIsrTopicError { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderAndIsrTopicError { + type Builder = LeaderAndIsrTopicErrorBuilder; + + fn builder() -> Self::Builder{ + LeaderAndIsrTopicErrorBuilder::default() + } +} + impl MapEncodable for LeaderAndIsrTopicError { type Key = Uuid; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -251,6 +269,7 @@ impl Message for LeaderAndIsrTopicError { } /// Valid versions: 0-6 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderAndIsrResponse { /// The error code, or 0 if there was no error. @@ -272,6 +291,14 @@ pub struct LeaderAndIsrResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderAndIsrResponse { + type Builder = LeaderAndIsrResponseBuilder; + + fn builder() -> Self::Builder{ + LeaderAndIsrResponseBuilder::default() + } +} + impl Encodable for LeaderAndIsrResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/leader_change_message.rs b/src/messages/leader_change_message.rs index f839e8e..4397419 100644 --- a/src/messages/leader_change_message.rs +++ b/src/messages/leader_change_message.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct Voter { /// @@ -29,6 +30,14 @@ pub struct Voter { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for Voter { + type Builder = VoterBuilder; + + fn builder() -> Self::Builder{ + VoterBuilder::default() + } +} + impl Encodable for Voter { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.voter_id)?; @@ -90,6 +99,7 @@ impl Message for Voter { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaderChangeMessage { /// The version of the leader change message @@ -116,6 +126,14 @@ pub struct LeaderChangeMessage { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaderChangeMessage { + type Builder = LeaderChangeMessageBuilder; + + fn builder() -> Self::Builder{ + LeaderChangeMessageBuilder::default() + } +} + impl Encodable for LeaderChangeMessage { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.version)?; diff --git a/src/messages/leave_group_request.rs b/src/messages/leave_group_request.rs index e9178c5..c1f0adc 100644 --- a/src/messages/leave_group_request.rs +++ b/src/messages/leave_group_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct MemberIdentity { /// The member ID to remove from the group. @@ -39,6 +40,14 @@ pub struct MemberIdentity { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for MemberIdentity { + type Builder = MemberIdentityBuilder; + + fn builder() -> Self::Builder{ + MemberIdentityBuilder::default() + } +} + impl Encodable for MemberIdentity { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { @@ -180,6 +189,7 @@ impl Message for MemberIdentity { } /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaveGroupRequest { /// The ID of the group to leave. @@ -201,6 +211,14 @@ pub struct LeaveGroupRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaveGroupRequest { + type Builder = LeaveGroupRequestBuilder; + + fn builder() -> Self::Builder{ + LeaveGroupRequestBuilder::default() + } +} + impl Encodable for LeaveGroupRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 4 { diff --git a/src/messages/leave_group_response.rs b/src/messages/leave_group_response.rs index 2165da9..15821de 100644 --- a/src/messages/leave_group_response.rs +++ b/src/messages/leave_group_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct MemberResponse { /// The member ID to remove from the group. @@ -39,6 +40,14 @@ pub struct MemberResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for MemberResponse { + type Builder = MemberResponseBuilder; + + fn builder() -> Self::Builder{ + MemberResponseBuilder::default() + } +} + impl Encodable for MemberResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { @@ -188,6 +197,7 @@ impl Message for MemberResponse { } /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct LeaveGroupResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -209,6 +219,14 @@ pub struct LeaveGroupResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for LeaveGroupResponse { + type Builder = LeaveGroupResponseBuilder; + + fn builder() -> Self::Builder{ + LeaveGroupResponseBuilder::default() + } +} + impl Encodable for LeaveGroupResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/list_groups_request.rs b/src/messages/list_groups_request.rs index 01b0d34..38ee93f 100644 --- a/src/messages/list_groups_request.rs +++ b/src/messages/list_groups_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListGroupsRequest { /// The states of the groups we want to list. If empty all groups are returned with their state. @@ -29,6 +30,14 @@ pub struct ListGroupsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListGroupsRequest { + type Builder = ListGroupsRequestBuilder; + + fn builder() -> Self::Builder{ + ListGroupsRequestBuilder::default() + } +} + impl Encodable for ListGroupsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 4 { diff --git a/src/messages/list_groups_response.rs b/src/messages/list_groups_response.rs index 38d4bd5..8692723 100644 --- a/src/messages/list_groups_response.rs +++ b/src/messages/list_groups_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListedGroup { /// The group ID. @@ -39,6 +40,14 @@ pub struct ListedGroup { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListedGroup { + type Builder = ListedGroupBuilder; + + fn builder() -> Self::Builder{ + ListedGroupBuilder::default() + } +} + impl Encodable for ListedGroup { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { @@ -148,6 +157,7 @@ impl Message for ListedGroup { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListGroupsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -169,6 +179,14 @@ pub struct ListGroupsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListGroupsResponse { + type Builder = ListGroupsResponseBuilder; + + fn builder() -> Self::Builder{ + ListGroupsResponseBuilder::default() + } +} + impl Encodable for ListGroupsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/list_offsets_request.rs b/src/messages/list_offsets_request.rs index e923ade..86ec0dc 100644 --- a/src/messages/list_offsets_request.rs +++ b/src/messages/list_offsets_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListOffsetsPartition { /// The partition index. @@ -44,6 +45,14 @@ pub struct ListOffsetsPartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListOffsetsPartition { + type Builder = ListOffsetsPartitionBuilder; + + fn builder() -> Self::Builder{ + ListOffsetsPartitionBuilder::default() + } +} + impl Encodable for ListOffsetsPartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -150,6 +159,7 @@ impl Message for ListOffsetsPartition { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListOffsetsTopic { /// The topic name. @@ -166,6 +176,14 @@ pub struct ListOffsetsTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListOffsetsTopic { + type Builder = ListOffsetsTopicBuilder; + + fn builder() -> Self::Builder{ + ListOffsetsTopicBuilder::default() + } +} + impl Encodable for ListOffsetsTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 6 { @@ -262,6 +280,7 @@ impl Message for ListOffsetsTopic { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListOffsetsRequest { /// The broker ID of the requestor, or -1 if this request is being made by a normal consumer. @@ -283,6 +302,14 @@ pub struct ListOffsetsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListOffsetsRequest { + type Builder = ListOffsetsRequestBuilder; + + fn builder() -> Self::Builder{ + ListOffsetsRequestBuilder::default() + } +} + impl Encodable for ListOffsetsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.replica_id)?; diff --git a/src/messages/list_offsets_response.rs b/src/messages/list_offsets_response.rs index 6374692..401a24a 100644 --- a/src/messages/list_offsets_response.rs +++ b/src/messages/list_offsets_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListOffsetsPartitionResponse { /// The partition index. @@ -54,6 +55,14 @@ pub struct ListOffsetsPartitionResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListOffsetsPartitionResponse { + type Builder = ListOffsetsPartitionResponseBuilder; + + fn builder() -> Self::Builder{ + ListOffsetsPartitionResponseBuilder::default() + } +} + impl Encodable for ListOffsetsPartitionResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -210,6 +219,7 @@ impl Message for ListOffsetsPartitionResponse { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListOffsetsTopicResponse { /// The topic name @@ -226,6 +236,14 @@ pub struct ListOffsetsTopicResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListOffsetsTopicResponse { + type Builder = ListOffsetsTopicResponseBuilder; + + fn builder() -> Self::Builder{ + ListOffsetsTopicResponseBuilder::default() + } +} + impl Encodable for ListOffsetsTopicResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 6 { @@ -322,6 +340,7 @@ impl Message for ListOffsetsTopicResponse { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListOffsetsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -338,6 +357,14 @@ pub struct ListOffsetsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListOffsetsResponse { + type Builder = ListOffsetsResponseBuilder; + + fn builder() -> Self::Builder{ + ListOffsetsResponseBuilder::default() + } +} + impl Encodable for ListOffsetsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/list_partition_reassignments_request.rs b/src/messages/list_partition_reassignments_request.rs index 70db925..9f46e3a 100644 --- a/src/messages/list_partition_reassignments_request.rs +++ b/src/messages/list_partition_reassignments_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListPartitionReassignmentsTopics { /// The topic name @@ -34,6 +35,14 @@ pub struct ListPartitionReassignmentsTopics { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListPartitionReassignmentsTopics { + type Builder = ListPartitionReassignmentsTopicsBuilder; + + fn builder() -> Self::Builder{ + ListPartitionReassignmentsTopicsBuilder::default() + } +} + impl Encodable for ListPartitionReassignmentsTopics { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -100,6 +109,7 @@ impl Message for ListPartitionReassignmentsTopics { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListPartitionReassignmentsRequest { /// The time in ms to wait for the request to complete. @@ -116,6 +126,14 @@ pub struct ListPartitionReassignmentsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListPartitionReassignmentsRequest { + type Builder = ListPartitionReassignmentsRequestBuilder; + + fn builder() -> Self::Builder{ + ListPartitionReassignmentsRequestBuilder::default() + } +} + impl Encodable for ListPartitionReassignmentsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.timeout_ms)?; diff --git a/src/messages/list_partition_reassignments_response.rs b/src/messages/list_partition_reassignments_response.rs index 5dd1273..0f5c9c3 100644 --- a/src/messages/list_partition_reassignments_response.rs +++ b/src/messages/list_partition_reassignments_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OngoingPartitionReassignment { /// The index of the partition. @@ -44,6 +45,14 @@ pub struct OngoingPartitionReassignment { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OngoingPartitionReassignment { + type Builder = OngoingPartitionReassignmentBuilder; + + fn builder() -> Self::Builder{ + OngoingPartitionReassignmentBuilder::default() + } +} + impl Encodable for OngoingPartitionReassignment { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -120,6 +129,7 @@ impl Message for OngoingPartitionReassignment { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OngoingTopicReassignment { /// The topic name. @@ -136,6 +146,14 @@ pub struct OngoingTopicReassignment { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OngoingTopicReassignment { + type Builder = OngoingTopicReassignmentBuilder; + + fn builder() -> Self::Builder{ + OngoingTopicReassignmentBuilder::default() + } +} + impl Encodable for OngoingTopicReassignment { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.name)?; @@ -202,6 +220,7 @@ impl Message for OngoingTopicReassignment { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListPartitionReassignmentsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -228,6 +247,14 @@ pub struct ListPartitionReassignmentsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListPartitionReassignmentsResponse { + type Builder = ListPartitionReassignmentsResponseBuilder; + + fn builder() -> Self::Builder{ + ListPartitionReassignmentsResponseBuilder::default() + } +} + impl Encodable for ListPartitionReassignmentsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/list_transactions_request.rs b/src/messages/list_transactions_request.rs index 686ed68..ff6a261 100644 --- a/src/messages/list_transactions_request.rs +++ b/src/messages/list_transactions_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListTransactionsRequest { /// The transaction states to filter by: if empty, all transactions are returned; if non-empty, then only transactions matching one of the filtered states will be returned @@ -34,6 +35,14 @@ pub struct ListTransactionsRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListTransactionsRequest { + type Builder = ListTransactionsRequestBuilder; + + fn builder() -> Self::Builder{ + ListTransactionsRequestBuilder::default() + } +} + impl Encodable for ListTransactionsRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactArray(types::CompactString).encode(buf, &self.state_filters)?; diff --git a/src/messages/list_transactions_response.rs b/src/messages/list_transactions_response.rs index b2c882c..f5ac7b0 100644 --- a/src/messages/list_transactions_response.rs +++ b/src/messages/list_transactions_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TransactionState { /// @@ -39,6 +40,14 @@ pub struct TransactionState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TransactionState { + type Builder = TransactionStateBuilder; + + fn builder() -> Self::Builder{ + TransactionStateBuilder::default() + } +} + impl Encodable for TransactionState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.transactional_id)?; @@ -110,6 +119,7 @@ impl Message for TransactionState { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ListTransactionsResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -136,6 +146,14 @@ pub struct ListTransactionsResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ListTransactionsResponse { + type Builder = ListTransactionsResponseBuilder; + + fn builder() -> Self::Builder{ + ListTransactionsResponseBuilder::default() + } +} + impl Encodable for ListTransactionsResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/metadata_request.rs b/src/messages/metadata_request.rs index 191d1f8..276295b 100644 --- a/src/messages/metadata_request.rs +++ b/src/messages/metadata_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-12 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct MetadataRequestTopic { /// The topic id. @@ -34,6 +35,14 @@ pub struct MetadataRequestTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for MetadataRequestTopic { + type Builder = MetadataRequestTopicBuilder; + + fn builder() -> Self::Builder{ + MetadataRequestTopicBuilder::default() + } +} + impl Encodable for MetadataRequestTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 10 { @@ -126,6 +135,7 @@ impl Message for MetadataRequestTopic { } /// Valid versions: 0-12 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct MetadataRequest { /// The topics to fetch metadata for. @@ -152,6 +162,14 @@ pub struct MetadataRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for MetadataRequest { + type Builder = MetadataRequestBuilder; + + fn builder() -> Self::Builder{ + MetadataRequestBuilder::default() + } +} + impl Encodable for MetadataRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 9 { diff --git a/src/messages/metadata_response.rs b/src/messages/metadata_response.rs index d535422..a6b1da1 100644 --- a/src/messages/metadata_response.rs +++ b/src/messages/metadata_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-12 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct MetadataResponseBroker { /// The broker hostname. @@ -39,6 +40,14 @@ pub struct MetadataResponseBroker { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for MetadataResponseBroker { + type Builder = MetadataResponseBrokerBuilder; + + fn builder() -> Self::Builder{ + MetadataResponseBrokerBuilder::default() + } +} + impl MapEncodable for MetadataResponseBroker { type Key = super::BrokerId; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -153,6 +162,7 @@ impl Message for MetadataResponseBroker { } /// Valid versions: 0-12 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct MetadataResponsePartition { /// The partition error, or 0 if there was no error. @@ -194,6 +204,14 @@ pub struct MetadataResponsePartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for MetadataResponsePartition { + type Builder = MetadataResponsePartitionBuilder; + + fn builder() -> Self::Builder{ + MetadataResponsePartitionBuilder::default() + } +} + impl Encodable for MetadataResponsePartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -343,6 +361,7 @@ impl Message for MetadataResponsePartition { } /// Valid versions: 0-12 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct MetadataResponseTopic { /// The topic error, or 0 if there was no error. @@ -374,6 +393,14 @@ pub struct MetadataResponseTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for MetadataResponseTopic { + type Builder = MetadataResponseTopicBuilder; + + fn builder() -> Self::Builder{ + MetadataResponseTopicBuilder::default() + } +} + impl MapEncodable for MetadataResponseTopic { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -522,6 +549,7 @@ impl Message for MetadataResponseTopic { } /// Valid versions: 0-12 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct MetadataResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -558,6 +586,14 @@ pub struct MetadataResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for MetadataResponse { + type Builder = MetadataResponseBuilder; + + fn builder() -> Self::Builder{ + MetadataResponseBuilder::default() + } +} + impl Encodable for MetadataResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/offset_commit_request.rs b/src/messages/offset_commit_request.rs index f189c03..b68ef71 100644 --- a/src/messages/offset_commit_request.rs +++ b/src/messages/offset_commit_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetCommitRequestPartition { /// The partition index. @@ -49,6 +50,14 @@ pub struct OffsetCommitRequestPartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetCommitRequestPartition { + type Builder = OffsetCommitRequestPartitionBuilder; + + fn builder() -> Self::Builder{ + OffsetCommitRequestPartitionBuilder::default() + } +} + impl Encodable for OffsetCommitRequestPartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -172,6 +181,7 @@ impl Message for OffsetCommitRequestPartition { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetCommitRequestTopic { /// The topic name. @@ -188,6 +198,14 @@ pub struct OffsetCommitRequestTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetCommitRequestTopic { + type Builder = OffsetCommitRequestTopicBuilder; + + fn builder() -> Self::Builder{ + OffsetCommitRequestTopicBuilder::default() + } +} + impl Encodable for OffsetCommitRequestTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 8 { @@ -284,6 +302,7 @@ impl Message for OffsetCommitRequestTopic { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetCommitRequest { /// The unique group identifier. @@ -320,6 +339,14 @@ pub struct OffsetCommitRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetCommitRequest { + type Builder = OffsetCommitRequestBuilder; + + fn builder() -> Self::Builder{ + OffsetCommitRequestBuilder::default() + } +} + impl Encodable for OffsetCommitRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 8 { diff --git a/src/messages/offset_commit_response.rs b/src/messages/offset_commit_response.rs index 5cf6c66..d043951 100644 --- a/src/messages/offset_commit_response.rs +++ b/src/messages/offset_commit_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetCommitResponsePartition { /// The partition index. @@ -34,6 +35,14 @@ pub struct OffsetCommitResponsePartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetCommitResponsePartition { + type Builder = OffsetCommitResponsePartitionBuilder; + + fn builder() -> Self::Builder{ + OffsetCommitResponsePartitionBuilder::default() + } +} + impl Encodable for OffsetCommitResponsePartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -106,6 +115,7 @@ impl Message for OffsetCommitResponsePartition { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetCommitResponseTopic { /// The topic name. @@ -122,6 +132,14 @@ pub struct OffsetCommitResponseTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetCommitResponseTopic { + type Builder = OffsetCommitResponseTopicBuilder; + + fn builder() -> Self::Builder{ + OffsetCommitResponseTopicBuilder::default() + } +} + impl Encodable for OffsetCommitResponseTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 8 { @@ -218,6 +236,7 @@ impl Message for OffsetCommitResponseTopic { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetCommitResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -234,6 +253,14 @@ pub struct OffsetCommitResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetCommitResponse { + type Builder = OffsetCommitResponseBuilder; + + fn builder() -> Self::Builder{ + OffsetCommitResponseBuilder::default() + } +} + impl Encodable for OffsetCommitResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/offset_delete_request.rs b/src/messages/offset_delete_request.rs index fe31590..7f9c668 100644 --- a/src/messages/offset_delete_request.rs +++ b/src/messages/offset_delete_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetDeleteRequestPartition { /// The partition index. @@ -27,6 +28,14 @@ pub struct OffsetDeleteRequestPartition { } +impl Builder for OffsetDeleteRequestPartition { + type Builder = OffsetDeleteRequestPartitionBuilder; + + fn builder() -> Self::Builder{ + OffsetDeleteRequestPartitionBuilder::default() + } +} + impl Encodable for OffsetDeleteRequestPartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -63,6 +72,7 @@ impl Message for OffsetDeleteRequestPartition { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetDeleteRequestTopic { /// Each partition to delete offsets for. @@ -72,6 +82,14 @@ pub struct OffsetDeleteRequestTopic { } +impl Builder for OffsetDeleteRequestTopic { + type Builder = OffsetDeleteRequestTopicBuilder; + + fn builder() -> Self::Builder{ + OffsetDeleteRequestTopicBuilder::default() + } +} + impl MapEncodable for OffsetDeleteRequestTopic { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -113,6 +131,7 @@ impl Message for OffsetDeleteRequestTopic { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetDeleteRequest { /// The unique group identifier. @@ -127,6 +146,14 @@ pub struct OffsetDeleteRequest { } +impl Builder for OffsetDeleteRequest { + type Builder = OffsetDeleteRequestBuilder; + + fn builder() -> Self::Builder{ + OffsetDeleteRequestBuilder::default() + } +} + impl Encodable for OffsetDeleteRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::String.encode(buf, &self.group_id)?; diff --git a/src/messages/offset_delete_response.rs b/src/messages/offset_delete_response.rs index cbf05b6..0a399e6 100644 --- a/src/messages/offset_delete_response.rs +++ b/src/messages/offset_delete_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetDeleteResponsePartition { /// The error code, or 0 if there was no error. @@ -27,6 +28,14 @@ pub struct OffsetDeleteResponsePartition { } +impl Builder for OffsetDeleteResponsePartition { + type Builder = OffsetDeleteResponsePartitionBuilder; + + fn builder() -> Self::Builder{ + OffsetDeleteResponsePartitionBuilder::default() + } +} + impl MapEncodable for OffsetDeleteResponsePartition { type Key = i32; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -68,6 +77,7 @@ impl Message for OffsetDeleteResponsePartition { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetDeleteResponseTopic { /// The responses for each partition in the topic. @@ -77,6 +87,14 @@ pub struct OffsetDeleteResponseTopic { } +impl Builder for OffsetDeleteResponseTopic { + type Builder = OffsetDeleteResponseTopicBuilder; + + fn builder() -> Self::Builder{ + OffsetDeleteResponseTopicBuilder::default() + } +} + impl MapEncodable for OffsetDeleteResponseTopic { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -118,6 +136,7 @@ impl Message for OffsetDeleteResponseTopic { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetDeleteResponse { /// The top-level error code, or 0 if there was no error. @@ -137,6 +156,14 @@ pub struct OffsetDeleteResponse { } +impl Builder for OffsetDeleteResponse { + type Builder = OffsetDeleteResponseBuilder; + + fn builder() -> Self::Builder{ + OffsetDeleteResponseBuilder::default() + } +} + impl Encodable for OffsetDeleteResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/offset_fetch_request.rs b/src/messages/offset_fetch_request.rs index 42f2954..c346429 100644 --- a/src/messages/offset_fetch_request.rs +++ b/src/messages/offset_fetch_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchRequestTopic { /// The topic name. @@ -34,6 +35,14 @@ pub struct OffsetFetchRequestTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchRequestTopic { + type Builder = OffsetFetchRequestTopicBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchRequestTopicBuilder::default() + } +} + impl Encodable for OffsetFetchRequestTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 7 { @@ -162,6 +171,7 @@ impl Message for OffsetFetchRequestTopic { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchRequestTopics { /// The topic name. @@ -178,6 +188,14 @@ pub struct OffsetFetchRequestTopics { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchRequestTopics { + type Builder = OffsetFetchRequestTopicsBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchRequestTopicsBuilder::default() + } +} + impl Encodable for OffsetFetchRequestTopics { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 8 { @@ -282,6 +300,7 @@ impl Message for OffsetFetchRequestTopics { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchRequestGroup { /// The group ID. @@ -298,6 +317,14 @@ pub struct OffsetFetchRequestGroup { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchRequestGroup { + type Builder = OffsetFetchRequestGroupBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchRequestGroupBuilder::default() + } +} + impl Encodable for OffsetFetchRequestGroup { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 8 { @@ -402,6 +429,7 @@ impl Message for OffsetFetchRequestGroup { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchRequest { /// The group to fetch offsets for. @@ -428,6 +456,14 @@ pub struct OffsetFetchRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchRequest { + type Builder = OffsetFetchRequestBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchRequestBuilder::default() + } +} + impl Encodable for OffsetFetchRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 7 { diff --git a/src/messages/offset_fetch_response.rs b/src/messages/offset_fetch_response.rs index 396c4d3..2e18ae2 100644 --- a/src/messages/offset_fetch_response.rs +++ b/src/messages/offset_fetch_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchResponsePartition { /// The partition index. @@ -49,6 +50,14 @@ pub struct OffsetFetchResponsePartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchResponsePartition { + type Builder = OffsetFetchResponsePartitionBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchResponsePartitionBuilder::default() + } +} + impl Encodable for OffsetFetchResponsePartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 7 { @@ -220,6 +229,7 @@ impl Message for OffsetFetchResponsePartition { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchResponseTopic { /// The topic name. @@ -236,6 +246,14 @@ pub struct OffsetFetchResponseTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchResponseTopic { + type Builder = OffsetFetchResponseTopicBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchResponseTopicBuilder::default() + } +} + impl Encodable for OffsetFetchResponseTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 7 { @@ -364,6 +382,7 @@ impl Message for OffsetFetchResponseTopic { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchResponsePartitions { /// The partition index. @@ -395,6 +414,14 @@ pub struct OffsetFetchResponsePartitions { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchResponsePartitions { + type Builder = OffsetFetchResponsePartitionsBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchResponsePartitionsBuilder::default() + } +} + impl Encodable for OffsetFetchResponsePartitions { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 8 { @@ -554,6 +581,7 @@ impl Message for OffsetFetchResponsePartitions { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchResponseTopics { /// The topic name. @@ -570,6 +598,14 @@ pub struct OffsetFetchResponseTopics { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchResponseTopics { + type Builder = OffsetFetchResponseTopicsBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchResponseTopicsBuilder::default() + } +} + impl Encodable for OffsetFetchResponseTopics { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 8 { @@ -674,6 +710,7 @@ impl Message for OffsetFetchResponseTopics { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchResponseGroup { /// The group ID. @@ -695,6 +732,14 @@ pub struct OffsetFetchResponseGroup { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchResponseGroup { + type Builder = OffsetFetchResponseGroupBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchResponseGroupBuilder::default() + } +} + impl Encodable for OffsetFetchResponseGroup { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 8 { @@ -820,6 +865,7 @@ impl Message for OffsetFetchResponseGroup { } /// Valid versions: 0-8 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetFetchResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -846,6 +892,14 @@ pub struct OffsetFetchResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetFetchResponse { + type Builder = OffsetFetchResponseBuilder; + + fn builder() -> Self::Builder{ + OffsetFetchResponseBuilder::default() + } +} + impl Encodable for OffsetFetchResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/offset_for_leader_epoch_request.rs b/src/messages/offset_for_leader_epoch_request.rs index 168b5ac..44e2f37 100644 --- a/src/messages/offset_for_leader_epoch_request.rs +++ b/src/messages/offset_for_leader_epoch_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetForLeaderPartition { /// The partition index. @@ -39,6 +40,14 @@ pub struct OffsetForLeaderPartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetForLeaderPartition { + type Builder = OffsetForLeaderPartitionBuilder; + + fn builder() -> Self::Builder{ + OffsetForLeaderPartitionBuilder::default() + } +} + impl Encodable for OffsetForLeaderPartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition)?; @@ -124,6 +133,7 @@ impl Message for OffsetForLeaderPartition { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetForLeaderTopic { /// Each partition to get offsets for. @@ -135,6 +145,14 @@ pub struct OffsetForLeaderTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetForLeaderTopic { + type Builder = OffsetForLeaderTopicBuilder; + + fn builder() -> Self::Builder{ + OffsetForLeaderTopicBuilder::default() + } +} + impl MapEncodable for OffsetForLeaderTopic { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -231,6 +249,7 @@ impl Message for OffsetForLeaderTopic { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetForLeaderEpochRequest { /// The broker ID of the follower, of -1 if this request is from a consumer. @@ -247,6 +266,14 @@ pub struct OffsetForLeaderEpochRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetForLeaderEpochRequest { + type Builder = OffsetForLeaderEpochRequestBuilder; + + fn builder() -> Self::Builder{ + OffsetForLeaderEpochRequestBuilder::default() + } +} + impl Encodable for OffsetForLeaderEpochRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/offset_for_leader_epoch_response.rs b/src/messages/offset_for_leader_epoch_response.rs index e94a5c2..b99cc29 100644 --- a/src/messages/offset_for_leader_epoch_response.rs +++ b/src/messages/offset_for_leader_epoch_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct EpochEndOffset { /// The error code 0, or if there was no error. @@ -44,6 +45,14 @@ pub struct EpochEndOffset { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for EpochEndOffset { + type Builder = EpochEndOffsetBuilder; + + fn builder() -> Self::Builder{ + EpochEndOffsetBuilder::default() + } +} + impl Encodable for EpochEndOffset { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; @@ -134,6 +143,7 @@ impl Message for EpochEndOffset { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetForLeaderTopicResult { /// Each partition in the topic we fetched offsets for. @@ -145,6 +155,14 @@ pub struct OffsetForLeaderTopicResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetForLeaderTopicResult { + type Builder = OffsetForLeaderTopicResultBuilder; + + fn builder() -> Self::Builder{ + OffsetForLeaderTopicResultBuilder::default() + } +} + impl MapEncodable for OffsetForLeaderTopicResult { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -241,6 +259,7 @@ impl Message for OffsetForLeaderTopicResult { } /// Valid versions: 0-4 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct OffsetForLeaderEpochResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -257,6 +276,14 @@ pub struct OffsetForLeaderEpochResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for OffsetForLeaderEpochResponse { + type Builder = OffsetForLeaderEpochResponseBuilder; + + fn builder() -> Self::Builder{ + OffsetForLeaderEpochResponseBuilder::default() + } +} + impl Encodable for OffsetForLeaderEpochResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/produce_request.rs b/src/messages/produce_request.rs index 4b71581..8c2e099 100644 --- a/src/messages/produce_request.rs +++ b/src/messages/produce_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionProduceData { /// The partition index. @@ -34,6 +35,14 @@ pub struct PartitionProduceData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionProduceData { + type Builder = PartitionProduceDataBuilder; + + fn builder() -> Self::Builder{ + PartitionProduceDataBuilder::default() + } +} + impl Encodable for PartitionProduceData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.index)?; @@ -118,6 +127,7 @@ impl Message for PartitionProduceData { } /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicProduceData { /// Each partition to produce to. @@ -129,6 +139,14 @@ pub struct TopicProduceData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicProduceData { + type Builder = TopicProduceDataBuilder; + + fn builder() -> Self::Builder{ + TopicProduceDataBuilder::default() + } +} + impl MapEncodable for TopicProduceData { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -225,6 +243,7 @@ impl Message for TopicProduceData { } /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ProduceRequest { /// The transactional ID, or null if the producer is not transactional. @@ -251,6 +270,14 @@ pub struct ProduceRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ProduceRequest { + type Builder = ProduceRequestBuilder; + + fn builder() -> Self::Builder{ + ProduceRequestBuilder::default() + } +} + impl Encodable for ProduceRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/produce_response.rs b/src/messages/produce_response.rs index aafa67f..a53613b 100644 --- a/src/messages/produce_response.rs +++ b/src/messages/produce_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct BatchIndexAndErrorMessage { /// The batch index of the record that cause the batch to be dropped @@ -34,6 +35,14 @@ pub struct BatchIndexAndErrorMessage { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for BatchIndexAndErrorMessage { + type Builder = BatchIndexAndErrorMessageBuilder; + + fn builder() -> Self::Builder{ + BatchIndexAndErrorMessageBuilder::default() + } +} + impl Encodable for BatchIndexAndErrorMessage { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 8 { @@ -150,6 +159,7 @@ impl Message for BatchIndexAndErrorMessage { } /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionProduceResponse { /// The partition index. @@ -191,6 +201,14 @@ pub struct PartitionProduceResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionProduceResponse { + type Builder = PartitionProduceResponseBuilder; + + fn builder() -> Self::Builder{ + PartitionProduceResponseBuilder::default() + } +} + impl Encodable for PartitionProduceResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.index)?; @@ -344,6 +362,7 @@ impl Message for PartitionProduceResponse { } /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicProduceResponse { /// Each partition that we produced to within the topic. @@ -355,6 +374,14 @@ pub struct TopicProduceResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicProduceResponse { + type Builder = TopicProduceResponseBuilder; + + fn builder() -> Self::Builder{ + TopicProduceResponseBuilder::default() + } +} + impl MapEncodable for TopicProduceResponse { type Key = super::TopicName; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -451,6 +478,7 @@ impl Message for TopicProduceResponse { } /// Valid versions: 0-9 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ProduceResponse { /// Each produce response @@ -467,6 +495,14 @@ pub struct ProduceResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ProduceResponse { + type Builder = ProduceResponseBuilder; + + fn builder() -> Self::Builder{ + ProduceResponseBuilder::default() + } +} + impl Encodable for ProduceResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 9 { diff --git a/src/messages/renew_delegation_token_request.rs b/src/messages/renew_delegation_token_request.rs index d70658f..eecc1e1 100644 --- a/src/messages/renew_delegation_token_request.rs +++ b/src/messages/renew_delegation_token_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct RenewDelegationTokenRequest { /// The HMAC of the delegation token to be renewed. @@ -34,6 +35,14 @@ pub struct RenewDelegationTokenRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for RenewDelegationTokenRequest { + type Builder = RenewDelegationTokenRequestBuilder; + + fn builder() -> Self::Builder{ + RenewDelegationTokenRequestBuilder::default() + } +} + impl Encodable for RenewDelegationTokenRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/renew_delegation_token_response.rs b/src/messages/renew_delegation_token_response.rs index b7ac040..dd275e6 100644 --- a/src/messages/renew_delegation_token_response.rs +++ b/src/messages/renew_delegation_token_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct RenewDelegationTokenResponse { /// The error code, or 0 if there was no error. @@ -39,6 +40,14 @@ pub struct RenewDelegationTokenResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for RenewDelegationTokenResponse { + type Builder = RenewDelegationTokenResponseBuilder; + + fn builder() -> Self::Builder{ + RenewDelegationTokenResponseBuilder::default() + } +} + impl Encodable for RenewDelegationTokenResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/request_header.rs b/src/messages/request_header.rs index 9d52a8b..6aeaa6f 100644 --- a/src/messages/request_header.rs +++ b/src/messages/request_header.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct RequestHeader { /// The API key of this request. @@ -44,6 +45,14 @@ pub struct RequestHeader { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for RequestHeader { + type Builder = RequestHeaderBuilder; + + fn builder() -> Self::Builder{ + RequestHeaderBuilder::default() + } +} + impl Encodable for RequestHeader { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.request_api_key)?; diff --git a/src/messages/response_header.rs b/src/messages/response_header.rs index c43d3b8..69886d1 100644 --- a/src/messages/response_header.rs +++ b/src/messages/response_header.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct ResponseHeader { /// The correlation ID of this response. @@ -29,6 +30,14 @@ pub struct ResponseHeader { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for ResponseHeader { + type Builder = ResponseHeaderBuilder; + + fn builder() -> Self::Builder{ + ResponseHeaderBuilder::default() + } +} + impl Encodable for ResponseHeader { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.correlation_id)?; diff --git a/src/messages/sasl_authenticate_request.rs b/src/messages/sasl_authenticate_request.rs index 1c1f05b..346d980 100644 --- a/src/messages/sasl_authenticate_request.rs +++ b/src/messages/sasl_authenticate_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SaslAuthenticateRequest { /// The SASL authentication bytes from the client, as defined by the SASL mechanism. @@ -29,6 +30,14 @@ pub struct SaslAuthenticateRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SaslAuthenticateRequest { + type Builder = SaslAuthenticateRequestBuilder; + + fn builder() -> Self::Builder{ + SaslAuthenticateRequestBuilder::default() + } +} + impl Encodable for SaslAuthenticateRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { diff --git a/src/messages/sasl_authenticate_response.rs b/src/messages/sasl_authenticate_response.rs index 821593d..7959ba1 100644 --- a/src/messages/sasl_authenticate_response.rs +++ b/src/messages/sasl_authenticate_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-2 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SaslAuthenticateResponse { /// The error code, or 0 if there was no error. @@ -44,6 +45,14 @@ pub struct SaslAuthenticateResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SaslAuthenticateResponse { + type Builder = SaslAuthenticateResponseBuilder; + + fn builder() -> Self::Builder{ + SaslAuthenticateResponseBuilder::default() + } +} + impl Encodable for SaslAuthenticateResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/sasl_handshake_request.rs b/src/messages/sasl_handshake_request.rs index 8f59607..5217d92 100644 --- a/src/messages/sasl_handshake_request.rs +++ b/src/messages/sasl_handshake_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SaslHandshakeRequest { /// The SASL mechanism chosen by the client. @@ -27,6 +28,14 @@ pub struct SaslHandshakeRequest { } +impl Builder for SaslHandshakeRequest { + type Builder = SaslHandshakeRequestBuilder; + + fn builder() -> Self::Builder{ + SaslHandshakeRequestBuilder::default() + } +} + impl Encodable for SaslHandshakeRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::String.encode(buf, &self.mechanism)?; diff --git a/src/messages/sasl_handshake_response.rs b/src/messages/sasl_handshake_response.rs index 750143c..396c649 100644 --- a/src/messages/sasl_handshake_response.rs +++ b/src/messages/sasl_handshake_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SaslHandshakeResponse { /// The error code, or 0 if there was no error. @@ -32,6 +33,14 @@ pub struct SaslHandshakeResponse { } +impl Builder for SaslHandshakeResponse { + type Builder = SaslHandshakeResponseBuilder; + + fn builder() -> Self::Builder{ + SaslHandshakeResponseBuilder::default() + } +} + impl Encodable for SaslHandshakeResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/snapshot_footer_record.rs b/src/messages/snapshot_footer_record.rs index b5c5b5d..622ad6f 100644 --- a/src/messages/snapshot_footer_record.rs +++ b/src/messages/snapshot_footer_record.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SnapshotFooterRecord { /// The version of the snapshot footer record @@ -29,6 +30,14 @@ pub struct SnapshotFooterRecord { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SnapshotFooterRecord { + type Builder = SnapshotFooterRecordBuilder; + + fn builder() -> Self::Builder{ + SnapshotFooterRecordBuilder::default() + } +} + impl Encodable for SnapshotFooterRecord { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.version)?; diff --git a/src/messages/snapshot_header_record.rs b/src/messages/snapshot_header_record.rs index 278f893..4cf5dc1 100644 --- a/src/messages/snapshot_header_record.rs +++ b/src/messages/snapshot_header_record.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SnapshotHeaderRecord { /// The version of the snapshot header record @@ -34,6 +35,14 @@ pub struct SnapshotHeaderRecord { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SnapshotHeaderRecord { + type Builder = SnapshotHeaderRecordBuilder; + + fn builder() -> Self::Builder{ + SnapshotHeaderRecordBuilder::default() + } +} + impl Encodable for SnapshotHeaderRecord { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.version)?; diff --git a/src/messages/stop_replica_request.rs b/src/messages/stop_replica_request.rs index c4814aa..eec1a48 100644 --- a/src/messages/stop_replica_request.rs +++ b/src/messages/stop_replica_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct StopReplicaPartitionV0 { /// The topic name. @@ -34,6 +35,14 @@ pub struct StopReplicaPartitionV0 { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for StopReplicaPartitionV0 { + type Builder = StopReplicaPartitionV0Builder; + + fn builder() -> Self::Builder{ + StopReplicaPartitionV0Builder::default() + } +} + impl Encodable for StopReplicaPartitionV0 { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version == 0 { @@ -138,6 +147,7 @@ impl Message for StopReplicaPartitionV0 { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct StopReplicaTopicV1 { /// The topic name. @@ -154,6 +164,14 @@ pub struct StopReplicaTopicV1 { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for StopReplicaTopicV1 { + type Builder = StopReplicaTopicV1Builder; + + fn builder() -> Self::Builder{ + StopReplicaTopicV1Builder::default() + } +} + impl Encodable for StopReplicaTopicV1 { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 && version <= 2 { @@ -282,6 +300,7 @@ impl Message for StopReplicaTopicV1 { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct StopReplicaPartitionState { /// The partition index. @@ -303,6 +322,14 @@ pub struct StopReplicaPartitionState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for StopReplicaPartitionState { + type Builder = StopReplicaPartitionStateBuilder; + + fn builder() -> Self::Builder{ + StopReplicaPartitionStateBuilder::default() + } +} + impl Encodable for StopReplicaPartitionState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { @@ -428,6 +455,7 @@ impl Message for StopReplicaPartitionState { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct StopReplicaTopicState { /// The topic name. @@ -444,6 +472,14 @@ pub struct StopReplicaTopicState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for StopReplicaTopicState { + type Builder = StopReplicaTopicStateBuilder; + + fn builder() -> Self::Builder{ + StopReplicaTopicStateBuilder::default() + } +} + impl Encodable for StopReplicaTopicState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { @@ -548,6 +584,7 @@ impl Message for StopReplicaTopicState { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct StopReplicaRequest { /// The controller id. @@ -589,6 +626,14 @@ pub struct StopReplicaRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for StopReplicaRequest { + type Builder = StopReplicaRequestBuilder; + + fn builder() -> Self::Builder{ + StopReplicaRequestBuilder::default() + } +} + impl Encodable for StopReplicaRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.controller_id)?; diff --git a/src/messages/stop_replica_response.rs b/src/messages/stop_replica_response.rs index d4afa94..d7a2ee1 100644 --- a/src/messages/stop_replica_response.rs +++ b/src/messages/stop_replica_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct StopReplicaPartitionError { /// The topic name. @@ -39,6 +40,14 @@ pub struct StopReplicaPartitionError { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for StopReplicaPartitionError { + type Builder = StopReplicaPartitionErrorBuilder; + + fn builder() -> Self::Builder{ + StopReplicaPartitionErrorBuilder::default() + } +} + impl Encodable for StopReplicaPartitionError { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 2 { @@ -128,6 +137,7 @@ impl Message for StopReplicaPartitionError { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct StopReplicaResponse { /// The top-level error code, or 0 if there was no top-level error. @@ -144,6 +154,14 @@ pub struct StopReplicaResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for StopReplicaResponse { + type Builder = StopReplicaResponseBuilder; + + fn builder() -> Self::Builder{ + StopReplicaResponseBuilder::default() + } +} + impl Encodable for StopReplicaResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/sync_group_request.rs b/src/messages/sync_group_request.rs index d06d298..4e289a2 100644 --- a/src/messages/sync_group_request.rs +++ b/src/messages/sync_group_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SyncGroupRequestAssignment { /// The ID of the member to assign. @@ -34,6 +35,14 @@ pub struct SyncGroupRequestAssignment { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SyncGroupRequestAssignment { + type Builder = SyncGroupRequestAssignmentBuilder; + + fn builder() -> Self::Builder{ + SyncGroupRequestAssignmentBuilder::default() + } +} + impl Encodable for SyncGroupRequestAssignment { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 4 { @@ -130,6 +139,7 @@ impl Message for SyncGroupRequestAssignment { } /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SyncGroupRequest { /// The unique group identifier. @@ -171,6 +181,14 @@ pub struct SyncGroupRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SyncGroupRequest { + type Builder = SyncGroupRequestBuilder; + + fn builder() -> Self::Builder{ + SyncGroupRequestBuilder::default() + } +} + impl Encodable for SyncGroupRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 4 { diff --git a/src/messages/sync_group_response.rs b/src/messages/sync_group_response.rs index 32ac34f..48347eb 100644 --- a/src/messages/sync_group_response.rs +++ b/src/messages/sync_group_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-5 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct SyncGroupResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -49,6 +50,14 @@ pub struct SyncGroupResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for SyncGroupResponse { + type Builder = SyncGroupResponseBuilder; + + fn builder() -> Self::Builder{ + SyncGroupResponseBuilder::default() + } +} + impl Encodable for SyncGroupResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/txn_offset_commit_request.rs b/src/messages/txn_offset_commit_request.rs index 3d0df52..8ff3ec0 100644 --- a/src/messages/txn_offset_commit_request.rs +++ b/src/messages/txn_offset_commit_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TxnOffsetCommitRequestPartition { /// The index of the partition within the topic. @@ -44,6 +45,14 @@ pub struct TxnOffsetCommitRequestPartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TxnOffsetCommitRequestPartition { + type Builder = TxnOffsetCommitRequestPartitionBuilder; + + fn builder() -> Self::Builder{ + TxnOffsetCommitRequestPartitionBuilder::default() + } +} + impl Encodable for TxnOffsetCommitRequestPartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -146,6 +155,7 @@ impl Message for TxnOffsetCommitRequestPartition { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TxnOffsetCommitRequestTopic { /// The topic name. @@ -162,6 +172,14 @@ pub struct TxnOffsetCommitRequestTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TxnOffsetCommitRequestTopic { + type Builder = TxnOffsetCommitRequestTopicBuilder; + + fn builder() -> Self::Builder{ + TxnOffsetCommitRequestTopicBuilder::default() + } +} + impl Encodable for TxnOffsetCommitRequestTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { @@ -258,6 +276,7 @@ impl Message for TxnOffsetCommitRequestTopic { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TxnOffsetCommitRequest { /// The ID of the transaction. @@ -304,6 +323,14 @@ pub struct TxnOffsetCommitRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TxnOffsetCommitRequest { + type Builder = TxnOffsetCommitRequestBuilder; + + fn builder() -> Self::Builder{ + TxnOffsetCommitRequestBuilder::default() + } +} + impl Encodable for TxnOffsetCommitRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { diff --git a/src/messages/txn_offset_commit_response.rs b/src/messages/txn_offset_commit_response.rs index 59d2073..3c52688 100644 --- a/src/messages/txn_offset_commit_response.rs +++ b/src/messages/txn_offset_commit_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TxnOffsetCommitResponsePartition { /// The partition index. @@ -34,6 +35,14 @@ pub struct TxnOffsetCommitResponsePartition { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TxnOffsetCommitResponsePartition { + type Builder = TxnOffsetCommitResponsePartitionBuilder; + + fn builder() -> Self::Builder{ + TxnOffsetCommitResponsePartitionBuilder::default() + } +} + impl Encodable for TxnOffsetCommitResponsePartition { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -106,6 +115,7 @@ impl Message for TxnOffsetCommitResponsePartition { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TxnOffsetCommitResponseTopic { /// The topic name. @@ -122,6 +132,14 @@ pub struct TxnOffsetCommitResponseTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TxnOffsetCommitResponseTopic { + type Builder = TxnOffsetCommitResponseTopicBuilder; + + fn builder() -> Self::Builder{ + TxnOffsetCommitResponseTopicBuilder::default() + } +} + impl Encodable for TxnOffsetCommitResponseTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 3 { @@ -218,6 +236,7 @@ impl Message for TxnOffsetCommitResponseTopic { } /// Valid versions: 0-3 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TxnOffsetCommitResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -234,6 +253,14 @@ pub struct TxnOffsetCommitResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TxnOffsetCommitResponse { + type Builder = TxnOffsetCommitResponseBuilder; + + fn builder() -> Self::Builder{ + TxnOffsetCommitResponseBuilder::default() + } +} + impl Encodable for TxnOffsetCommitResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/unregister_broker_request.rs b/src/messages/unregister_broker_request.rs index 7df8cd6..005d617 100644 --- a/src/messages/unregister_broker_request.rs +++ b/src/messages/unregister_broker_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UnregisterBrokerRequest { /// The broker ID to unregister. @@ -29,6 +30,14 @@ pub struct UnregisterBrokerRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UnregisterBrokerRequest { + type Builder = UnregisterBrokerRequestBuilder; + + fn builder() -> Self::Builder{ + UnregisterBrokerRequestBuilder::default() + } +} + impl Encodable for UnregisterBrokerRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.broker_id)?; diff --git a/src/messages/unregister_broker_response.rs b/src/messages/unregister_broker_response.rs index 031f216..92ced3d 100644 --- a/src/messages/unregister_broker_response.rs +++ b/src/messages/unregister_broker_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UnregisterBrokerResponse { /// Duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. @@ -39,6 +40,14 @@ pub struct UnregisterBrokerResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UnregisterBrokerResponse { + type Builder = UnregisterBrokerResponseBuilder; + + fn builder() -> Self::Builder{ + UnregisterBrokerResponseBuilder::default() + } +} + impl Encodable for UnregisterBrokerResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; diff --git a/src/messages/update_features_request.rs b/src/messages/update_features_request.rs index 626b703..45e4112 100644 --- a/src/messages/update_features_request.rs +++ b/src/messages/update_features_request.rs @@ -13,33 +13,60 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct FeatureUpdateKey { /// The new maximum version level for the finalized feature. A value >= 1 is valid. A value < 1, is special, and can be used to request the deletion of the finalized feature. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub max_version_level: i16, - /// When set to true, the finalized feature version level is allowed to be downgraded/deleted. The downgrade request will fail if the new maximum version level is a value that's not lower than the existing maximum finalized version level. + /// DEPRECATED in version 1 (see DowngradeType). When set to true, the finalized feature version level is allowed to be downgraded/deleted. The downgrade request will fail if the new maximum version level is a value that's not lower than the existing maximum finalized version level. /// /// Supported API versions: 0 pub allow_downgrade: bool, + /// Determine which type of upgrade will be performed: 1 will perform an upgrade only (default), 2 is safe downgrades only (lossless), 3 is unsafe downgrades (lossy). + /// + /// Supported API versions: 1 + pub upgrade_type: i8, + /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for FeatureUpdateKey { + type Builder = FeatureUpdateKeyBuilder; + + fn builder() -> Self::Builder{ + FeatureUpdateKeyBuilder::default() + } +} + impl MapEncodable for FeatureUpdateKey { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, key)?; types::Int16.encode(buf, &self.max_version_level)?; - types::Boolean.encode(buf, &self.allow_downgrade)?; + if version == 0 { + types::Boolean.encode(buf, &self.allow_downgrade)?; + } else { + if self.allow_downgrade { + return Err(EncodeError) + } + } + if version >= 1 { + types::Int8.encode(buf, &self.upgrade_type)?; + } else { + if self.upgrade_type != 1 { + return Err(EncodeError) + } + } let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { error!("Too many tagged fields to encode ({} fields)", num_tagged_fields); @@ -54,7 +81,20 @@ impl MapEncodable for FeatureUpdateKey { let mut total_size = 0; total_size += types::CompactString.compute_size(key)?; total_size += types::Int16.compute_size(&self.max_version_level)?; - total_size += types::Boolean.compute_size(&self.allow_downgrade)?; + if version == 0 { + total_size += types::Boolean.compute_size(&self.allow_downgrade)?; + } else { + if self.allow_downgrade { + return Err(EncodeError) + } + } + if version >= 1 { + total_size += types::Int8.compute_size(&self.upgrade_type)?; + } else { + if self.upgrade_type != 1 { + return Err(EncodeError) + } + } let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { error!("Too many tagged fields to encode ({} fields)", num_tagged_fields); @@ -72,7 +112,16 @@ impl MapDecodable for FeatureUpdateKey { fn decode(buf: &mut B, version: i16) -> Result<(Self::Key, Self), DecodeError> { let key_field = types::CompactString.decode(buf)?; let max_version_level = types::Int16.decode(buf)?; - let allow_downgrade = types::Boolean.decode(buf)?; + let allow_downgrade = if version == 0 { + types::Boolean.decode(buf)? + } else { + false + }; + let upgrade_type = if version >= 1 { + types::Int8.decode(buf)? + } else { + 1 + }; let mut unknown_tagged_fields = BTreeMap::new(); let num_tagged_fields = types::UnsignedVarInt.decode(buf)?; for _ in 0..num_tagged_fields { @@ -85,6 +134,7 @@ impl MapDecodable for FeatureUpdateKey { Ok((key_field, Self { max_version_level, allow_downgrade, + upgrade_type, unknown_tagged_fields, })) } @@ -95,36 +145,58 @@ impl Default for FeatureUpdateKey { Self { max_version_level: 0, allow_downgrade: false, + upgrade_type: 1, unknown_tagged_fields: BTreeMap::new(), } } } impl Message for FeatureUpdateKey { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UpdateFeaturesRequest { /// How long to wait in milliseconds before timing out the request. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub timeout_ms: i32, /// The list of updates to finalized features. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub feature_updates: indexmap::IndexMap, + /// True if we should validate the request, but not perform the upgrade or downgrade. + /// + /// Supported API versions: 1 + pub validate_only: bool, + /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UpdateFeaturesRequest { + type Builder = UpdateFeaturesRequestBuilder; + + fn builder() -> Self::Builder{ + UpdateFeaturesRequestBuilder::default() + } +} + impl Encodable for UpdateFeaturesRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.timeout_ms)?; types::CompactArray(types::Struct { version }).encode(buf, &self.feature_updates)?; + if version >= 1 { + types::Boolean.encode(buf, &self.validate_only)?; + } else { + if self.validate_only { + return Err(EncodeError) + } + } let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { error!("Too many tagged fields to encode ({} fields)", num_tagged_fields); @@ -139,6 +211,13 @@ impl Encodable for UpdateFeaturesRequest { let mut total_size = 0; total_size += types::Int32.compute_size(&self.timeout_ms)?; total_size += types::CompactArray(types::Struct { version }).compute_size(&self.feature_updates)?; + if version >= 1 { + total_size += types::Boolean.compute_size(&self.validate_only)?; + } else { + if self.validate_only { + return Err(EncodeError) + } + } let num_tagged_fields = self.unknown_tagged_fields.len(); if num_tagged_fields > std::u32::MAX as usize { error!("Too many tagged fields to encode ({} fields)", num_tagged_fields); @@ -155,6 +234,11 @@ impl Decodable for UpdateFeaturesRequest { fn decode(buf: &mut B, version: i16) -> Result { let timeout_ms = types::Int32.decode(buf)?; let feature_updates = types::CompactArray(types::Struct { version }).decode(buf)?; + let validate_only = if version >= 1 { + types::Boolean.decode(buf)? + } else { + false + }; let mut unknown_tagged_fields = BTreeMap::new(); let num_tagged_fields = types::UnsignedVarInt.decode(buf)?; for _ in 0..num_tagged_fields { @@ -167,6 +251,7 @@ impl Decodable for UpdateFeaturesRequest { Ok(Self { timeout_ms, feature_updates, + validate_only, unknown_tagged_fields, }) } @@ -177,13 +262,14 @@ impl Default for UpdateFeaturesRequest { Self { timeout_ms: 60000, feature_updates: Default::default(), + validate_only: false, unknown_tagged_fields: BTreeMap::new(), } } } impl Message for UpdateFeaturesRequest { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } impl HeaderVersion for UpdateFeaturesRequest { diff --git a/src/messages/update_features_response.rs b/src/messages/update_features_response.rs index e869218..c64be06 100644 --- a/src/messages/update_features_response.rs +++ b/src/messages/update_features_response.rs @@ -13,27 +13,36 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UpdatableFeatureResult { /// The feature update error code or `0` if the feature update succeeded. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub error_code: i16, /// The feature update error, or `null` if the feature update succeeded. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub error_message: Option, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UpdatableFeatureResult { + type Builder = UpdatableFeatureResultBuilder; + + fn builder() -> Self::Builder{ + UpdatableFeatureResultBuilder::default() + } +} + impl MapEncodable for UpdatableFeatureResult { type Key = StrBytes; fn encode(&self, key: &Self::Key, buf: &mut B, version: i16) -> Result<(), EncodeError> { @@ -101,36 +110,45 @@ impl Default for UpdatableFeatureResult { } impl Message for UpdatableFeatureResult { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } -/// Valid versions: 0 +/// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UpdateFeaturesResponse { /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub throttle_time_ms: i32, /// The top-level error code, or `0` if there was no top-level error. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub error_code: i16, /// The top-level error message, or `null` if there was no top-level error. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub error_message: Option, /// Results for each feature update. /// - /// Supported API versions: 0 + /// Supported API versions: 0-1 pub results: indexmap::IndexMap, /// Other tagged fields pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UpdateFeaturesResponse { + type Builder = UpdateFeaturesResponseBuilder; + + fn builder() -> Self::Builder{ + UpdateFeaturesResponseBuilder::default() + } +} + impl Encodable for UpdateFeaturesResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.throttle_time_ms)?; @@ -203,7 +221,7 @@ impl Default for UpdateFeaturesResponse { } impl Message for UpdateFeaturesResponse { - const VERSIONS: VersionRange = VersionRange { min: 0, max: 0 }; + const VERSIONS: VersionRange = VersionRange { min: 0, max: 1 }; } impl HeaderVersion for UpdateFeaturesResponse { diff --git a/src/messages/update_metadata_request.rs b/src/messages/update_metadata_request.rs index 1b9f5d6..13d7cb1 100644 --- a/src/messages/update_metadata_request.rs +++ b/src/messages/update_metadata_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UpdateMetadataPartitionState { /// In older versions of this RPC, the topic name. @@ -69,6 +70,14 @@ pub struct UpdateMetadataPartitionState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UpdateMetadataPartitionState { + type Builder = UpdateMetadataPartitionStateBuilder; + + fn builder() -> Self::Builder{ + UpdateMetadataPartitionStateBuilder::default() + } +} + impl Encodable for UpdateMetadataPartitionState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version <= 4 { @@ -228,6 +237,7 @@ impl Message for UpdateMetadataPartitionState { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UpdateMetadataTopicState { /// The topic name. @@ -249,6 +259,14 @@ pub struct UpdateMetadataTopicState { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UpdateMetadataTopicState { + type Builder = UpdateMetadataTopicStateBuilder; + + fn builder() -> Self::Builder{ + UpdateMetadataTopicStateBuilder::default() + } +} + impl Encodable for UpdateMetadataTopicState { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 5 { @@ -390,6 +408,7 @@ impl Message for UpdateMetadataTopicState { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UpdateMetadataEndpoint { /// The port of this endpoint @@ -416,6 +435,14 @@ pub struct UpdateMetadataEndpoint { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UpdateMetadataEndpoint { + type Builder = UpdateMetadataEndpointBuilder; + + fn builder() -> Self::Builder{ + UpdateMetadataEndpointBuilder::default() + } +} + impl Encodable for UpdateMetadataEndpoint { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -578,6 +605,7 @@ impl Message for UpdateMetadataEndpoint { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UpdateMetadataBroker { /// The broker id. @@ -609,6 +637,14 @@ pub struct UpdateMetadataBroker { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UpdateMetadataBroker { + type Builder = UpdateMetadataBrokerBuilder; + + fn builder() -> Self::Builder{ + UpdateMetadataBrokerBuilder::default() + } +} + impl Encodable for UpdateMetadataBroker { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.id)?; @@ -752,6 +788,7 @@ impl Message for UpdateMetadataBroker { } /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UpdateMetadataRequest { /// The controller id. @@ -788,6 +825,14 @@ pub struct UpdateMetadataRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UpdateMetadataRequest { + type Builder = UpdateMetadataRequestBuilder; + + fn builder() -> Self::Builder{ + UpdateMetadataRequestBuilder::default() + } +} + impl Encodable for UpdateMetadataRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.controller_id)?; diff --git a/src/messages/update_metadata_response.rs b/src/messages/update_metadata_response.rs index bf33b6e..dfdb413 100644 --- a/src/messages/update_metadata_response.rs +++ b/src/messages/update_metadata_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-7 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct UpdateMetadataResponse { /// The error code, or 0 if there was no error. @@ -29,6 +30,14 @@ pub struct UpdateMetadataResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for UpdateMetadataResponse { + type Builder = UpdateMetadataResponseBuilder; + + fn builder() -> Self::Builder{ + UpdateMetadataResponseBuilder::default() + } +} + impl Encodable for UpdateMetadataResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/vote_request.rs b/src/messages/vote_request.rs index b30ebe2..1759601 100644 --- a/src/messages/vote_request.rs +++ b/src/messages/vote_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index. @@ -49,6 +50,14 @@ pub struct PartitionData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -130,6 +139,7 @@ impl Message for PartitionData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The topic name. @@ -146,6 +156,14 @@ pub struct TopicData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.topic_name)?; @@ -212,6 +230,7 @@ impl Message for TopicData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct VoteRequest { /// @@ -228,6 +247,14 @@ pub struct VoteRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for VoteRequest { + type Builder = VoteRequestBuilder; + + fn builder() -> Self::Builder{ + VoteRequestBuilder::default() + } +} + impl Encodable for VoteRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.cluster_id)?; diff --git a/src/messages/vote_response.rs b/src/messages/vote_response.rs index 14eeede..35e200f 100644 --- a/src/messages/vote_response.rs +++ b/src/messages/vote_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct PartitionData { /// The partition index. @@ -49,6 +50,14 @@ pub struct PartitionData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for PartitionData { + type Builder = PartitionDataBuilder; + + fn builder() -> Self::Builder{ + PartitionDataBuilder::default() + } +} + impl Encodable for PartitionData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -130,6 +139,7 @@ impl Message for PartitionData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct TopicData { /// The topic name. @@ -146,6 +156,14 @@ pub struct TopicData { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for TopicData { + type Builder = TopicDataBuilder; + + fn builder() -> Self::Builder{ + TopicDataBuilder::default() + } +} + impl Encodable for TopicData { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::CompactString.encode(buf, &self.topic_name)?; @@ -212,6 +230,7 @@ impl Message for TopicData { } /// Valid versions: 0 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct VoteResponse { /// The top level error code. @@ -228,6 +247,14 @@ pub struct VoteResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for VoteResponse { + type Builder = VoteResponseBuilder; + + fn builder() -> Self::Builder{ + VoteResponseBuilder::default() + } +} + impl Encodable for VoteResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int16.encode(buf, &self.error_code)?; diff --git a/src/messages/write_txn_markers_request.rs b/src/messages/write_txn_markers_request.rs index 81b7876..7ea2279 100644 --- a/src/messages/write_txn_markers_request.rs +++ b/src/messages/write_txn_markers_request.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct WritableTxnMarkerTopic { /// The topic name. @@ -34,6 +35,14 @@ pub struct WritableTxnMarkerTopic { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for WritableTxnMarkerTopic { + type Builder = WritableTxnMarkerTopicBuilder; + + fn builder() -> Self::Builder{ + WritableTxnMarkerTopicBuilder::default() + } +} + impl Encodable for WritableTxnMarkerTopic { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -130,6 +139,7 @@ impl Message for WritableTxnMarkerTopic { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct WritableTxnMarker { /// The current producer ID. @@ -161,6 +171,14 @@ pub struct WritableTxnMarker { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for WritableTxnMarker { + type Builder = WritableTxnMarkerBuilder; + + fn builder() -> Self::Builder{ + WritableTxnMarkerBuilder::default() + } +} + impl Encodable for WritableTxnMarker { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int64.encode(buf, &self.producer_id)?; @@ -260,6 +278,7 @@ impl Message for WritableTxnMarker { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct WriteTxnMarkersRequest { /// The transaction markers to be written. @@ -271,6 +290,14 @@ pub struct WriteTxnMarkersRequest { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for WriteTxnMarkersRequest { + type Builder = WriteTxnMarkersRequestBuilder; + + fn builder() -> Self::Builder{ + WriteTxnMarkersRequestBuilder::default() + } +} + impl Encodable for WriteTxnMarkersRequest { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/messages/write_txn_markers_response.rs b/src/messages/write_txn_markers_response.rs index 0c09f19..e36574d 100644 --- a/src/messages/write_txn_markers_response.rs +++ b/src/messages/write_txn_markers_response.rs @@ -13,11 +13,12 @@ use uuid::Uuid; use crate::protocol::{ Encodable, Decodable, MapEncodable, MapDecodable, Encoder, Decoder, EncodeError, DecodeError, Message, HeaderVersion, VersionRange, - types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut} + types, write_unknown_tagged_fields, compute_unknown_tagged_fields_size, StrBytes, buf::{ByteBuf, ByteBufMut}, Builder }; /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct WritableTxnMarkerPartitionResult { /// The partition index. @@ -34,6 +35,14 @@ pub struct WritableTxnMarkerPartitionResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for WritableTxnMarkerPartitionResult { + type Builder = WritableTxnMarkerPartitionResultBuilder; + + fn builder() -> Self::Builder{ + WritableTxnMarkerPartitionResultBuilder::default() + } +} + impl Encodable for WritableTxnMarkerPartitionResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int32.encode(buf, &self.partition_index)?; @@ -106,6 +115,7 @@ impl Message for WritableTxnMarkerPartitionResult { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct WritableTxnMarkerTopicResult { /// The topic name. @@ -122,6 +132,14 @@ pub struct WritableTxnMarkerTopicResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for WritableTxnMarkerTopicResult { + type Builder = WritableTxnMarkerTopicResultBuilder; + + fn builder() -> Self::Builder{ + WritableTxnMarkerTopicResultBuilder::default() + } +} + impl Encodable for WritableTxnMarkerTopicResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { @@ -218,6 +236,7 @@ impl Message for WritableTxnMarkerTopicResult { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct WritableTxnMarkerResult { /// The current producer ID in use by the transactional ID. @@ -234,6 +253,14 @@ pub struct WritableTxnMarkerResult { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for WritableTxnMarkerResult { + type Builder = WritableTxnMarkerResultBuilder; + + fn builder() -> Self::Builder{ + WritableTxnMarkerResultBuilder::default() + } +} + impl Encodable for WritableTxnMarkerResult { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { types::Int64.encode(buf, &self.producer_id)?; @@ -318,6 +345,7 @@ impl Message for WritableTxnMarkerResult { } /// Valid versions: 0-1 +#[non_exhaustive] #[derive(Debug, Clone, PartialEq, derive_builder::Builder)] pub struct WriteTxnMarkersResponse { /// The results for writing makers. @@ -329,6 +357,14 @@ pub struct WriteTxnMarkersResponse { pub unknown_tagged_fields: BTreeMap>, } +impl Builder for WriteTxnMarkersResponse { + type Builder = WriteTxnMarkersResponseBuilder; + + fn builder() -> Self::Builder{ + WriteTxnMarkersResponseBuilder::default() + } +} + impl Encodable for WriteTxnMarkersResponse { fn encode(&self, buf: &mut B, version: i16) -> Result<(), EncodeError> { if version >= 1 { diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 69b7ff3..dcb6639 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -1,5 +1,3 @@ -//! Raw types and utilities for use with the Kafka protocol. -//! //! Most types are used internally in encoding/decoding, and are not required by typical use cases //! for interacting with the protocol. However, types can be used for decoding partial messages, //! or rewriting parts of an encoded message. @@ -31,11 +29,7 @@ impl std::fmt::Display for DecodeError { } } -impl Error for DecodeError { - fn source(&self) -> Option<&(dyn Error + 'static)> { - None - } -} +impl Error for DecodeError {} impl From for DecodeError { fn from(_: NotEnoughBytesError) -> Self { @@ -196,3 +190,13 @@ pub(crate) fn compute_unknown_tagged_fields_size( } Ok(total_size) } + +/// Every protocol item implements [`derive_builder::Builder`], which can be +/// created using [`Default::default`] or retrieved via this trait. +pub trait Builder { + /// The [`derive_builder::Builder`] type for this protocol item. + type Builder: Default; + + /// Retrieve the builder for this protocol item. + fn builder() -> Self::Builder; +} \ No newline at end of file