Expand description
DICT (RFC 2229) server — the model is the dictionary.
The server greets with 220, then reads one command per line. The commands whose answer is
content — DEFINE, MATCH, SHOW DB/STRAT/INFO/SERVER — raise an event and the model answers
with a structured action. Everything whose answer is fixed by the protocol — CLIENT, STATUS,
HELP, OPTION, QUIT, AUTH, and any command this server does not know — is answered here
without consulting anyone, so a stranger typing garbage costs no model call.
Four properties worth knowing before changing the loop:
- A command is a line, and a line is bounded. RFC 2229 caps a command line at 1024
bytes including CRLF (
wire::MAX_LINE_BYTES). A longer one is refused with500and the connection closes — there is no way to resynchronise with a peer that ignored a MUST, and buffering toward its newline is a memory hole. - The model cannot write framing. Its actions are rendered by
wire, and the loop then checks that the reply’s status code fits the command it answers (a152to a DEFINE is refused, not sent). A reply that does not fit, no reply, and a backend failure all end the same way:420 Server temporarily unavailable, then close. - OPTION MIME is connection state the executor cannot see. The action executor is
stateless, so the loop applies
wire::apply_mimeto what the executor rendered. Replies injected from the dashboard ([ message ]) do not pass through the loop and are written without the MIME preface. - The deadlines wrap the read, not the answer. A command parked for a human under a
manualrule is never closed byfirst_byte_timeout_secsoridle_timeout_secs.
Re-exports§
pub use wire::MAX_LINE_BYTES;
Modules§
- actions
- DICT protocol actions: what the model is told, and how its answers become wire bytes.
- wire
- DICT (RFC 2229) wire format: command parsing and response rendering.
Structs§
Enums§
- Command
- One parsed command line.
Functions§
- parse_
command - Parse one command line (without its line terminator). Commands are case-insensitive.