pub struct LakehouseContext { /* private fields */ }Expand description
Bundles all runtime resources needed for lakehouse query execution.
This struct holds the data lake connection, metadata cache, and DataFusion runtime,
providing a single context object that can be passed through the query path. Parquet
byte-range caching is handled by the in-process L1 cache wrapped around the reader
factory’s object store (see object_cache::l1_wrap), not by this struct.
Implementations§
Source§impl LakehouseContext
impl LakehouseContext
Sourcepub async fn from_connection(
lake: Arc<DataLakeConnection>,
) -> Result<Arc<LakehouseContext>, Error>
pub async fn from_connection( lake: Arc<DataLakeConnection>, ) -> Result<Arc<LakehouseContext>, Error>
Builds a lakehouse context from an already-connected DataLakeConnection.
Runs migrate_lakehouse on the supplied connection (idempotent) and
creates the DataFusion runtime. The caller is responsible for running
migrate_db (ingestion schema) before this if both migrations are needed
— the monolith does this via connect_to_remote_data_lake.
Sourcepub async fn from_env(
policy: WritablePolicy,
) -> Result<Arc<LakehouseContext>, Error>
pub async fn from_env( policy: WritablePolicy, ) -> Result<Arc<LakehouseContext>, Error>
Reads MICROMEGAS_SQL_CONNECTION_STRING and MICROMEGAS_OBJECT_STORE_URI,
connects to the data lake under policy, runs lakehouse migrations, and creates the
runtime environment.
Sourcepub fn new(
lake: Arc<DataLakeConnection>,
runtime: Arc<RuntimeEnv>,
) -> Result<LakehouseContext, Error>
pub fn new( lake: Arc<DataLakeConnection>, runtime: Arc<RuntimeEnv>, ) -> Result<LakehouseContext, Error>
Creates a new lakehouse context with a default-sized metadata cache.
Fails if MICROMEGAS_DEFAULT_AUDIENCE is set to a malformed value – every caller is a
startup path, so a typo in that knob stops the role rather than silently relabelling
legacy data (see default_audience_from_env).
Sourcepub fn with_caches(
lake: Arc<DataLakeConnection>,
runtime: Arc<RuntimeEnv>,
metadata_cache: Arc<MetadataCache>,
default_audience: Arc<str>,
) -> LakehouseContext
pub fn with_caches( lake: Arc<DataLakeConnection>, runtime: Arc<RuntimeEnv>, metadata_cache: Arc<MetadataCache>, default_audience: Arc<str>, ) -> LakehouseContext
Creates a new lakehouse context with a custom metadata cache.
Takes default_audience rather than re-reading the environment: a context built this way
must resolve the same default as the one it is derived from (see the field’s doc comment).
Sourcepub fn default_audience(&self) -> Arc<str> ⓘ
pub fn default_audience(&self) -> Arc<str> ⓘ
Returns the audience a never-stamped process is read as
(MICROMEGAS_DEFAULT_AUDIENCE).
Sourcepub fn lake(&self) -> &Arc<DataLakeConnection> ⓘ
pub fn lake(&self) -> &Arc<DataLakeConnection> ⓘ
Returns the data lake connection.
Sourcepub fn metadata_cache(&self) -> &Arc<MetadataCache> ⓘ
pub fn metadata_cache(&self) -> &Arc<MetadataCache> ⓘ
Returns the metadata cache.
Sourcepub fn with_runtime(&self, runtime: Arc<RuntimeEnv>) -> Arc<LakehouseContext> ⓘ
pub fn with_runtime(&self, runtime: Arc<RuntimeEnv>) -> Arc<LakehouseContext> ⓘ
Clones this context with runtime swapped, sharing the metadata cache and reader
factory. Deliberately a struct-update clone rather than a call to new()/
with_caches() — those rebuild the MetadataCache and ReaderFactory, which would
throw away the shared metadata cache per query.
Sourcepub fn reader_factory(&self) -> &Arc<ReaderFactory> ⓘ
pub fn reader_factory(&self) -> &Arc<ReaderFactory> ⓘ
Returns the shared ReaderFactory.
Sourcepub fn audience_index(&self) -> &Arc<AudienceIndex> ⓘ
pub fn audience_index(&self) -> &Arc<AudienceIndex> ⓘ
Returns the shared call-level-guard audience index.
Sourcepub fn query_denials(&self) -> &Arc<QueryDenyList> ⓘ
pub fn query_denials(&self) -> &Arc<QueryDenyList> ⓘ
Returns the shared query deny list.
Trait Implementations§
Source§impl Clone for LakehouseContext
impl Clone for LakehouseContext
Source§fn clone(&self) -> LakehouseContext
fn clone(&self) -> LakehouseContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for LakehouseContext
impl !UnwindSafe for LakehouseContext
impl Freeze for LakehouseContext
impl Send for LakehouseContext
impl Sync for LakehouseContext
impl Unpin for LakehouseContext
impl UnsafeUnpin for LakehouseContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].