#![allow(dead_code)]
use bytes::Bytes;
use crate::error::BrokerError;
pub type HandlerFn = fn(
broker: &crate::broker::Broker,
version: i16,
correlation_id: i32,
req_bytes: &[u8],
) -> futures_util::future::BoxFuture<'static, Result<Bytes, BrokerError>>;
#[derive(Default)]
pub struct HandlerTable {
table: std::collections::HashMap<i16, HandlerFn>,
}
impl HandlerTable {
pub fn new() -> Self {
Self::default()
}
pub fn register(&mut self, api_key: i16, handler: HandlerFn) {
self.table.insert(api_key, handler);
}
#[must_use]
pub fn get(&self, api_key: i16) -> Option<HandlerFn> {
self.table.get(&api_key).copied()
}
}
pub(crate) mod context;
pub(crate) use context::RequestContext;
pub(crate) use context::TelemetryContext;
pub(crate) mod acl_wire;
pub(crate) mod add_raft_voter;
pub(crate) mod alter_client_quotas;
pub(crate) mod alter_configs;
pub(crate) mod alter_partition;
pub(crate) mod alter_partition_reassignments;
pub(crate) mod alter_replica_log_dirs;
pub(crate) mod alter_user_scram_credentials;
pub(crate) mod api_versions;
pub(crate) mod assign_replicas_to_dirs;
pub(crate) mod authorized_operations;
pub(crate) mod broker_heartbeat;
pub(crate) mod consumer_group_describe;
pub(crate) mod consumer_group_heartbeat;
pub(crate) mod create_acls;
pub(crate) mod create_delegation_token;
pub(crate) mod create_partitions;
pub(crate) mod create_topics;
pub(crate) mod delete_acls;
pub(crate) mod delete_groups;
pub(crate) mod delete_records;
pub(crate) mod delete_topics;
pub(crate) mod describe_acls;
pub(crate) mod describe_client_quotas;
pub(crate) mod describe_cluster;
pub(crate) mod describe_configs;
pub(crate) mod describe_delegation_token;
pub(crate) mod describe_groups;
pub(crate) mod describe_log_dirs;
pub(crate) mod describe_producers;
pub(crate) mod describe_quorum;
pub(crate) mod describe_transactions;
pub(crate) mod describe_topic_partitions;
pub(crate) mod describe_user_scram_credentials;
pub(crate) mod elect_leaders;
pub(crate) mod expire_delegation_token;
pub(crate) mod fetch;
pub(crate) mod fetch_downconvert;
pub(crate) mod fetch_snapshot;
pub(crate) mod find_coordinator;
pub(crate) mod get_replica_log_info;
pub(crate) mod get_telemetry_subscriptions;
pub(crate) mod heartbeat;
pub(crate) mod incremental_alter_configs;
pub(crate) mod init_producer_id;
pub(crate) mod join_group;
pub(crate) mod leave_group;
pub(crate) mod list_config_resources;
pub(crate) mod list_groups;
pub(crate) mod list_offsets;
pub(crate) mod list_partition_reassignments;
pub(crate) mod list_transactions;
pub(crate) mod metadata;
pub(crate) mod offset_commit;
pub(crate) mod offset_delete;
pub(crate) mod offset_fetch;
pub(crate) mod offset_for_leader_epoch;
pub(crate) mod produce;
pub(crate) mod push_telemetry;
pub(crate) mod remove_raft_voter;
pub(crate) mod renew_delegation_token;
pub(crate) mod share_group_describe;
pub(crate) mod share_group_heartbeat;
pub(crate) mod alter_share_group_offsets;
pub(crate) mod delete_share_group_offsets;
pub(crate) mod describe_share_group_offsets;
pub(crate) mod share_acknowledge;
pub(crate) mod share_fetch;
pub(crate) mod streams_group_describe;
pub(crate) mod streams_group_heartbeat;
pub(crate) mod sync_group;
pub(crate) mod unregister_broker;
pub(crate) mod update_features;
pub(crate) mod update_raft_voter;
#[must_use]
pub(crate) fn build_table() -> HandlerTable {
let mut t = HandlerTable::new();
t.register(18, api_versions::handle);
t.register(25, crate::txn::handlers::add_offset_commits_to_txn::handle);
t.register(27, crate::txn::handlers::write_txn_markers::handle);
t.register(73, assign_replicas_to_dirs::handle);
t.register(59, fetch_snapshot::handle);
t.register(69, consumer_group_describe::handle);
t.register(89, streams_group_describe::handle);
t.register(83, crate::share_coordinator::handlers::initialize::handle);
t.register(84, crate::share_coordinator::handlers::read::handle);
t.register(85, crate::share_coordinator::handlers::write::handle);
t.register(86, crate::share_coordinator::handlers::delete::handle);
t.register(87, crate::share_coordinator::handlers::read_summary::handle);
t
}