Skip to content

Commit b50813b

Browse files
authored
fix: fix state() for s3fifo (#312)
Signed-off-by: MrCroxx <mrcroxx@outlook.com>
1 parent 5899ee4 commit b50813b

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

foyer-memory/src/cache.rs

+16-10
Original file line numberDiff line numberDiff line change
@@ -451,16 +451,22 @@ where
451451
{
452452
pub fn state(&self) -> EntryState {
453453
match self {
454-
Entry::Fifo(FifoEntry::Hit(_)) | Entry::Lru(LruEntry::Hit(_)) | Entry::Lfu(LfuEntry::Hit(_)) => {
455-
EntryState::Hit
456-
}
457-
Entry::Fifo(FifoEntry::Wait(_)) | Entry::Lru(LruEntry::Wait(_)) | Entry::Lfu(LfuEntry::Wait(_)) => {
458-
EntryState::Wait
459-
}
460-
Entry::Fifo(FifoEntry::Miss(_)) | Entry::Lru(LruEntry::Miss(_)) | Entry::Lfu(LfuEntry::Miss(_)) => {
461-
EntryState::Miss
462-
}
463-
_ => unreachable!(),
454+
Entry::Fifo(FifoEntry::Hit(_))
455+
| Entry::Lru(LruEntry::Hit(_))
456+
| Entry::Lfu(LfuEntry::Hit(_))
457+
| Entry::S3Fifo(S3FifoEntry::Hit(_)) => EntryState::Hit,
458+
Entry::Fifo(FifoEntry::Wait(_))
459+
| Entry::Lru(LruEntry::Wait(_))
460+
| Entry::Lfu(LfuEntry::Wait(_))
461+
| Entry::S3Fifo(S3FifoEntry::Wait(_)) => EntryState::Wait,
462+
Entry::Fifo(FifoEntry::Miss(_))
463+
| Entry::Lru(LruEntry::Miss(_))
464+
| Entry::Lfu(LfuEntry::Miss(_))
465+
| Entry::S3Fifo(S3FifoEntry::Miss(_)) => EntryState::Miss,
466+
Entry::Fifo(FifoEntry::Invalid)
467+
| Entry::Lru(LruEntry::Invalid)
468+
| Entry::Lfu(LfuEntry::Invalid)
469+
| Entry::S3Fifo(S3FifoEntry::Invalid) => unreachable!(),
464470
}
465471
}
466472
}

foyer-memory/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
//! The handle that does not appear in either the indexer or the eviction container, and has no external owner, will be
6666
//! destroyed.
6767
68-
#![feature(trait_alias)]
6968
#![feature(offset_of)]
7069

7170
pub trait Key: Send + Sync + 'static + std::hash::Hash + Eq + Ord {}

0 commit comments

Comments
 (0)