Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Removes glob import of SnapshotKind (#34333)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Dec 6, 2023
1 parent b32903a commit 61fa130
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions runtime/src/snapshot_package/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ pub fn cmp_accounts_package_kinds_by_priority(
a: &AccountsPackageKind,
b: &AccountsPackageKind,
) -> Ordering {
use AccountsPackageKind::*;
use AccountsPackageKind as Kind;
match (a, b) {
// Epoch Accounts Hash packages
(EpochAccountsHash, EpochAccountsHash) => Equal,
(EpochAccountsHash, _) => Greater,
(_, EpochAccountsHash) => Less,
(Kind::EpochAccountsHash, Kind::EpochAccountsHash) => Equal,
(Kind::EpochAccountsHash, _) => Greater,
(_, Kind::EpochAccountsHash) => Less,

// Snapshot packages
(Snapshot(snapshot_kind_a), Snapshot(snapshot_kind_b)) => {
(Kind::Snapshot(snapshot_kind_a), Kind::Snapshot(snapshot_kind_b)) => {
cmp_snapshot_kinds_by_priority(snapshot_kind_a, snapshot_kind_b)
}
(Snapshot(_), _) => Greater,
(_, Snapshot(_)) => Less,
(Kind::Snapshot(_), _) => Greater,
(_, Kind::Snapshot(_)) => Less,

// Accounts Hash Verifier packages
(AccountsHashVerifier, AccountsHashVerifier) => Equal,
(Kind::AccountsHashVerifier, Kind::AccountsHashVerifier) => Equal,
}
}

Expand All @@ -58,12 +58,12 @@ pub fn cmp_accounts_package_kinds_by_priority(
/// If two `IncrementalSnapshot`s are compared, their base slots are the tiebreaker.
#[must_use]
pub fn cmp_snapshot_kinds_by_priority(a: &SnapshotKind, b: &SnapshotKind) -> Ordering {
use SnapshotKind::*;
use SnapshotKind as Kind;
match (a, b) {
(FullSnapshot, FullSnapshot) => Equal,
(FullSnapshot, IncrementalSnapshot(_)) => Greater,
(IncrementalSnapshot(_), FullSnapshot) => Less,
(IncrementalSnapshot(base_slot_a), IncrementalSnapshot(base_slot_b)) => {
(Kind::FullSnapshot, Kind::FullSnapshot) => Equal,
(Kind::FullSnapshot, Kind::IncrementalSnapshot(_)) => Greater,
(Kind::IncrementalSnapshot(_), Kind::FullSnapshot) => Less,
(Kind::IncrementalSnapshot(base_slot_a), Kind::IncrementalSnapshot(base_slot_b)) => {
base_slot_a.cmp(base_slot_b)
}
}
Expand Down

0 comments on commit 61fa130

Please sign in to comment.