use std::collections::HashMap;
use cheetah_string::CheetahString;
use rocketmq_common::common::config::TopicConfig;
use serde::Deserialize;
use serde::Serialize;
use crate::protocol::DataVersion;
pub mod topic_config_wrapper;
pub mod topic_queue_wrapper;
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct TopicConfigSerializeWrapper {
#[serde(rename = "topicConfigTable")]
topic_config_table: Option<HashMap<CheetahString, TopicConfig>>,
#[serde(rename = "dataVersion")]
data_version: Option<DataVersion>,
}
impl TopicConfigSerializeWrapper {
pub fn new(
topic_config_table: Option<HashMap<CheetahString, TopicConfig>>,
data_version: Option<DataVersion>,
) -> Self {
Self {
topic_config_table,
data_version,
}
}
}
impl TopicConfigSerializeWrapper {
pub fn topic_config_table(&self) -> Option<&HashMap<CheetahString, TopicConfig>> {
match &self.topic_config_table {
None => None,
Some(value) => Some(value),
}
}
pub fn data_version(&self) -> Option<&DataVersion> {
match &self.data_version {
None => None,
Some(value) => Some(value),
}
}
pub fn set_topic_config_table(&mut self, topic_config_table: Option<HashMap<CheetahString, TopicConfig>>) {
self.topic_config_table = topic_config_table;
}
pub fn set_data_version(&mut self, data_version: Option<DataVersion>) {
self.data_version = data_version;
}
pub fn take_topic_config_table(&mut self) -> Option<HashMap<CheetahString, TopicConfig>> {
self.topic_config_table.take()
}
pub fn topic_config_table_mut(&mut self) -> Option<&mut HashMap<CheetahString, TopicConfig>> {
self.topic_config_table.as_mut()
}
}