BitzOrcas implements quota management through the PlatformBilling module. It provides subscription-based entitlement tracking, usage recording, and configurable over-quota enforcement.
Architecture
┌─────────────────────────────────────────────┐│ PlatformBilling ││ ││ Plan → Subscription → Entitlements ││ │ ││ ▼ ││ Usage Records ││ │ ││ ▼ ││ Quota Check ││ (allow / deny / warn) │└─────────────────────────────────────────────┘Core abstractions
QuotaService
public class QuotaService{ public QuotaCheckResult CheckQuota( TenantId tenantId, string entitlementKey, long requestedDelta);}EntitlementResolver
Resolves a tenant’s effective entitlements from their active subscription + catalog:
Tenant → Active Subscription → Plan → Catalog Offerings → EntitlementsOverQuotaBehavior
Configurable behavior when a tenant exceeds their quota:
| Policy | Description |
|---|---|
Deny | Block the operation (HTTP 429 or 403) |
Warn | Allow with a warning header/notification |
Allow | No enforcement (for internal/privileged tenants) |
Key entities
| Entity | Purpose |
|---|---|
PlatformBillingPlanEntity | Billing plan definition (free, pro, enterprise) |
PlatformBillingSubscriptionEntity | Tenant’s active subscription |
PlatformBillingInvoiceEntity | Billing invoices |
PlatformBillingUsageRecordEntity | Usage tracking records |
Quota check flow
- Entitlement lookup: Resolve tenant’s subscription → plan → catalog offerings
- Usage aggregation: Sum recorded usage for the current billing period
- Quota comparison: Compare used vs. allowed
- Enforcement: Apply over-quota policy (deny/warn/allow)
Usage recording
Modules record usage through PlatformBillingService.RecordUsageAsync():
await billingService.RecordUsageAsync( tenantId, entitlementKey: "storage.files", delta: 1);Configuration
{ "PlatformBilling": { "DefaultOverQuotaBehavior": "Deny", "BillingCycleDays": 30 }}See also
- PlatformBilling module — Full billing and subscription management
- Catalog module — Plan definitions and offerings