Skip to main content

TlsProvider

Trait TlsProvider 

Source
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§

Source

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.

Source

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).

Source

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).

Source

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§

Source§

impl TlsProvider for DefaultTls

Available on crate feature std or crate feature loom or loom only.