Crate execution_engine

Crate execution_engine 

Source
Expand description

Cloudops Execution Engine

Production-ready async execution engine for system commands.

§Features

  • Async/non-blocking execution
  • Real-time output streaming
  • Semaphore-based concurrency control
  • Automatic memory cleanup
  • Resource limits (timeout, output size, concurrency)
  • Event-driven updates

§Example

use execution_engine::*;
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let config = ExecutionConfig::default();
    let engine = Arc::new(ExecutionEngine::new(config).unwrap());

    let request = ExecutionRequest {
        id: Uuid::new_v4(),
        command: Command::Shell {
            command: "echo 'Hello'".to_string(),
            shell: "/bin/bash".to_string(),
        },
        timeout_ms: Some(5000),
        env: HashMap::new(),
        working_dir: None,
        metadata: ExecutionMetadata::default(),
    };

    let execution_id = engine.execute(request).await.unwrap();

    let result = engine.wait_for_completion(execution_id).await.unwrap();

    println!("Output: {}", result.stdout);
}

Structs§

Arc
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
DateTime
ISO 8601 combined date and time with time zone.
Duration
A Duration type to represent a span of time, typically used for system timeouts.
ExecutionConfig
Configuration for ExecutionEngine
ExecutionEngine
Main execution engine
ExecutionMetadata
Metadata for tracking executions
ExecutionPlan
Plan for executing multiple commands
ExecutionRequest
Single command execution request
ExecutionResult
Result of a single command execution
ExecutionState
Internal state tracking
ExecutionStats
Statistics for plan execution
ExecutionSummary
Summary information for listing executions
HashMap
A hash map implemented with quadratic probing and SIMD lookup.
LoggingEventHandler
Logging event handler (logs to stderr)
MultiEventHandler
Multi-handler that broadcasts to multiple handlers
NoopEventHandler
No-op event handler (does nothing)
PathBuf
An owned, mutable path (akin to String).
PlanExecutionResult
Result of executing a plan
RwLock
An asynchronous reader-writer lock.
Utc
The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
Uuid
A Universally Unique Identifier (UUID).

Enums§

Command
Standardized command types
ExecutionError
Main error type for execution operations
ExecutionEvent
Events emitted during execution
ExecutionStatus
Status enum for executions
ExecutionStrategy
Strategy for executing multiple commands
OversizedOutputStrategy
Strategy for handling output that exceeds max_output_size_bytes
ValidationError
Validation-specific errors

Traits§

EventHandler
Event handler trait

Type Aliases§

ExecutionHandle
Type alias for a single execution handle
ExecutionMap
Type alias for the execution map (shared state across threads)
Result
Result type alias for execution operations
ValidationResult
Result type alias for validation operations