MCPcopy Create free account
hub / github.com/cosdata/cosdata / update_collection_usage

Method update_collection_usage

src/models/collection_cache.rs:157–175  ·  view source on GitHub ↗
(&self, name: &str)

Source from the content-addressed store, hash-verified

155 }
156
157 pub fn update_collection_usage(&self, name: &str) -> Result<(), WaCustomError> {
158 let key = match self.name_to_key.get(name) {
159 Some(key) => key.clone(),
160 None => {
161 // If collection is not loaded, load it
162 self.load_collection(name)?;
163 return Ok(());
164 }
165 };
166
167 // Get from cache - this updates its recency
168 if self.cache.get(&key).is_none() {
169 // Collection was evicted but mapping remains - clean up and load
170 self.name_to_key.remove(name);
171 self.load_collection(name)?;
172 }
173
174 Ok(())
175 }
176
177 pub fn probabilistic_update(
178 &self,

Callers 2

probabilistic_updateMethod · 0.80

Calls 4

cloneMethod · 0.80
load_collectionMethod · 0.80
removeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected