pub trait LookupTable: Send + Sync {
// Required methods
fn get_cached(&self, key: &[u8]) -> LookupResult;
fn get(&self, key: &[u8]) -> LookupResult;
fn insert(&self, key: &[u8], value: RecordBatch);
fn invalidate(&self, key: &[u8]);
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Synchronous lookup table interface for Ring 0 operators.
Implementations must be Send + Sync to allow sharing across threads
in the thread-per-core runtime. The hot-path method is
get_cached which should be < 500ns.
Writes (insert/invalidate) come from the Ring 1 CDC adapter or bulk-load path, not from the hot path.
Required Methods§
Sourcefn get_cached(&self, key: &[u8]) -> LookupResult
fn get_cached(&self, key: &[u8]) -> LookupResult
Look up a key in the in-memory cache only (Ring 0).
This is the fast path — must not block or perform I/O.
Returns LookupResult::NotFound on cache miss; callers should
then try get for a deeper lookup.
§Performance
Target: < 500ns
Sourcefn get(&self, key: &[u8]) -> LookupResult
fn get(&self, key: &[u8]) -> LookupResult
Look up a key, potentially checking slower storage tiers.
May check a disk cache, remote cache, or trigger an async
source query. Returns LookupResult::Pending if the lookup
requires an async fetch that hasn’t completed yet.
Sourcefn insert(&self, key: &[u8], value: RecordBatch)
fn insert(&self, key: &[u8], value: RecordBatch)
Insert or update a cached entry.
Called by the CDC adapter or bulk-load path when new data arrives from the source. This is NOT on the hot path.
Sourcefn invalidate(&self, key: &[u8])
fn invalidate(&self, key: &[u8])
Invalidate a cached entry.
Called when the source signals a delete or the TTL expires.