Define or update a ceiling for a tenant. In production, this should only be callable with a break-glass key.
(&self, ceiling: TenantCeiling)
| 42 | /// |
| 43 | /// In production, this should only be callable with a break-glass key. |
| 44 | pub fn define(&self, ceiling: TenantCeiling) { |
| 45 | let tid = ceiling.tenant_id; |
| 46 | let mut ceilings = self.ceilings.write().unwrap_or_else(|p| p.into_inner()); |
| 47 | info!( |
| 48 | tenant_id = tid, |
| 49 | max_collections = ceiling.max_collections, |
| 50 | max_storage_bytes = ceiling.max_storage_bytes, |
| 51 | audit_min_retention_days = ceiling.audit_min_retention_days, |
| 52 | "ceiling defined" |
| 53 | ); |
| 54 | ceilings.insert(tid, ceiling); |
| 55 | } |
| 56 | |
| 57 | /// Get the ceiling for a tenant (if defined). |
| 58 | pub fn get(&self, tenant_id: u64) -> Option<TenantCeiling> { |