v0.34.0_1
This commit is contained in:
1 parent
9cfc4588cc
commit
f20c8da718
25 files changed
+694
-117
No files matched your search
Vendored
-22
@@ -336,8 +336,6 @@ struct Store {
|
||||
control_revision: u64,
|
||||
scope_generations: HashMap<String, u64>,
|
||||
key_generations: HashMap<Key, u64>,
|
||||
domains: BTreeMap<String, BTreeMap<String, DomainCounters>>,
|
||||
domain_count: usize,
|
||||
}
|
||||
impl Store {
|
||||
fn index_variant(&mut self, base_key: Key, key: Key) {
|
||||
@@ -362,26 +360,6 @@ impl Store {
|
||||
}
|
||||
Some(entry)
|
||||
}
|
||||
fn domain(&mut self, scope: &str, domain: &str) -> Option<&mut DomainCounters> {
|
||||
// The common path is a borrowed lookup: no allocation of scope/domain
|
||||
// strings for every cache hit or log-reason counter update.
|
||||
if self.domains.get(scope).is_some_and(|d| d.contains_key(domain)) {
|
||||
return self.domains.get_mut(scope)?.get_mut(domain);
|
||||
}
|
||||
if self.domain_count >= 4096 {
|
||||
return None;
|
||||
}
|
||||
self.domain_count += 1;
|
||||
Some(self.domains.entry(scope.to_owned()).or_default()
|
||||
.entry(domain.to_owned()).or_default())
|
||||
}
|
||||
fn saved_body_hit(&mut self, scope: &str, domain: &str, bytes: usize) {
|
||||
// Every admitted HOT insertion registered its domain. If the bounded
|
||||
// stats table is full, skip accounting for an unregistered domain.
|
||||
if let Some(c) = self.domains.get_mut(scope).and_then(|d| d.get_mut(domain)) {
|
||||
c.saved_body_bytes = c.saved_body_bytes.saturating_add(bytes as u64);
|
||||
}
|
||||
}
|
||||
fn next_sequence(&mut self) -> u64 {
|
||||
// No practical wrapping, but a wrap must not corrupt LRU bookkeeping.
|
||||
if self.sequence == u64::MAX {
|
||||
|
||||
Vendored
+1
@@ -52,6 +52,7 @@ impl Drop for TransientLeaseInner {
|
||||
|
||||
pub struct Cache {
|
||||
store: Arc<Mutex<Store>>,
|
||||
domain_stats: DomainStatsStore,
|
||||
revision: AtomicU64,
|
||||
cold: Arc<Mutex<ColdStore>>,
|
||||
tier_settings: Mutex<Settings>,
|
||||
|
||||
Reference in new issue
Block a user