rocketmq_remoting/protocol/static_topic/
topic_queue_mapping_one.rs

1use serde::Serialize;
2
3use crate::protocol::static_topic::logic_queue_mapping_item::LogicQueueMappingItem;
4use crate::protocol::static_topic::topic_queue_mapping_detail::TopicQueueMappingDetail;
5
6#[derive(Debug, Serialize, PartialEq, Clone)]
7pub struct TopicQueueMappingOne {
8    topic: String, // redundant field
9    bname: String, //identify the hosted broker name
10    global_id: i32,
11    items: Vec<LogicQueueMappingItem>,
12    mapping_detail: TopicQueueMappingDetail,
13}
14impl TopicQueueMappingOne {
15    pub fn new(
16        mapping_detail: TopicQueueMappingDetail,
17        topic: String,
18        bname: String,
19        global_id: i32,
20        items: Vec<LogicQueueMappingItem>,
21    ) -> Self {
22        Self {
23            topic,
24            bname,
25            global_id,
26            items,
27            mapping_detail,
28        }
29    }
30
31    pub fn topic(&self) -> &str {
32        &self.topic
33    }
34
35    pub fn bname(&self) -> &str {
36        &self.bname
37    }
38
39    pub fn global_id(&self) -> i32 {
40        self.global_id
41    }
42
43    pub fn items(&self) -> &Vec<LogicQueueMappingItem> {
44        &self.items
45    }
46
47    pub fn mapping_detail(&self) -> &TopicQueueMappingDetail {
48        &self.mapping_detail
49    }
50}