scnmnt-quota-service v0.1.0
subsystem
capsule://quake0day/[email protected]
Manages user credit quotas for image generation. It provides functionalities for checking current balance, daily check-ins to grant credits, and spending credits, using a local bbolt database for persistence.
Owns
- Credit balance management for users identified by fingerprints
- Daily credit grant mechanism with a balance cap
- Persistence layer using bbolt database
- Error handling specific to quota operations
Does not own
- Generation of user fingerprints
- Integration with external payment systems
- API route registration (delegated to scnmnt-api-router)
AI orientation
An agent working on this capsule would focus on database interactions (bbolt), credit logic (granting, spending, capping), and ensuring data integrity. They should understand transactional operations and error handling for data storage.
Avoid
- Implementing image generation logic
- Handling HTTP security concerns like CSRF
Provides
library:quota.Store— Go client for managing user quotas.http_api:/api/quota/status— Endpoint to retrieve a user's current quota status.http_api:/api/quota/check-in— Endpoint to allow users to perform a daily check-in for credits.
Invariants (must always hold)
- User balances must not exceed `BalanceCap`.
- Daily grants must only apply once per day per user.
- Credits must be accurately deducted upon successful 'Spend' operations.
Source files (4)
Click any file to view its content; the path on the right shows where the file lands when this capsule is installed.
src/internal/quota/errors.go→internal/quota/errors.gosrc/internal/quota/handler.go→internal/quota/handler.gosrc/internal/quota/store.go→internal/quota/store.gosrc/internal/quota/store_test.go→internal/quota/store_test.go
Plus capsule.yaml and
install.json.