Struct spacetimedb::execution_context::ExecutionContext
source · pub struct ExecutionContext {
pub metrics: Arc<RwLock<Metrics>>,
pub slow_query_config: SlowQueryConfig,
/* private fields */
}Expand description
Represents the context under which a database runtime method is executed. In particular it provides details about the currently executing txn to runtime operations. More generally it acts as a container for information that database operations may require to function correctly.
Fields§
§metrics: Arc<RwLock<Metrics>>The Metrics to be reported for this transaction.
slow_query_config: SlowQueryConfigConfiguration threshold for detecting slow queries.
Implementations§
source§impl ExecutionContext
impl ExecutionContext
sourcepub fn reducer(database: Address, ctx: ReducerContext) -> Self
pub fn reducer(database: Address, ctx: ReducerContext) -> Self
Returns an ExecutionContext for a reducer transaction.
sourcepub fn sql(database: Address, slow_query_config: SlowQueryConfig) -> Self
pub fn sql(database: Address, slow_query_config: SlowQueryConfig) -> Self
Returns an ExecutionContext for a one-off sql query.
sourcepub fn subscribe(database: Address, slow_query_config: SlowQueryConfig) -> Self
pub fn subscribe(database: Address, slow_query_config: SlowQueryConfig) -> Self
Returns an ExecutionContext for an initial subscribe call.
sourcepub fn incremental_update(
database: Address,
slow_query_config: SlowQueryConfig
) -> Self
pub fn incremental_update( database: Address, slow_query_config: SlowQueryConfig ) -> Self
Returns an ExecutionContext for a subscription update.
sourcepub fn internal(database: Address) -> Self
pub fn internal(database: Address) -> Self
Returns an ExecutionContext for an internal database operation.
sourcepub fn database(&self) -> Address
pub fn database(&self) -> Address
Returns the address of the database on which we are operating.
sourcepub fn reducer_name(&self) -> &str
pub fn reducer_name(&self) -> &str
If this is a reducer context, returns the name of the reducer.
sourcepub fn reducer_context(&self) -> Option<&ReducerContext>
pub fn reducer_context(&self) -> Option<&ReducerContext>
If this is a reducer context, returns the full reducer metadata.
sourcepub fn workload(&self) -> WorkloadType
pub fn workload(&self) -> WorkloadType
Returns the type of workload that is being executed.
Trait Implementations§
source§impl Clone for ExecutionContext
impl Clone for ExecutionContext
source§fn clone(&self) -> ExecutionContext
fn clone(&self) -> ExecutionContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Default for ExecutionContext
impl Default for ExecutionContext
source§fn default() -> ExecutionContext
fn default() -> ExecutionContext
Auto Trait Implementations§
impl !Freeze for ExecutionContext
impl !RefUnwindSafe for ExecutionContext
impl Send for ExecutionContext
impl Sync for ExecutionContext
impl Unpin for ExecutionContext
impl !UnwindSafe for ExecutionContext
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
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