MCPcopy Create free account
hub / github.com/AI45Lab/Code / enforce_limits

Method enforce_limits

core/src/tools/artifacts.rs:150–161  ·  view source on GitHub ↗
(&self, state: &mut ArtifactStoreState)

Source from the content-addressed store, hash-verified

148 }
149
150 fn enforce_limits(&self, state: &mut ArtifactStoreState) {
151 while state.artifacts.len() > self.limits.max_artifacts
152 || state.total_bytes > self.limits.max_bytes
153 {
154 let Some(uri) = state.insertion_order.pop_front() else {
155 break;
156 };
157 if let Some(removed) = state.artifacts.remove(&uri) {
158 state.total_bytes = state.total_bytes.saturating_sub(removed.content.len());
159 }
160 }
161 }
162
163 fn ordered_artifacts(&self) -> Vec<ToolArtifact> {
164 let state = self.inner.read().unwrap();

Callers 1

putMethod · 0.80

Calls 2

removeMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected