Skip to content

Commit 64a7b1c

Browse files
committed
feat(registry): add remove_by_prefix for bulk eviction
1 parent 50d9ed8 commit 64a7b1c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/registry.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,17 @@ impl USearchRegistry {
312312
.cloned()
313313
}
314314

315+
/// Remove all registry entries whose name starts with `prefix`.
316+
///
317+
/// Use `"conn::schema::table::"` to evict all columns for one table,
318+
/// or `"conn::"` to evict all tables for a connection.
319+
pub fn remove_by_prefix(&self, prefix: &str) {
320+
self.tables
321+
.write()
322+
.expect("USearchRegistry lock poisoned")
323+
.retain(|k, _| !k.starts_with(prefix));
324+
}
325+
315326
pub fn into_arc(self) -> Arc<Self> {
316327
Arc::new(self)
317328
}

0 commit comments

Comments
 (0)