Classes
Phase
0
▼
Server lifecycle phases.
Phase
0
▼
Server lifecycle phases.
ServerModel
7
▼
Immutable server lifecycle state.
ServerModel
7
▼
Immutable server lifecycle state.
Attributes
| Name | Type | Description |
|---|---|---|
phase |
Phase
|
— |
effective_workers |
int
|
— |
mode_label |
str
|
— |
gil_status |
str
|
— |
supervisor_mode |
str
|
— |
generation |
int
|
— |
connections |
int
|
— |
Functions
server_reducer
2
ServerModel
▼
Pure reducer — advances lifecycle state in response to actions.
server_reducer
2
ServerModel
▼
def server_reducer(state: ServerModel | None, action: Action) -> ServerModel
Parameters
| Name | Type | Description |
|---|---|---|
state |
ServerModel | None |
|
action |
Action |
Returns
ServerModel
_render_middleware
2
▼
Middleware that renders branded lifecycle output on each action.
_render_middleware
2
▼
def _render_middleware(dispatch_fn, get_state)
Parameters
| Name | Type | Description |
|---|---|---|
dispatch_fn |
— |
|
get_state |
— |
_startup_hints
2
list[str]
▼
Generate smart startup hints based on config vs environment.
_startup_hints
2
list[str]
▼
def _startup_hints(config, effective_workers: int) -> list[str]
Parameters
| Name | Type | Description |
|---|---|---|
config |
— |
|
effective_workers |
int |
Returns
list[str]
_render_action
1
None
▼
Route an action to its branded template or logger fallback.
_render_action
1
None
▼
def _render_action(action: Action) -> None
Parameters
| Name | Type | Description |
|---|---|---|
action |
Action |
_get_store
0
Store
▼
Get or create the lifecycle store (thread-safe, lazy).
_get_store
0
Store
▼
def _get_store() -> Store
Returns
Store
dispatch
2
None
▼
Dispatch a lifecycle action to the server store.
Example::
dispatch("READ…
dispatch
2
None
▼
def dispatch(action_type: str, **payload: Any) -> None
Dispatch a lifecycle action to the server store.
Example::
dispatch("READY", host="127.0.0.1", port=8000)
dispatch("SHUTDOWN_COMPLETE")
Parameters
| Name | Type | Description |
|---|---|---|
action_type |
str |
|
**payload |
Any |
get_state
0
ServerModel
▼
Return the current server lifecycle state.
get_state
0
ServerModel
▼
def get_state() -> ServerModel
Returns
ServerModel
_reset_store
0
None
▼
Reset the store to initial state (testing only).
_reset_store
0
None
▼
def _reset_store() -> None