pub trait TlsProvider: Send + Sync {
// Required methods
fn get_worker_id(&self) -> Option<usize>;
fn with_hit_buf(&self, f: &mut dyn FnMut(&mut ([usize; 64], usize)));
fn with_l1_filter(&self, f: &mut dyn FnMut(&mut ([u8; 4096], usize)));
fn with_last_flush_tick(&self, f: &mut dyn FnMut(&mut u64));
}Expand description
Trait for plug-and-play Thread-Local Storage (TLS) in no_std or custom RTOS environments.
Enables thread-local batching of hits and L1 probation filtering on platforms
where standard thread_local! is not available.
Required Methods§
Sourcefn get_worker_id(&self) -> Option<usize>
fn get_worker_id(&self) -> Option<usize>
Get the current worker thread ID (0..config.threads).
Returns None if the thread is not registered or cannot be resolved.
Sourcefn with_hit_buf(&self, f: &mut dyn FnMut(&mut ([usize; 64], usize)))
fn with_hit_buf(&self, f: &mut dyn FnMut(&mut ([usize; 64], usize)))
Access the thread-local Hit Buffer array.
The provider must execute the given closure with a mutable reference to the
current thread’s batch buffer: ([usize; 64], usize).
Sourcefn with_l1_filter(&self, f: &mut dyn FnMut(&mut ([u8; 4096], usize)))
fn with_l1_filter(&self, f: &mut dyn FnMut(&mut ([u8; 4096], usize)))
Access the thread-local L1 Probation Filter.
The provider must execute the given closure with a mutable reference to the
current thread’s L1 probation filter state: ([u8; 4096], usize).
Sourcefn with_last_flush_tick(&self, f: &mut dyn FnMut(&mut u64))
fn with_last_flush_tick(&self, f: &mut dyn FnMut(&mut u64))
Access the thread-local Last Flush Tick.
The provider must execute the given closure with a mutable reference to the current thread’s last flush tick value.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl TlsProvider for DefaultTls
std or crate feature loom or loom only.