Skip to main content

require_account_capacity

Function require_account_capacity 

Source
pub(crate) fn require_account_capacity(state: &AppState) -> Result<(), ApiError>
Expand description

Refuses a new account once this deployment already holds AppState::max_accounts of them; see crate::tree::create_account.

Counted from Registry::account_count rather than a purpose-built counter, so this and crate::health’s periodic line — which reads Registry::stats, the pricier sibling this call deliberately avoids — can never disagree about what “how many accounts” means. This route runs on every provisioning request on a two-worker runtime, so unlike the health tick it cannot afford stats’s per-account clone just to read one field off it; bounded regardless by AppState::max_accounts itself, since nothing can be counted here that was not admitted past this same check.