maybenot/constants.rs
1//! Global constants for the framework.
2
3/// The highest possible version of a [`Machine`](crate::Machine) supported by
4/// this framework.
5pub const VERSION: u8 = 2;
6
7/// The maximum size of a decompressed encoded [`Machine`](crate::Machine) in
8/// bytes. Set to 1MB. This is a soft limit and can be increased if necessary.
9pub const MAX_DECOMPRESSED_SIZE: usize = 1 << 20;
10
11/// The number of [`Event`](crate::event)s in the framework.
12pub const EVENT_NUM: usize = 13;
13
14/// The maximum sampled timeout in a [`State`](crate::state), set to a day in
15/// microseconds.
16pub const MAX_SAMPLED_TIMEOUT: f64 = 24.0 * 60.0 * 60.0 * 1000.0 * 1000.0;
17
18/// The maximum sampled timer duration in a [`State`](crate::state), set to a
19/// day in microseconds.
20pub const MAX_SAMPLED_TIMER_DURATION: f64 = 24.0 * 60.0 * 60.0 * 1000.0 * 1000.0;
21
22/// The maximum sampled blocking duration in a [`State`](crate::state), set to a
23/// day in microseconds.
24pub const MAX_SAMPLED_BLOCK_DURATION: f64 = 24.0 * 60.0 * 60.0 * 1000.0 * 1000.0;
25
26/// The maximum possible sampled limit of a [`State`](crate::state). This is the
27/// default if no limit dist is specified (in practice, the same as no limit).
28pub(crate) const STATE_LIMIT_MAX: u64 = u64::MAX;
29
30/// A pseudo-state that means the [`Machine`](crate::Machine) should completely
31/// stop.
32pub const STATE_END: usize = u32::MAX as usize;
33/// A pseudo-state that triggers a Signal [`Event`](crate::event) in all other
34/// running machines.
35pub const STATE_SIGNAL: usize = STATE_END - 1;
36/// The maximum number of [`State`](crate::state)s a [`Machine`](crate::Machine)
37/// can have. Set to 100,000 as a safety measure to prevent resource exhaustion.
38/// Likely much higher than `MAX_DECOMPRESSED_SIZE` allows for as-is.
39pub const STATE_MAX: usize = 100_000;