mirror of
https://github.com/telemt/telemt.git
synced 2026-11-02 13:52:03 +03:00
Rustfmt
This commit is contained in:
@@ -318,15 +318,13 @@ impl MePool {
|
||||
if alive >= required {
|
||||
covered = covered.saturating_add(1);
|
||||
} else {
|
||||
writer_deficit =
|
||||
writer_deficit.saturating_add(required.saturating_sub(alive));
|
||||
writer_deficit = writer_deficit.saturating_add(required.saturating_sub(alive));
|
||||
missing_groups.push(DcFamilyGroup { dc: *dc, family });
|
||||
}
|
||||
}
|
||||
}
|
||||
missing_groups.sort_unstable_by_key(|group| {
|
||||
(group.dc, matches!(group.family, IpFamily::V6))
|
||||
});
|
||||
missing_groups
|
||||
.sort_unstable_by_key(|group| (group.dc, matches!(group.family, IpFamily::V6)));
|
||||
HardswapCoverage {
|
||||
ratio: if total == 0 {
|
||||
1.0
|
||||
@@ -453,8 +451,8 @@ impl MePool {
|
||||
let authoritative_warm = contour == WriterContour::Warm
|
||||
&& pending_generation == Some(writer.generation)
|
||||
&& endpoint_is_current;
|
||||
let stale_active = contour == WriterContour::Active
|
||||
&& writer.generation != active_generation;
|
||||
let stale_active =
|
||||
contour == WriterContour::Active && writer.generation != active_generation;
|
||||
if authoritative_warm || (contour == WriterContour::Active && !stale_active) {
|
||||
continue;
|
||||
}
|
||||
@@ -535,8 +533,7 @@ impl MePool {
|
||||
.filter(|w| !w.draining.load(Ordering::Relaxed))
|
||||
.filter(|w| w.generation == generation)
|
||||
.filter(|w| {
|
||||
WriterContour::from_u8(w.contour.load(Ordering::Acquire))
|
||||
== WriterContour::Active
|
||||
WriterContour::from_u8(w.contour.load(Ordering::Acquire)) == WriterContour::Active
|
||||
})
|
||||
.filter(|w| w.writer_dc == dc)
|
||||
.filter(|w| endpoints.contains(&w.addr))
|
||||
|
||||
@@ -34,11 +34,7 @@ impl MePool {
|
||||
let total_passes = 1 + extra_passes;
|
||||
|
||||
for (dc, endpoints) in desired_by_dc {
|
||||
if !self.hardswap_warmup_is_authoritative(
|
||||
generation,
|
||||
map_hash,
|
||||
endpoint_revision,
|
||||
) {
|
||||
if !self.hardswap_warmup_is_authoritative(generation, map_hash, endpoint_revision) {
|
||||
return;
|
||||
}
|
||||
for family in [IpFamily::V4, IpFamily::V6] {
|
||||
@@ -119,11 +115,7 @@ impl MePool {
|
||||
}
|
||||
|
||||
last_fresh_count = self
|
||||
.fresh_writer_count_for_dc_endpoints(
|
||||
generation,
|
||||
*dc,
|
||||
&family_endpoints,
|
||||
)
|
||||
.fresh_writer_count_for_dc_endpoints(generation, *dc, &family_endpoints)
|
||||
.await;
|
||||
if last_fresh_count >= required {
|
||||
completed = true;
|
||||
@@ -324,8 +316,7 @@ impl MePool {
|
||||
Err(ReinitCommitFailure::Superseded) => {
|
||||
debug!(
|
||||
previous_generation,
|
||||
generation,
|
||||
"ME reinit result discarded after a newer desired-map attempt"
|
||||
generation, "ME reinit result discarded after a newer desired-map attempt"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,10 @@ async fn partial_hardswap_is_rejected_when_stale_binding_is_disabled() {
|
||||
.commit_reinit_attempt(&reservation.attempt, &desired_by_dc, 0.5)
|
||||
.await;
|
||||
|
||||
assert!(matches!(result, Err(ReinitCommitFailure::Redundancy { .. })));
|
||||
assert!(matches!(
|
||||
result,
|
||||
Err(ReinitCommitFailure::Redundancy { .. })
|
||||
));
|
||||
assert_eq!(pool.current_generation(), active_generation);
|
||||
assert!(!old_dc1.draining.load(Ordering::Acquire));
|
||||
assert!(!old_dc2.draining.load(Ordering::Acquire));
|
||||
@@ -303,24 +306,8 @@ async fn partial_hardswap_preserves_fallback_only_for_underfloor_family() {
|
||||
let v6 = addr_v6(1, 2001);
|
||||
let desired_by_dc = HashMap::from([(1, HashSet::from([v4, v6]))]);
|
||||
let active_generation = pool.current_generation();
|
||||
let old_v4 = insert_writer(
|
||||
&pool,
|
||||
451,
|
||||
1,
|
||||
v4,
|
||||
active_generation,
|
||||
WriterContour::Active,
|
||||
)
|
||||
.await;
|
||||
let old_v6 = insert_writer(
|
||||
&pool,
|
||||
452,
|
||||
1,
|
||||
v6,
|
||||
active_generation,
|
||||
WriterContour::Active,
|
||||
)
|
||||
.await;
|
||||
let old_v4 = insert_writer(&pool, 451, 1, v4, active_generation, WriterContour::Active).await;
|
||||
let old_v6 = insert_writer(&pool, 452, 1, v6, active_generation, WriterContour::Active).await;
|
||||
let map_hash = MePool::desired_map_hash(&desired_by_dc);
|
||||
let endpoint_revision = pool.endpoint_snapshot.load().revision;
|
||||
let reservation = pool
|
||||
|
||||
Reference in New Issue
Block a user