mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-17 18:27:49 +00:00
chore: upgrade dependencies and migrate to aws-lc-rs (#1333)
This commit is contained in:
@@ -104,20 +104,20 @@ mod tests {
|
||||
let response = client.acquire_exclusive(&request).await;
|
||||
assert!(response.is_ok());
|
||||
|
||||
if let Ok(response) = response {
|
||||
if response.success {
|
||||
let lock_info = response.lock_info.unwrap();
|
||||
if let Ok(response) = response
|
||||
&& response.success
|
||||
{
|
||||
let lock_info = response.lock_info.unwrap();
|
||||
|
||||
// Test status check
|
||||
let status = client.check_status(&lock_info.id).await;
|
||||
assert!(status.is_ok());
|
||||
assert!(status.unwrap().is_some());
|
||||
// Test status check
|
||||
let status = client.check_status(&lock_info.id).await;
|
||||
assert!(status.is_ok());
|
||||
assert!(status.unwrap().is_some());
|
||||
|
||||
// Test lock release
|
||||
let released = client.release(&lock_info.id).await;
|
||||
assert!(released.is_ok());
|
||||
assert!(released.unwrap());
|
||||
}
|
||||
// Test lock release
|
||||
let released = client.release(&lock_info.id).await;
|
||||
assert!(released.is_ok());
|
||||
assert!(released.unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -953,10 +953,10 @@ mod tests {
|
||||
// Wait for all operations to complete
|
||||
let mut successful_operations = 0;
|
||||
for handle in handles {
|
||||
if let Ok(success) = handle.await {
|
||||
if success {
|
||||
successful_operations += 1;
|
||||
}
|
||||
if let Ok(success) = handle.await
|
||||
&& success
|
||||
{
|
||||
successful_operations += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -414,10 +414,10 @@ impl Default for FastObjectLockManager {
|
||||
impl Drop for FastObjectLockManager {
|
||||
fn drop(&mut self) {
|
||||
// Note: We can't use async in Drop, so we just abort the cleanup task
|
||||
if let Ok(handle_guard) = self.cleanup_handle.try_read() {
|
||||
if let Some(handle) = handle_guard.as_ref() {
|
||||
handle.abort();
|
||||
}
|
||||
if let Ok(handle_guard) = self.cleanup_handle.try_read()
|
||||
&& let Some(handle) = handle_guard.as_ref()
|
||||
{
|
||||
handle.abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +69,10 @@ impl LockShard {
|
||||
/// Try fast path only (without fallback to slow path)
|
||||
pub fn try_fast_path_only(&self, request: &ObjectLockRequest) -> bool {
|
||||
// Early check to avoid unnecessary lock contention
|
||||
if let Some(state) = self.objects.read().get(&request.key) {
|
||||
if !state.atomic_state.is_fast_path_available(request.mode) {
|
||||
return false;
|
||||
}
|
||||
if let Some(state) = self.objects.read().get(&request.key)
|
||||
&& !state.atomic_state.is_fast_path_available(request.mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
self.try_fast_path(request).is_some()
|
||||
}
|
||||
@@ -441,36 +441,36 @@ impl LockShard {
|
||||
/// Get lock information for monitoring
|
||||
pub fn get_lock_info(&self, key: &ObjectKey) -> Option<crate::fast_lock::types::ObjectLockInfo> {
|
||||
let objects = self.objects.read();
|
||||
if let Some(state) = objects.get(key) {
|
||||
if let Some(mode) = state.current_mode() {
|
||||
let (owner, acquired_at, lock_timeout) = match mode {
|
||||
LockMode::Exclusive => {
|
||||
let current_owner = state.current_owner.read();
|
||||
let info = current_owner.clone()?;
|
||||
(info.owner, info.acquired_at, info.lock_timeout)
|
||||
}
|
||||
LockMode::Shared => {
|
||||
let shared_owners = state.shared_owners.read();
|
||||
let entry = shared_owners.first()?.clone();
|
||||
(entry.owner, entry.acquired_at, entry.lock_timeout)
|
||||
}
|
||||
};
|
||||
if let Some(state) = objects.get(key)
|
||||
&& let Some(mode) = state.current_mode()
|
||||
{
|
||||
let (owner, acquired_at, lock_timeout) = match mode {
|
||||
LockMode::Exclusive => {
|
||||
let current_owner = state.current_owner.read();
|
||||
let info = current_owner.clone()?;
|
||||
(info.owner, info.acquired_at, info.lock_timeout)
|
||||
}
|
||||
LockMode::Shared => {
|
||||
let shared_owners = state.shared_owners.read();
|
||||
let entry = shared_owners.first()?.clone();
|
||||
(entry.owner, entry.acquired_at, entry.lock_timeout)
|
||||
}
|
||||
};
|
||||
|
||||
let priority = *state.priority.read();
|
||||
let priority = *state.priority.read();
|
||||
|
||||
let expires_at = acquired_at
|
||||
.checked_add(lock_timeout)
|
||||
.unwrap_or_else(|| acquired_at + crate::fast_lock::DEFAULT_LOCK_TIMEOUT);
|
||||
let expires_at = acquired_at
|
||||
.checked_add(lock_timeout)
|
||||
.unwrap_or_else(|| acquired_at + crate::fast_lock::DEFAULT_LOCK_TIMEOUT);
|
||||
|
||||
return Some(crate::fast_lock::types::ObjectLockInfo {
|
||||
key: key.clone(),
|
||||
mode,
|
||||
owner,
|
||||
acquired_at,
|
||||
expires_at,
|
||||
priority,
|
||||
});
|
||||
}
|
||||
return Some(crate::fast_lock::types::ObjectLockInfo {
|
||||
key: key.clone(),
|
||||
mode,
|
||||
owner,
|
||||
acquired_at,
|
||||
expires_at,
|
||||
priority,
|
||||
});
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
@@ -165,10 +165,10 @@ impl NamespaceLock {
|
||||
let mut successful_clients = Vec::new();
|
||||
|
||||
for (idx, res) in results {
|
||||
if let Ok(resp) = res {
|
||||
if resp.success {
|
||||
successful_clients.push(idx);
|
||||
}
|
||||
if let Ok(resp) = res
|
||||
&& resp.success
|
||||
{
|
||||
successful_clients.push(idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user