pub trait TableLoader: Send + Sync {
// Required methods
fn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<LookupResult, LookupError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn name(&self) -> &str;
// Provided methods
fn lookup_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keys: &'life1 [&'life2 [u8]],
) -> Pin<Box<dyn Future<Output = Result<Vec<LookupResult>, LookupError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), LookupError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait for loading data from external reference tables.
Implementations of this trait provide access to external data sources for enriching streaming events with dimension data.
§Thread Safety
Implementations must be Send + Sync to allow concurrent access from
multiple operator instances.
§Performance Considerations
- Lookups may be called frequently (per-event), so implementations should be efficient
- Consider batch lookups (
TableLoader::lookup_batch) for better throughput when multiple keys need to be looked up - The
LookupJoinOperator(inlaminar-core) caches results, so implementations don’t need their own cache
Required Methods§
Sourcefn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<LookupResult, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<LookupResult, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
Sourcefn lookup_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keys: &'life1 [&'life2 [u8]],
) -> Pin<Box<dyn Future<Output = Result<Vec<LookupResult>, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn lookup_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keys: &'life1 [&'life2 [u8]],
) -> Pin<Box<dyn Future<Output = Result<Vec<LookupResult>, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Looks up multiple keys in a single batch operation.
Default implementation calls lookup for each key.
Implementations should override this for better performance when the
underlying system supports batch queries.
§Arguments
keys- The keys to look up
§Returns
A vector of results in the same order as the input keys.
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Checks if the table loader is healthy and can accept requests.
Default implementation returns true. Override for loaders that
need to maintain connections to external systems.
Sourcefn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Closes the table loader and releases any resources.
Default implementation does nothing. Override for loaders that hold connections or other resources.