use std::collections::HashMap;
use rocketmq_common::common::config::TopicConfig;
use serde::{Deserialize, Serialize};
use crate::protocol::{
static_topic::{
topic_queue_info::TopicQueueMappingInfo,
topic_queue_mapping_detail::TopicQueueMappingDetail,
},
DataVersion, RemotingSerializable,
};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TopicConfigAndMappingSerializeWrapper {
#[serde(rename = "topicQueueMappingInfoMap")]
topic_queue_mapping_info_map: HashMap<String , TopicQueueMappingInfo>,
#[serde(rename = "topicQueueMappingDetailMap")]
topic_queue_mapping_detail_map: HashMap<String , TopicQueueMappingDetail>,
#[serde(rename = "mappingDataVersion")]
mapping_data_version: DataVersion,
#[serde(rename = "topicConfigTable")]
topic_config_table: Option<HashMap<String, TopicConfig>>,
#[serde(rename = "dataVersion")]
data_version: Option<DataVersion>,
}
impl TopicConfigAndMappingSerializeWrapper {
pub fn topic_queue_mapping_info_map(&self) -> &HashMap<String, TopicQueueMappingInfo> {
&self.topic_queue_mapping_info_map
}
pub fn topic_queue_mapping_detail_map(&self) -> &HashMap<String, TopicQueueMappingDetail> {
&self.topic_queue_mapping_detail_map
}
pub fn mapping_data_version(&self) -> &DataVersion {
&self.mapping_data_version
}
pub fn topic_config_table(&self) -> &Option<HashMap<String, TopicConfig>> {
&self.topic_config_table
}
pub fn data_version(&self) -> &Option<DataVersion> {
&self.data_version
}
}
impl Default for TopicConfigAndMappingSerializeWrapper {
fn default() -> Self {
Self {
topic_queue_mapping_info_map: HashMap::new(),
topic_queue_mapping_detail_map: HashMap::new(),
mapping_data_version: DataVersion::new(),
topic_config_table: None,
data_version: None,
}
}
}
impl RemotingSerializable for TopicConfigAndMappingSerializeWrapper {
type Output = TopicConfigAndMappingSerializeWrapper;
}