Hardswap Invariants in tests + Quota fixes

This commit is contained in:
Alexey
2026-09-20 00:28:52 +03:00
parent 89dacbd17e
commit d706b3f3ba
66 changed files with 1821 additions and 505 deletions
+21
View File
@@ -122,6 +122,27 @@ impl Stats {
self.quota_store.used(user)
}
/// Returns quota ownership for the exact authenticated user incarnation.
pub(crate) fn quota_handle_for_incarnation(
&self,
user: &str,
incarnation: crate::proxy::user_admission::UserIncarnation,
) -> Option<UserQuotaHandle> {
if let Some(handle) = self.quota_store.handle_exact(user, incarnation) {
return Some(handle);
}
if incarnation != 0 {
return None;
}
let handle = self.quota_store.current_or_legacy_handle(user);
(handle.incarnation() == incarnation).then_some(handle)
}
/// Returns the currently published quota owner for compatibility relay entrypoints.
pub(crate) fn current_user_quota_handle(&self, user: &str) -> UserQuotaHandle {
self.quota_store.current_or_legacy_handle(user)
}
pub fn load_user_quota_state(&self, user: &str, used_bytes: u64, last_reset_epoch_secs: u64) {
self.quota_store
.load(user, used_bytes, last_reset_epoch_secs);