pub struct QueryApi<S: StorageClient + 'static> { /* private fields */ }Expand description
Universal Query API – Core Layer
Implementations§
Source§impl<S: StorageClient + Clone + 'static> QueryApi<S>
impl<S: StorageClient + Clone + 'static> QueryApi<S>
Sourcepub fn new(storage: Arc<RwLock<S>>, stats_manager: Arc<StatsManager>) -> Self
pub fn new(storage: Arc<RwLock<S>>, stats_manager: Arc<StatsManager>) -> Self
Create a new QueryApi instance with external StatsManager
Sourcepub fn execute_with_execution(
&mut self,
query: &str,
ctx: QueryRequest,
execution: &TransactionExecution,
) -> CoreResult<QueryResult>
pub fn execute_with_execution( &mut self, query: &str, ctx: QueryRequest, execution: &TransactionExecution, ) -> CoreResult<QueryResult>
Execute a query with an explicit transaction execution binding.
The execution parameter carries the full transaction identity
(ID, timestamps, mode, owner) from TransactionManager.
This is the preferred entry point for all transactional DML.
Sourcepub fn execute(
&mut self,
query: &str,
ctx: QueryRequest,
) -> CoreResult<QueryResult>
pub fn execute( &mut self, query: &str, ctx: QueryRequest, ) -> CoreResult<QueryResult>
pub fn execute_with_operation_storage( &mut self, query: &str, ctx: QueryRequest, storage: S, ) -> CoreResult<QueryResult>
Sourcepub fn execute_stream_with_execution(
&mut self,
query: &str,
ctx: QueryRequest,
execution: &TransactionExecution,
) -> CoreResult<StreamingQueryResult>
pub fn execute_stream_with_execution( &mut self, query: &str, ctx: QueryRequest, execution: &TransactionExecution, ) -> CoreResult<StreamingQueryResult>
Execute a query with an explicit transaction execution binding (streaming).
Sourcepub fn execute_stream(
&mut self,
query: &str,
ctx: QueryRequest,
) -> CoreResult<StreamingQueryResult>
pub fn execute_stream( &mut self, query: &str, ctx: QueryRequest, ) -> CoreResult<StreamingQueryResult>
Execute a query and return a StreamingQueryResult for chunk-at-a-time consumption.
Unlike [execute] which materialises the full result set, this method
returns a thread-safe streaming handle that lets the caller pull chunks
one at a time. Useful for SSE / gRPC streaming endpoints.
pub fn execute_stream_with_operation_storage( &mut self, query: &str, ctx: QueryRequest, storage: S, ) -> CoreResult<StreamingQueryResult>
Source§impl<S> QueryApi<S>
impl<S> QueryApi<S>
pub fn execute_batch( &mut self, queries: &[String], ctx: QueryRequest, ) -> Vec<Result<QueryResult, CoreError>>
pub fn dml_plan_memo_hits(&self) -> u64
pub fn dml_template_ast_parse_count(&self) -> u64
pub fn dml_template_ast_hit_count(&self) -> u64
Source§impl<S> QueryApi<S>
impl<S> QueryApi<S>
Sourcepub fn execute_batch_grouped(
&mut self,
queries: &[String],
ctx: QueryRequest,
group_size: usize,
) -> Vec<Result<QueryResult, CoreError>>
pub fn execute_batch_grouped( &mut self, queries: &[String], ctx: QueryRequest, group_size: usize, ) -> Vec<Result<QueryResult, CoreError>>
Execute a batch of auto-commit DML statements in group-commit windows.
group_size is clamped to >= 1; each consecutive group of statements
shares one write timestamp, one WAL fsync, and one commit point.
Statement results are returned per statement, in order, exactly like
execute_batch; failed statements roll back only their own writes.
DDL / transaction statements / USE must not be mixed in (same contract
as execute_batch).
Source§impl<S: StorageClient + Clone + 'static> QueryApi<S>
impl<S: StorageClient + Clone + 'static> QueryApi<S>
Sourcepub fn with_schema_manager(self, schema_manager: Arc<SchemaManager>) -> Self
pub fn with_schema_manager(self, schema_manager: Arc<SchemaManager>) -> Self
Attach a schema manager to the pipeline.
Sourcepub fn with_sync_manager(self, sync_manager: Arc<SyncManager>) -> Self
pub fn with_sync_manager(self, sync_manager: Arc<SyncManager>) -> Self
Attach a sync manager to the pipeline.
Sourcepub fn with_optimizer_engine(
storage: Arc<RwLock<S>>,
stats_manager: Arc<StatsManager>,
optimizer_engine: Arc<OptimizerEngine>,
schema_manager: Option<Arc<SchemaManager>>,
) -> Self
pub fn with_optimizer_engine( storage: Arc<RwLock<S>>, stats_manager: Arc<StatsManager>, optimizer_engine: Arc<OptimizerEngine>, schema_manager: Option<Arc<SchemaManager>>, ) -> Self
Create a new QueryApi using an externally configured optimizer engine,
so server-level settings (e.g. the [parallel] partitioning section)
reach the query pipeline. The engine instance is shared by value.
Sourcepub fn with_cost_config(self, config: CostModelConfig) -> Self
pub fn with_cost_config(self, config: CostModelConfig) -> Self
Apply an explicit cost model configuration, replacing the default engine built by the constructors.
Assembly-time only: call before the first query. The replacement engine is freshly built, exactly like the constructor default; previously installed per-space overrides are carried over.
Sourcepub fn with_cost_profile(
self,
profile: StorageCostProfile,
runtime: &RuntimeConfig,
) -> Self
pub fn with_cost_profile( self, profile: StorageCostProfile, runtime: &RuntimeConfig, ) -> Self
Apply a storage cost profile with runtime knowledge.
Memory-mode deployments short-circuit to the in-memory preset without
touching the filesystem; embedded in-memory users must call this (or
Self::with_cost_config), otherwise the constructor default prices
queries with mechanical-drive costs.
Sourcepub fn with_space_cost_profiles(
self,
profiles: &HashMap<String, StorageCostProfile>,
runtime: &RuntimeConfig,
) -> Self
pub fn with_space_cost_profiles( self, profiles: &HashMap<String, StorageCostProfile>, runtime: &RuntimeConfig, ) -> Self
Apply per-space storage cost profile overrides.
Spaces absent from the map keep the global profile; memory-mode deployments short-circuit every space to the in-memory preset. Assembly-time only: call before the first query.
Sourcepub fn with_default_cost_profile_label(self, label: String) -> Self
pub fn with_default_cost_profile_label(self, label: String) -> Self
Override the global cost profile display label (assembly-time only).
Used by assemblies that build their own engine (e.g. the network server with extra engine settings) so EXPLAIN still names the effective profile.
Sourcepub fn cost_config(&self) -> CostModelConfig
pub fn cost_config(&self) -> CostModelConfig
Effective cost model configuration currently in force.
Sourcepub fn with_statistics_settings(
self,
sample_limit: usize,
min_epoch_delta: u64,
) -> Self
pub fn with_statistics_settings( self, sample_limit: usize, min_epoch_delta: u64, ) -> Self
Apply the server-configured statistics collection settings to the pipeline (sampling window and automatic-refresh epoch delta).
The pipeline keeps fallback defaults when this is never called, so embedded users without server config are unaffected.
Sourcepub fn statistics_sample_limit(&self) -> usize
pub fn statistics_sample_limit(&self) -> usize
Effective statistics sampling window currently in force.
Sourcepub fn with_password_history_depth(self, depth: usize) -> Self
pub fn with_password_history_depth(self, depth: usize) -> Self
Set the retained password-history depth applied by user-management operations (assembly-time only).
Sourcepub fn statistics_min_epoch_delta(&self) -> u64
pub fn statistics_min_epoch_delta(&self) -> u64
Effective statistics refresh epoch delta currently in force.
Install a shared scheduler and query registry into an existing pipeline (used when the pipeline was built by another constructor).
Access the shared scheduler instance held by the pipeline, if any.
Sourcepub fn query_registry(&self) -> Option<Arc<QueryRegistry>>
pub fn query_registry(&self) -> Option<Arc<QueryRegistry>>
Access the query registry instance held by the pipeline, if any.
Sourcepub fn install_query_manager(&mut self, query_manager: Arc<QueryManager>)
pub fn install_query_manager(&mut self, query_manager: Arc<QueryManager>)
Install the global QueryManager so per-query runtimes forward KILL QUERY,
finish tracking, and progress events into one registry. Mirror of
[install_shared_scheduler]: called once at server startup.
Sourcepub fn set_extensions(&mut self, extensions: Arc<ExtensionRegistry>)
pub fn set_extensions(&mut self, extensions: Arc<ExtensionRegistry>)
Install a shared pipeline-extension registry (unstable experimental API) into an existing pipeline.
Sourcepub fn extensions(&self) -> Arc<ExtensionRegistry> ⓘ
pub fn extensions(&self) -> Arc<ExtensionRegistry> ⓘ
Pipeline-extension registry backing this API.
Sourcepub fn collect_statistics(&self, space: &str, force: bool) -> CoreResult<()>
pub fn collect_statistics(&self, space: &str, force: bool) -> CoreResult<()>
Collect (or serve cached) optimizer statistics for a space.
force bypasses the schema-version gate so an explicit ANALYZE always
refreshes the statistics. Failures are returned as Err, never panic.
Sourcepub fn plan_cache_hit_rate(&self) -> f64
pub fn plan_cache_hit_rate(&self) -> f64
Query-plan-cache hit rate across all executed statements.
Sourcepub fn plan_cache_len(&self) -> usize
pub fn plan_cache_len(&self) -> usize
Number of entries currently held in the query plan cache.
Auto Trait Implementations§
impl<S> !Freeze for QueryApi<S>
impl<S> !RefUnwindSafe for QueryApi<S>
impl<S> !UnwindSafe for QueryApi<S>
impl<S> Send for QueryApi<S>where
QueryPipelineManager<S>: Send,
impl<S> Sync for QueryApi<S>where
QueryPipelineManager<S>: Sync,
impl<S> Unpin for QueryApi<S>where
QueryPipelineManager<S>: Unpin,
impl<S> UnsafeUnpin for QueryApi<S>where
QueryPipelineManager<S>: UnsafeUnpin,
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.