MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / validate

Method validate

graphlite/src/cache/cache_config.rs:183–207  ·  view source on GitHub ↗

Validate the configuration

(&self)

Source from the content-addressed store, hash-verified

181
182 /// Validate the configuration
183 pub fn validate(&self) -> Result<(), String> {
184 if !self.enabled {
185 return Ok(());
186 }
187
188 let total_memory = self.l1_config.max_memory_bytes
189 + self.l2_config.max_memory_bytes
190 + self.l3_config.max_memory_bytes;
191
192 if total_memory > self.max_memory_bytes {
193 return Err(format!(
194 "Sum of level memory limits ({} bytes) exceeds max memory ({} bytes)",
195 total_memory, self.max_memory_bytes
196 ));
197 }
198
199 if self.l1_config.max_entries == 0
200 || self.l2_config.max_entries == 0
201 || self.l3_config.max_entries == 0
202 {
203 return Err("Cache levels must have max_entries > 0".to_string());
204 }
205
206 Ok(())
207 }
208}

Callers 2

newMethod · 0.80
update_configMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected