pub trait LookupSource: Send + Sync {
// Required methods
fn query(
&self,
keys: &[&[u8]],
predicates: &[Predicate],
projection: &[ColumnId],
) -> impl Future<Output = Result<Vec<Option<RecordBatch>>, LookupError>> + Send;
fn capabilities(&self) -> LookupSourceCapabilities;
fn source_name(&self) -> &str;
fn schema(&self) -> SchemaRef;
// Provided methods
fn estimated_row_count(&self) -> Option<u64> { ... }
fn health_check(
&self,
) -> impl Future<Output = Result<(), LookupError>> + Send { ... }
}Expand description
Async data source for lookup table refresh and query.
This trait uses RPITIT (return-position impl Trait in traits,
stabilized in Rust 1.75) for zero-overhead async dispatch.
§Implementing
Sources that support predicate/projection pushdown should set the
corresponding flags in capabilities() and
handle filtered queries in query(). Sources that
do not support pushdown can be wrapped in PushdownAdapter to
get automatic local evaluation.
Required Methods§
Sourcefn query(
&self,
keys: &[&[u8]],
predicates: &[Predicate],
projection: &[ColumnId],
) -> impl Future<Output = Result<Vec<Option<RecordBatch>>, LookupError>> + Send
fn query( &self, keys: &[&[u8]], predicates: &[Predicate], projection: &[ColumnId], ) -> impl Future<Output = Result<Vec<Option<RecordBatch>>, LookupError>> + Send
Query the source by keys, predicates, and/or projection.
Returns a Vec<Option<RecordBatch>> aligned with the input keys:
Some(batch)— key found, value is a single-rowRecordBatchNone— key not found
Sourcefn capabilities(&self) -> LookupSourceCapabilities
fn capabilities(&self) -> LookupSourceCapabilities
Capabilities this source advertises.
Sourcefn source_name(&self) -> &str
fn source_name(&self) -> &str
Source name for logging and metrics.
Provided Methods§
Sourcefn estimated_row_count(&self) -> Option<u64>
fn estimated_row_count(&self) -> Option<u64>
Optional row count estimate for query planning.
Sourcefn health_check(&self) -> impl Future<Output = Result<(), LookupError>> + Send
fn health_check(&self) -> impl Future<Output = Result<(), LookupError>> + Send
Health check. Default: always healthy.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.