MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / invalidate_partition

Method invalidate_partition

nodedb/src/engine/timeseries/query_cache.rs:84–99  ·  view source on GitHub ↗

Invalidate all cached entries for a partition (e.g., if it's modified). Sealed partitions are immutable, so this should only be called for active partitions that are still receiving writes.

(&mut self, tenant_id: u64, partition_id: i64)

Source from the content-addressed store, hash-verified

82 /// Sealed partitions are immutable, so this should only be called for
83 /// active partitions that are still receiving writes.
84 pub fn invalidate_partition(&mut self, tenant_id: u64, partition_id: i64) {
85 let keys: Vec<CacheKey> = self
86 .entries
87 .keys()
88 .filter(|&&(tid, pid, _)| tid == tenant_id && pid == partition_id)
89 .copied()
90 .collect();
91
92 for key in keys {
93 if let Some(removed) = self.entries.remove(&key) {
94 self.current_bytes -= removed.len();
95 }
96 }
97 self.order
98 .retain(|&(tid, pid, _)| !(tid == tenant_id && pid == partition_id));
99 }
100
101 /// Evict all cached entries belonging to a specific tenant.
102 ///

Callers 2

invalidate_partitionFunction · 0.80

Calls 3

collectMethod · 0.80
removeMethod · 0.45
lenMethod · 0.45

Tested by 2

invalidate_partitionFunction · 0.64