rocketmq_remoting/protocol/body/request/
lock_batch_request_body.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 std::collections::HashSet;
18use std::fmt::Display;
19
20use cheetah_string::CheetahString;
21use rocketmq_common::common::message::message_queue::MessageQueue;
22use serde::Deserialize;
23use serde::Serialize;
24
25#[derive(Serialize, Deserialize, Debug, Default, Clone)]
26#[serde(rename_all = "camelCase")]
27pub struct LockBatchRequestBody {
28    pub consumer_group: Option<CheetahString>,
29    pub client_id: Option<CheetahString>,
30    pub only_this_broker: bool,
31    pub mq_set: HashSet<MessageQueue>,
32}
33
34impl Display for LockBatchRequestBody {
35    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36        write!(
37            f,
38            "LockBatchRequestBody [consumer_group={}, client_id={}, only_this_broker={}, \
39             mq_set={:?}]",
40            self.consumer_group.as_ref().unwrap_or(&"".into()),
41            self.client_id.as_ref().unwrap_or(&"".into()),
42            self.only_this_broker,
43            self.mq_set
44        )
45    }
46}