rustfs_lock/
lock_args.rs

1// Copyright 2024 RustFS Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use serde::{Deserialize, Serialize};
16use std::fmt::Display;
17
18#[derive(Clone, Debug, Default, Serialize, Deserialize)]
19pub struct LockArgs {
20    pub uid: String,
21    pub resources: Vec<String>,
22    pub owner: String,
23    pub source: String,
24    pub quorum: usize,
25}
26
27impl Display for LockArgs {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29        write!(
30            f,
31            "LockArgs[ uid: {}, resources: {:?}, owner: {}, source:{}, quorum: {} ]",
32            self.uid, self.resources, self.owner, self.source, self.quorum
33        )
34    }
35}