mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-12 16:16:55 +00:00
refactor(replication): move resync classifiers into crate (#4170)
This commit is contained in:
@@ -82,6 +82,14 @@ pub fn resized_worker_counts(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mrf_worker_size_to_count(size: i32) -> usize {
|
||||
let non_negative = size.max(0);
|
||||
match usize::try_from(non_negative) {
|
||||
Ok(size) => size,
|
||||
Err(_) => 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn worker_counts_for_priority(
|
||||
priority: &ReplicationPriority,
|
||||
current_workers: usize,
|
||||
@@ -189,6 +197,13 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mrf_worker_size_to_count_clamps_negative_values() {
|
||||
assert_eq!(mrf_worker_size_to_count(-1), 0);
|
||||
assert_eq!(mrf_worker_size_to_count(0), 0);
|
||||
assert_eq!(mrf_worker_size_to_count(3), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn auto_priority_grows_toward_defaults() {
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user