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

Method probabilistic_update

src/models/collection_cache.rs:177–189  ·  view source on GitHub ↗
(
        &self,
        name: &str,
        probability: f32,
    )

Source from the content-addressed store, hash-verified

175 }
176
177 pub fn probabilistic_update(
178 &self,
179 name: &str,
180 probability: f32,
181 ) -> Result<bool, WaCustomError> {
182 let mut rng = rand::thread_rng();
183 if rng.gen::<f32>() < probability {
184 self.update_collection_usage(name)?;
185 Ok(true)
186 } else {
187 Ok(false)
188 }
189 }
190
191 // Loads the dense vector index for a collection
192 fn load_dense_index(&self, name: &str) -> Result<Option<Arc<HNSWIndex>>, WaCustomError> {

Callers 1

Calls 1

Tested by

no test coverage detected