mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-25 05:26:50 +00:00
perf(get): reuse reader paths and lock namespaces (#6015)
Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
@@ -479,7 +479,7 @@ pub struct DistributedLock {
|
||||
/// Lock clients for this namespace
|
||||
clients: Vec<Arc<dyn LockClient>>,
|
||||
/// Namespace identifier
|
||||
namespace: String,
|
||||
namespace: Arc<str>,
|
||||
/// Quorum size for exclusive/write operations
|
||||
quorum: usize,
|
||||
}
|
||||
@@ -496,6 +496,11 @@ struct LockAcquireQuorumResult {
|
||||
impl DistributedLock {
|
||||
/// Create new distributed lock
|
||||
pub fn new(namespace: String, clients: Vec<Arc<dyn LockClient>>, quorum: usize) -> Self {
|
||||
Self::new_shared(namespace.into(), clients, quorum)
|
||||
}
|
||||
|
||||
/// Create a distributed lock that shares an existing namespace allocation.
|
||||
pub(crate) fn new_shared(namespace: Arc<str>, clients: Vec<Arc<dyn LockClient>>, quorum: usize) -> Self {
|
||||
let q = if clients.len() <= 1 {
|
||||
1
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user