Skip to main content

wasm_capability_contract/component/vo/
resource_limits.rs

1//! [`ResourceLimits`] — bounds the engine must enforce for one loaded component.
2
3use serde::{Deserialize, Serialize};
4
5/// Resource bounds a component's host must enforce on every invocation.
6///
7/// Every field is a hard cap, not a hint — a real `ComponentValidator`/
8/// engine implementation is expected to reject or trap on any invocation
9/// that would exceed one of these, per ADR-001.
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
11pub struct ResourceLimits {
12    /// Maximum linear memory the component's instance may grow to, in bytes.
13    pub max_memory_bytes: u64,
14    /// Maximum wall-clock time one invocation may run before being aborted.
15    pub invoke_timeout_ms: u64,
16    /// Maximum number of concurrent invocations against one loaded instance.
17    pub max_concurrency: u32,
18    /// Maximum size of a single request or response payload, in bytes.
19    pub max_payload_bytes: u64,
20}