Skip to content

Commit

Permalink
fix: fix state() for s3fifo (#312)
Browse files Browse the repository at this point in the history
Signed-off-by: MrCroxx <mrcroxx@outlook.com>
  • Loading branch information
MrCroxx authored Apr 9, 2024
1 parent 3df0479 commit 6f546d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
26 changes: 16 additions & 10 deletions foyer-memory/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,16 +451,22 @@ where
{
pub fn state(&self) -> EntryState {
match self {
Entry::Fifo(FifoEntry::Hit(_)) | Entry::Lru(LruEntry::Hit(_)) | Entry::Lfu(LfuEntry::Hit(_)) => {
EntryState::Hit
}
Entry::Fifo(FifoEntry::Wait(_)) | Entry::Lru(LruEntry::Wait(_)) | Entry::Lfu(LfuEntry::Wait(_)) => {
EntryState::Wait
}
Entry::Fifo(FifoEntry::Miss(_)) | Entry::Lru(LruEntry::Miss(_)) | Entry::Lfu(LfuEntry::Miss(_)) => {
EntryState::Miss
}
_ => unreachable!(),
Entry::Fifo(FifoEntry::Hit(_))
| Entry::Lru(LruEntry::Hit(_))
| Entry::Lfu(LfuEntry::Hit(_))
| Entry::S3Fifo(S3FifoEntry::Hit(_)) => EntryState::Hit,
Entry::Fifo(FifoEntry::Wait(_))
| Entry::Lru(LruEntry::Wait(_))
| Entry::Lfu(LfuEntry::Wait(_))
| Entry::S3Fifo(S3FifoEntry::Wait(_)) => EntryState::Wait,
Entry::Fifo(FifoEntry::Miss(_))
| Entry::Lru(LruEntry::Miss(_))
| Entry::Lfu(LfuEntry::Miss(_))
| Entry::S3Fifo(S3FifoEntry::Miss(_)) => EntryState::Miss,
Entry::Fifo(FifoEntry::Invalid)
| Entry::Lru(LruEntry::Invalid)
| Entry::Lfu(LfuEntry::Invalid)
| Entry::S3Fifo(S3FifoEntry::Invalid) => unreachable!(),
}
}
}
Expand Down
1 change: 0 additions & 1 deletion foyer-memory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
//! The handle that does not appear in either the indexer or the eviction container, and has no external owner, will be
//! destroyed.

#![feature(trait_alias)]
#![feature(offset_of)]

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

0 comments on commit 6f546d0

Please sign in to comment.