oxfuse_core/limits.rs
1//! Resource limits applied to untrusted input.
2
3#[derive(Debug, Clone)]
4pub struct Limits {
5 pub max_file_bytes: usize,
6 /// Cap on graph values: inputs, constants and nodes together.
7 pub max_values: usize,
8 pub max_tensor_elements: usize,
9 /// Cap on the elements of all values together, so many legal tensors
10 /// cannot add up to an allocation the per-tensor cap would have refused.
11 pub max_total_elements: usize,
12 pub max_rank: usize,
13}
14
15impl Default for Limits {
16 fn default() -> Self {
17 Self {
18 max_file_bytes: 64 * 1024 * 1024,
19 max_values: 100_000,
20 max_tensor_elements: 1 << 28,
21 max_total_elements: 1 << 29,
22 max_rank: 8,
23 }
24 }
25}