pub struct Daemon<K, V, S> {Show 15 fields
pub hasher: S,
pub arena: Arena,
pub t1: Arc<T1<K, V>>,
pub t2: Arc<T2<K, V>>,
pub cache: Arc<Cache<K, V>>,
pub cmd_rx: Arc<LossyQueue<Command<K, V>>>,
pub hit_rx: Arc<LossyQueue<[usize; 64]>>,
pub epoch: Arc<AtomicU32>,
pub poll_us: u64,
pub admission: Arc<AdmissionFilter>,
pub hit_accumulator: Vec<usize>,
pub last_decay_epoch: u32,
pub garbage_queue: Vec<(*mut Node<K, V>, usize)>,
pub worker_states: Arc<[WorkerState]>,
pub daemon_tick: Arc<AtomicU64>,
}Fields§
§hasher: S§arena: Arena§t1: Arc<T1<K, V>>§t2: Arc<T2<K, V>>§cache: Arc<Cache<K, V>>§cmd_rx: Arc<LossyQueue<Command<K, V>>>§hit_rx: Arc<LossyQueue<[usize; 64]>>§epoch: Arc<AtomicU32>§poll_us: u64Configurable poll interval in microseconds (1 000–10 000 µs). Controls the trade-off between CPU idle cost and hit-signal latency.
admission: Arc<AdmissionFilter>§hit_accumulator: Vec<usize>Pre-allocated accumulator for deferred-sort hit processing.
last_decay_epoch: u32§garbage_queue: Vec<(*mut Node<K, V>, usize)>§worker_states: Arc<[WorkerState]>§daemon_tick: Arc<AtomicU64>Monotonically increasing tick counter — incremented on every poll loop. Workers read this (Relaxed) to decide whether to time-flush their TLS buffers without needing a hardware clock in no_std mode.
Implementations§
Source§impl<K, V, S> Daemon<K, V, S>
impl<K, V, S> Daemon<K, V, S>
pub fn new( hasher: S, capacity: usize, t1: Arc<T1<K, V>>, t2: Arc<T2<K, V>>, cache: Arc<Cache<K, V>>, cmd_rx: Arc<LossyQueue<Command<K, V>>>, hit_rx: Arc<LossyQueue<[usize; 64]>>, epoch: Arc<AtomicU32>, duration: u32, poll_us: u64, worker_states: Arc<[WorkerState]>, daemon_tick: Arc<AtomicU64>, ) -> Self
Sourcepub fn run(self)
pub fn run(self)
Main Daemon event loop.
§std mode
Called from a dedicated std::thread::spawn inside DualCacheFF::new.
Sleeps poll_us microseconds when the command queue is empty.
§no_std mode
The caller (e.g. RTOS task) must invoke daemon.run() on a dedicated
task. The loop uses core::hint::spin_loop() between iterations;
the RTOS scheduler handles preemption and CPU sharing.
Trait Implementations§
Auto Trait Implementations§
impl<K, V, S> Freeze for Daemon<K, V, S>where
S: Freeze,
impl<K, V, S> !RefUnwindSafe for Daemon<K, V, S>
impl<K, V, S> !Sync for Daemon<K, V, S>
impl<K, V, S> Unpin for Daemon<K, V, S>where
S: Unpin,
impl<K, V, S> UnsafeUnpin for Daemon<K, V, S>where
S: UnsafeUnpin,
impl<K, V, S> !UnwindSafe for Daemon<K, V, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more