tinylfu_cached/cache/
buffer_event.rs

1use crate::cache::types::KeyHash;
2
3#[cfg(not(feature = "bench_testable"))]
4pub(crate) enum BufferEvent {
5    Full(Vec<KeyHash>),
6    Shutdown,
7}
8
9#[cfg(not(feature = "bench_testable"))]
10pub(crate) trait BufferConsumer {
11    fn accept(&self, event: BufferEvent);
12}
13
14/// BufferEvent::Full signifies that a buffer in the [`crate::cache::pool::Pool`] is full
15/// and the consumer should accepts the buffer, called draining.
16/// During the event of cache shutdown, the consumer of the buffer needs to be shutdown.
17/// Buffer::Shutdown signals the consumer of the buffer to shutdown.
18/// Currently, `crate::cache::policy::admission_policy::AdmissionPolicy` is the consumer of the buffer.
19#[cfg(feature = "bench_testable")]
20pub enum BufferEvent {
21    Full(Vec<KeyHash>),
22    Shutdown,
23}
24
25#[cfg(feature = "bench_testable")]
26pub trait BufferConsumer {
27    fn accept(&self, event: BufferEvent);
28}