pub struct CalExecutor { /* private fields */ }Expand description
CAL query executor.
Stateless aside from configuration and a parse cache. Create once and call
execute() for each query. Thread-safe.
Implementations§
Source§impl CalExecutor
impl CalExecutor
Sourcepub fn new(config: CalExecutorConfig) -> Self
pub fn new(config: CalExecutorConfig) -> Self
Create a new executor with the given configuration.
Sourcepub fn parse_cached(&self, input: &str) -> Result<CalQuery, CalError>
pub fn parse_cached(&self, input: &str) -> Result<CalQuery, CalError>
Parse input, reusing a cached AST for identical text.
Returns a clone: execute binds LET values into the query, so the
cached entry must stay pristine. Cloning an AST is still far cheaper
than lexing + parsing + validating one.
A poisoned lock degrades to a plain parse rather than failing the query — the cache is an optimization, and a caller’s statement should not fail because some other thread panicked.
Sourcepub fn plan_cache_len(&self) -> usize
pub fn plan_cache_len(&self) -> usize
How many statements the plan cache currently holds. Diagnostics and tests; not a stability guarantee.
Sourcepub fn with_governance(self, host: Arc<dyn GovernanceHost>) -> Self
pub fn with_governance(self, host: Arc<dyn GovernanceHost>) -> Self
Attach the governance host that backs RUN LOOP, APPROVE,
REJECT, APPLY, ROLLBACK, and the loop DESCRIBE reads.
Sourcepub fn config(&self) -> &CalExecutorConfig
pub fn config(&self) -> &CalExecutorConfig
The effective configuration (read-only; for observability surfaces).
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create an executor with all defaults.
Sourcepub fn execute(
&self,
input: &str,
store: &dyn CalStoreFacade,
) -> Result<CalExecResult, CalError>
pub fn execute( &self, input: &str, store: &dyn CalStoreFacade, ) -> Result<CalExecResult, CalError>
Parse and execute a CAL query string against store.
This is the primary entry point. Callers that have already parsed the
query can call execute_query() instead.
§Errors
Returns a CalError for parse failures or execution errors that map to
a specific CAL error code. Store errors that do not map to a CAL code
are wrapped in CalError::BudgetExceeded.
Sourcepub fn execute_parsed(
&self,
query: CalQuery,
original_text: &str,
store: &dyn CalStoreFacade,
) -> Result<CalExecResult, CalError>
pub fn execute_parsed( &self, query: CalQuery, original_text: &str, store: &dyn CalStoreFacade, ) -> Result<CalExecResult, CalError>
Execute an already-parsed CalQuery AST against the store.
Used by the application/json+cal wire format path where the AST
arrives as JSON rather than text. The original_text parameter is
used for the query hash and the query field in the result; pass
the JSON body or a synthetic representation.
pub fn execute_statement( &self, stmt: &CalStatement, store: &dyn CalStoreFacade, query: &CalQuery, exec_warnings: &mut Vec<String>, ) -> Result<CalResultPayload, CalError>
Auto Trait Implementations§
impl !Freeze for CalExecutor
impl !RefUnwindSafe for CalExecutor
impl !UnwindSafe for CalExecutor
impl Send for CalExecutor
impl Sync for CalExecutor
impl Unpin for CalExecutor
impl UnsafeUnpin for CalExecutor
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Fruit for T
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 more