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

Method get_or_create_key

src/models/collection_cache.rs:94–103  ·  view source on GitHub ↗

Gets or creates a key for a collection name

(&self, name: &str)

Source from the content-addressed store, hash-verified

92
93 // Gets or creates a key for a collection name
94 fn get_or_create_key(&self, name: &str) -> CollectionNameKey {
95 match self.name_to_key.get(name) {
96 Some(key) => key.clone(),
97 None => {
98 let new_key = CollectionNameKey::new(name);
99 self.name_to_key.insert(name.to_string(), new_key.clone());
100 new_key
101 }
102 }
103 }
104
105 pub fn load_collection(&self, name: &str) -> Result<Arc<CollectionCacheEntry>, WaCustomError> {
106 // Get or create key for this collection name

Callers 1

load_collectionMethod · 0.80

Calls 3

cloneMethod · 0.80
getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected