File size: 1,352 Bytes
ddebc3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""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
    GROK_4_3 = 4
    CONSOLE = 5  # console.x.ai 独立配额


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),
}

POOL_ID_TO_STR: dict[int, str] = {v: k for k, v in POOL_STR_TO_ID.items()}

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),
    int(ModeId.GROK_4_3),
    int(ModeId.CONSOLE),
)

__all__ = [
    "ModeId",
    "PoolId",
    "StatusId",
    "POOL_STR_TO_ID",
    "POOL_ID_TO_STR",
    "STATUS_STR_TO_ID",
    "ALL_MODE_IDS",
]