Expand description
Connection-managed wrappers over the backtest WebSocket protocol.
Most callers should use ManagedBacktestSession. It owns the control and
subscription manager tasks, waits for session creation, gates Continue
sends on live connections, and provides one shutdown path.
The control and subscription WebSockets are each owned by a dedicated task that handles its own lifecycle: connect, handshake, keepalive, reconnect. Workload code interacts via channels and a status watcher, never with the WebSocket directly.
Structs§
- Control
Handle - Handle to a running
ControlManagertask. - Managed
Backtest Session - High-level managed backtest session.
- Managed
Parallel Session - High-level managed parallel session: owns the single multiplexed control
connection and hands out one
ParallelSubSessionper server-created sub-session for the driver to run concurrently. - Parallel
SubSession - One sub-session of a parallel run. Mirrors the driver-facing surface of
super::ManagedBacktestSession: control events arrive over a demuxed channel from the shared control connection, while transactions flow over this sub-session’s own data-plane subscription managers. - Reconnect
Coordinator - Coordinates subscription reconnects across a parallel batch sharing one bandwidth-constrained link.
- Session
Info - Identity of a created backtest session.
- Streaming
Guard - Holds a
ReconnectCoordinator’s streaming count for the lifetime of one connection; decrements and wakes parked siblings on drop. - Subscription
Handle - Handle to a running subscription manager task.
Enums§
- Connection
Status - Connection state as observed from outside the manager task.
- Control
Event - Events the driver observes from the control connection.
- Managed
Event - Managed
Session Error - Error returned by the high-level managed session wrapper.
- Subscription
Notification
Constants§
- CONNECT_
TIMEOUT - Timeout for the initial WebSocket connect (TCP + TLS + HTTP upgrade).
- GRACEFUL_
CLOSE_ TIMEOUT - Total budget for the graceful close handshake (close request + close frame). A supervisor’s SIGTERM→SIGKILL grace must exceed this or the close is cut short.
- HANDSHAKE_
RESPONSE_ TIMEOUT - Timeout for any single response during a handshake (Create, Attach, Resume, subscribe ack). Does not apply to per-message reads during an established session — those are bounded by ping/pong liveness instead.
- KEEPALIVE_
INTERVAL - How often to send a WebSocket ping during an established connection.
- KEEPALIVE_
MISS_ DEADLINE - How long without inbound traffic before declaring the connection dead. Roughly three missed pings.
- RECONNECT_
BACKOFF_ MULTIPLIER - RECONNECT_
INITIAL_ BACKOFF - RECONNECT_
JITTER - RECONNECT_
MAX_ ATTEMPTS - RECONNECT_
MAX_ BACKOFF - RECONNECT_
MAX_ TOTAL - RECONNECT_
UNGATED_ ATTEMPTS - Reconnect attempts that fire immediately, before the cross-session reconnect gate engages. A transient drop recovers fast; only once these rapid retries are exhausted does a session fall back to waiting for siblings to drain.
- RECONNECT_
UPTIME_ RESET - A connection that stays
Upfor this long resets the reconnect counter.
Functions§
- spawn_
account_ diff_ subscription_ manager - spawn_
control_ manager - Spawn a
ControlManagertask and return a handle. - spawn_
transaction_ subscription_ manager