pub struct BackgroundExecution {Show 15 fields
pub execution_id: ExecutionId,
pub tenant_id: TenantId,
pub callable_name: String,
pub input: Option<String>,
pub context: Option<HashMap<String, String>>,
pub config: BackgroundExecutionConfig,
pub status: BackgroundExecutionStatus,
pub queued_at: DateTime<Utc>,
pub started_at: Option<DateTime<Utc>>,
pub completed_at: Option<DateTime<Utc>>,
pub output: Option<Value>,
pub error: Option<ExecutionError>,
pub target_binding_applied: bool,
pub trigger_id: Option<TriggerId>,
pub metadata: Option<HashMap<String, Value>>,
}Expand description
BackgroundExecution - A background execution record @see packages/enact-schemas/src/execution.schemas.ts - backgroundExecutionSchema
Fields§
§execution_id: ExecutionIdExecution ID
tenant_id: TenantIdTenant that owns this execution
callable_name: StringCallable to invoke
input: Option<String>Input to pass to the callable
context: Option<HashMap<String, String>>Context to pass
config: BackgroundExecutionConfigConfiguration
status: BackgroundExecutionStatusCurrent status
queued_at: DateTime<Utc>When execution was queued
started_at: Option<DateTime<Utc>>When execution started
completed_at: Option<DateTime<Utc>>When execution completed
output: Option<Value>Output (populated on completion)
error: Option<ExecutionError>Error (populated on failure)
target_binding_applied: boolWhether target binding was applied
trigger_id: Option<TriggerId>Trigger that spawned this execution (if any)
metadata: Option<HashMap<String, Value>>Metadata
Implementations§
Source§impl BackgroundExecution
impl BackgroundExecution
Sourcepub fn new(
tenant_id: TenantId,
callable_name: impl Into<String>,
config: BackgroundExecutionConfig,
) -> Self
pub fn new( tenant_id: TenantId, callable_name: impl Into<String>, config: BackgroundExecutionConfig, ) -> Self
Create a new background execution
Sourcepub fn from_trigger(
tenant_id: TenantId,
trigger_id: TriggerId,
callable_name: impl Into<String>,
input: Option<String>,
context: Option<HashMap<String, String>>,
target_binding: Option<TargetBindingConfig>,
retry: Option<RetryConfig>,
) -> Self
pub fn from_trigger( tenant_id: TenantId, trigger_id: TriggerId, callable_name: impl Into<String>, input: Option<String>, context: Option<HashMap<String, String>>, target_binding: Option<TargetBindingConfig>, retry: Option<RetryConfig>, ) -> Self
Create from a trigger
Sourcepub fn from_spawn_mode(
spawn_mode: &SpawnMode,
tenant_id: TenantId,
callable_name: impl Into<String>,
input: Option<String>,
context: Option<HashMap<String, String>>,
) -> Option<Self>
pub fn from_spawn_mode( spawn_mode: &SpawnMode, tenant_id: TenantId, callable_name: impl Into<String>, input: Option<String>, context: Option<HashMap<String, String>>, ) -> Option<Self>
Create from SpawnMode::Child
This bridges the gap between SpawnMode::Child { background: true, .. } and the BackgroundExecution infrastructure.
@see docs/TECHNICAL/32-SPAWN-MODE.md
Sourcepub fn should_run_background(spawn_mode: &SpawnMode) -> bool
pub fn should_run_background(spawn_mode: &SpawnMode) -> bool
Check if a SpawnMode should create a background execution
Sourcepub fn fail(&mut self, error: ExecutionError)
pub fn fail(&mut self, error: ExecutionError)
Mark execution as failed
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Check if execution has completed (successfully or not)
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if execution succeeded
Sourcepub fn duration_ms(&self) -> Option<i64>
pub fn duration_ms(&self) -> Option<i64>
Calculate execution duration
Sourcepub fn is_silent(&self) -> bool
pub fn is_silent(&self) -> bool
Check if execution should suppress streaming events (silent mode)
Sourcepub fn requires_result(&self) -> bool
pub fn requires_result(&self) -> bool
Check if execution requires waiting for result
Trait Implementations§
Source§impl Clone for BackgroundExecution
impl Clone for BackgroundExecution
Source§fn clone(&self) -> BackgroundExecution
fn clone(&self) -> BackgroundExecution
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more