Expand description
The Session port: submit a request against a running game and get a response, whether the authoritative state lives in this process or (later) a remote one.
A Session is a client-side handle, not the host itself. Only some
implementations actually hold the authoritative state:
LocalSessionowns theturnbase::Gameand its state directly and mutates it in process. This process is the host for as long as the value lives. Zero I/O; this is what tests, a long-lived server, and self-play hold onto.FileSessionis not itself aSession: it is a stateless adapter around a per-callLocalSession. Each call loads aLocalSessionfrom a JSON save file, submits one request, and saves it back. This is what a headless CLI drives, one process invocation per request.
A future RemoteSession would hold no authority at all, only a connection
to a host reached over some transport. That, and any pluggable Store
backend beyond the single JSON file FileSession ships, are deliberately
deferred until a concrete consumer exists (see the workspace design notes).
Redaction is automatic: a Request::Query runs turnbase::Game::view
for the requesting seat first, so only that seat’s view is ever produced,
never the raw state with every seat’s hidden information.
Structs§
- File
Session - A stateless, file-backed adapter over
LocalSession: create a save, then query or drive it across separate process invocations. - Local
Session - An in-memory game: owns a
Gameand its state, and applies requests to them directly. No file, socket, or other I/O, and no serialization: the typedRequest/Responsepass straight through.
Enums§
- Error
- Errors from the file adapter itself.
Traits§
- Session
- A running game, reachable in-process or (later) over a transport.