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

Method check_collection_limit

nodedb/src/control/security/ceiling.rs:64–76  ·  view source on GitHub ↗

Check if creating a new collection would exceed the ceiling.

(&self, tenant_id: u64, current_count: u64)

Source from the content-addressed store, hash-verified

62
63 /// Check if creating a new collection would exceed the ceiling.
64 pub fn check_collection_limit(&self, tenant_id: u64, current_count: u64) -> crate::Result<()> {
65 let ceilings = self.ceilings.read().unwrap_or_else(|p| p.into_inner());
66 if let Some(c) = ceilings.get(&tenant_id)
67 && c.max_collections > 0
68 && current_count >= c.max_collections
69 {
70 return Err(crate::Error::RejectedAuthz {
71 tenant_id: crate::types::TenantId::new(tenant_id),
72 resource: format!("ceiling exceeded: max_collections = {}", c.max_collections),
73 });
74 }
75 Ok(())
76 }
77
78 /// Check if adding storage would exceed the ceiling.
79 pub fn check_storage_limit(

Callers

nothing calls this directly

Calls 2

readMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected