1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! Aegis Resource Management
//!
//! This crate provides resource management functionality for the Aegis
//! WebAssembly sandbox runtime, including:
//!
//! - Memory limiting via [`AegisResourceLimiter`]
//! - CPU limiting via fuel management in [`FuelManager`]
//! - Timeout management via epochs in [`EpochManager`]
//!
//! # Resource Management Strategy
//!
//! Aegis uses a multi-layered approach to resource management:
//!
//! 1. **Memory Limits**: Hard limits on linear memory growth
//! 2. **Fuel Limits**: Deterministic CPU limiting via fuel consumption
//! 3. **Epoch Timeouts**: Wall-clock timeout via epoch-based interruption
//!
//! ## Memory Limiting
//!
//! Memory limits are enforced via [`AegisResourceLimiter`], which implements
//! Wasmtime's `ResourceLimiter` trait. This prevents guests from allocating
//! unbounded memory.
//!
//! ```ignore
//! use aegis_resource::limiter::{AegisResourceLimiter, LimiterConfig};
//!
//! let limiter = AegisResourceLimiter::new(
//! LimiterConfig::default().with_max_memory(64 * 1024 * 1024)
//! );
//! ```
//!
//! ## Fuel Limiting
//!
//! Fuel provides deterministic CPU limiting. Each WASM instruction consumes
//! fuel, and execution traps when fuel is exhausted.
//!
//! ```ignore
//! use aegis_resource::fuel::{FuelManager, FuelConfig};
//!
//! let manager = FuelManager::new(FuelConfig::new(1_000_000_000));
//! ```
//!
//! ## Epoch Timeouts
//!
//! Epochs provide wall-clock timeout support. A background thread increments
//! the epoch counter, and stores configured with deadlines will trap when
//! the deadline is exceeded.
//!
//! ```ignore
//! use aegis_resource::epoch::{EpochManager, EpochConfig};
//!
//! let manager = EpochManager::new(engine, EpochConfig::default())?;
//! ```
// Re-export main types
pub use ;
pub use ;
pub use ;
pub use ;
/// Prelude module for convenient imports.