Validate that the sum of engine limits does not exceed the global ceiling.
(&self)
| 107 | impl GovernorConfig { |
| 108 | /// Validate that the sum of engine limits does not exceed the global ceiling. |
| 109 | pub fn validate(&self) -> Result<()> { |
| 110 | let total: usize = self.engine_limits.values().sum(); |
| 111 | if total > self.global_ceiling { |
| 112 | return Err(MemError::GlobalCeilingExceeded { |
| 113 | allocated: total, |
| 114 | ceiling: self.global_ceiling, |
| 115 | requested: 0, |
| 116 | }); |
| 117 | } |
| 118 | Ok(()) |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | /// The central memory governor. |