This commit is contained in:
Mateusz Gruszczyński committed 2026-10-10 00:18:06 +02:00
1 parent ad95bfb050
commit 1431dd47f0
62 files changed
+1360 -198

No files matched your search

+6
View File
@@ -60,6 +60,7 @@ mod cache_revision_tests {
wire_only.cache.expose_hits = !wire_only.cache.expose_hits;
wire_only.cache.expose_cache_status = !wire_only.cache.expose_cache_status;
wire_only.cache.expose_resident_age = !wire_only.cache.expose_resident_age;
wire_only.cache.expose_only_hits = !wire_only.cache.expose_only_hits;
wire_only.cache.via_header = Some("RustProxy edge".into());
assert_eq!(cache_revision(&wire_only), identity);
assert!(matches!(
@@ -67,6 +68,11 @@ mod cache_revision_tests {
CacheInvalidation::None
));
let mut vhost_diagnostics = base.clone();
vhost_diagnostics.vhosts[0].cache.expose_only_hits = Some(true);
assert_eq!(cache_revision(&vhost_diagnostics), identity);
assert!(matches!(cache_invalidation(&base, &vhost_diagnostics), CacheInvalidation::None));
let mut cache = base.clone();
cache.cache.max_entries += 1;
let cache_identity = cache_revision(&cache);
+8 -1
View File
@@ -99,6 +99,7 @@ fn cache_revision(config: &config::Config) -> u64 {
cache.expose_hits = false;
cache.expose_cache_status = false;
cache.expose_resident_age = false;
cache.expose_only_hits = false;
cache.via_header = None;
// Resource-only transform controls decide how much optimization work may
// happen concurrently, but do not change the transformed representation.
@@ -108,12 +109,18 @@ fn cache_revision(config: &config::Config) -> u64 {
transform.preset = None;
transform.memory_budget_bytes = 0;
transform.max_inflight = 0;
// A per-vhost diagnostics override is also presentation-only and must not
// invalidate cached objects when switched from inherited to HIT-only.
let mut vhosts = config.vhosts.clone();
for vhost in &mut vhosts {
vhost.cache.expose_only_hits = None;
}
let encoded = serde_json::to_vec(&(
&cache,
&transform,
&config.headers,
&config.forwarding,
&config.vhosts,
&vhosts,
))
.expect("serializable cache compatibility view");
let digest = Sha256::digest(encoded);