rocketmq_remoting/protocol/body/
pop_process_queue_info.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 */
17#[derive(Debug, Clone, Copy)]
18pub struct PopProcessQueueInfo {
19    wait_ack_count: i32,
20    droped: bool,
21    last_pop_timestamp: u64,
22}
23
24impl PopProcessQueueInfo {
25    pub fn new(wait_ack_count: i32, droped: bool, last_pop_timestamp: u64) -> Self {
26        Self {
27            wait_ack_count,
28            droped,
29            last_pop_timestamp,
30        }
31    }
32
33    pub fn wait_ack_count(&self) -> i32 {
34        self.wait_ack_count
35    }
36
37    pub fn set_wait_ack_count(&mut self, wait_ack_count: i32) {
38        self.wait_ack_count = wait_ack_count;
39    }
40
41    pub fn droped(&self) -> bool {
42        self.droped
43    }
44
45    pub fn set_droped(&mut self, droped: bool) {
46        self.droped = droped;
47    }
48
49    pub fn last_pop_timestamp(&self) -> u64 {
50        self.last_pop_timestamp
51    }
52
53    pub fn set_last_pop_timestamp(&mut self, last_pop_timestamp: u64) {
54        self.last_pop_timestamp = last_pop_timestamp;
55    }
56}
57
58impl std::fmt::Display for PopProcessQueueInfo {
59    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
60        write!(
61            f,
62            "PopProcessQueueInfo [wait_ack_count: {}, droped: {}, last_pop_timestamp: {}]",
63            self.wait_ack_count, self.droped, self.last_pop_timestamp
64        )
65    }
66}