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

Removes glob import of SnapshotKind #34333

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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