Files
grok2api/app/dataplane/shared/enums.py
T
Chenyme b407443820 refactor: update configuration and improve account management features
- Removed unnecessary environment variable patterns from .gitignore.
- Renamed configuration keys in config.defaults.toml for clarity (function_enabled to webui_enabled, function_key to webui_key).
- Increased usage concurrency limit from 10 to 50 in AccountRefreshService.
- Updated docker-compose.yml to remove default Redis URL.
- Enhanced Dockerfile for better build efficiency and added health check.
- Removed deprecated aiofiles dependency and updated other dependencies in pyproject.toml.
- Deleted outdated readme.md file.
- Improved account management logic in various modules, including state machine and refresh service.
- Added support for new quota management features and improved logging for account refresh operations.
2026-04-10 00:19:25 +08:00

56 lines
1.1 KiB
Python

"""Dataplane-local integer enumerations for hot-path array indexing.
These mirror the control-plane enums but use IntEnum exclusively so they
can be used directly as array indices with zero overhead.
"""
from enum import IntEnum
class ModeId(IntEnum):
AUTO = 0
FAST = 1
EXPERT = 2
HEAVY = 3
class PoolId(IntEnum):
BASIC = 0
SUPER = 1
HEAVY = 2
class StatusId(IntEnum):
ACTIVE = 0
COOLING = 1
EXPIRED = 2
DISABLED = 3
DELETED = 4
# Map pool string → PoolId integer (used during sync from control plane).
POOL_STR_TO_ID: dict[str, int] = {
"basic": int(PoolId.BASIC),
"super": int(PoolId.SUPER),
"heavy": int(PoolId.HEAVY),
}
STATUS_STR_TO_ID: dict[str, int] = {
"active": int(StatusId.ACTIVE),
"cooling": int(StatusId.COOLING),
"expired": int(StatusId.EXPIRED),
"disabled": int(StatusId.DISABLED),
}
ALL_MODE_IDS: tuple[int, ...] = (
int(ModeId.AUTO),
int(ModeId.FAST),
int(ModeId.EXPERT),
int(ModeId.HEAVY),
)
__all__ = [
"ModeId", "PoolId", "StatusId",
"POOL_STR_TO_ID", "STATUS_STR_TO_ID", "ALL_MODE_IDS",
]