rocketmq_remoting/protocol/body/
queue_time_span.rs

1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17use rocketmq_common::common::message::message_queue::MessageQueue;
18use rocketmq_common::UtilAll::time_millis_to_human_string2;
19use serde::Deserialize;
20use serde::Serialize;
21
22#[derive(Debug, Clone, Serialize, Deserialize, Default)]
23pub struct QueueTimeSpan {
24    pub message_queue: Option<MessageQueue>,
25    pub min_time_stamp: i64,
26    pub max_time_stamp: i64,
27    pub consume_time_stamp: i64,
28    pub delay_time: i64,
29}
30
31impl QueueTimeSpan {
32    pub fn get_message_queue(&self) -> Option<MessageQueue> {
33        self.message_queue.clone()
34    }
35
36    pub fn set_message_queue(&mut self, message_queue: MessageQueue) {
37        self.message_queue = Some(message_queue);
38    }
39
40    pub fn get_min_time_stamp(&self) -> i64 {
41        self.min_time_stamp
42    }
43
44    pub fn set_min_time_stamp(&mut self, min_time_stamp: i64) {
45        self.min_time_stamp = min_time_stamp;
46    }
47
48    pub fn get_max_time_stamp(&self) -> i64 {
49        self.max_time_stamp
50    }
51
52    pub fn set_max_time_stamp(&mut self, max_time_stamp: i64) {
53        self.max_time_stamp = max_time_stamp;
54    }
55
56    pub fn get_consume_time_stamp(&self) -> i64 {
57        self.consume_time_stamp
58    }
59
60    pub fn set_consume_time_stamp(&mut self, consume_time_stamp: i64) {
61        self.consume_time_stamp = consume_time_stamp;
62    }
63
64    pub fn get_delay_time(&self) -> i64 {
65        self.delay_time
66    }
67
68    pub fn set_delay_time(&mut self, delay_time: i64) {
69        self.delay_time = delay_time;
70    }
71
72    pub fn get_min_time_stamp_str(&self) -> String {
73        time_millis_to_human_string2(self.min_time_stamp)
74    }
75
76    pub fn get_max_time_stamp_str(&self) -> String {
77        time_millis_to_human_string2(self.max_time_stamp)
78    }
79
80    pub fn get_consume_time_stamp_str(&self) -> String {
81        time_millis_to_human_string2(self.consume_time_stamp)
82    }
83}