escher-execution-engine 0.1.2

Production-ready async execution engine for system commands
Documentation
//! 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
//!
//! ```rust,no_run
//! 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,
//!         output_log_path: 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);
//! }
//! ```

// Module declarations
mod cleanup;
mod commands;
mod config;
mod engine;
mod errors;
mod events;
mod executor;
mod types;

// Public exports
pub use config::*;
pub use engine::ExecutionEngine;
pub use errors::*;
pub use events::*;
pub use types::*;

// Re-exports for convenience
pub use chrono::{DateTime, Utc};
pub use std::collections::HashMap;
pub use std::path::PathBuf;
pub use std::sync::Arc;
pub use std::time::Duration;
pub use tokio::sync::RwLock;
pub use uuid::Uuid;

// Type aliases for complex types
/// Type alias for the execution map (shared state across threads)
pub type ExecutionMap = Arc<RwLock<HashMap<Uuid, Arc<RwLock<types::ExecutionState>>>>>;

/// Type alias for a single execution handle
pub type ExecutionHandle = Arc<RwLock<types::ExecutionState>>;

/// Type alias for the cancellation token map
pub type CancellationTokenMap = Arc<RwLock<HashMap<Uuid, tokio_util::sync::CancellationToken>>>;