Expand description
Sans-io BitTorrent session engine — the download state machine.
The engine is transport-free (sans-io): it consumes typed
Events (a peer connected, a peer message arrived, a block was
written to disk, a timer ticked) and emits typed Actions (send
this message, write this block, this piece verified). The daemon
(enxamed) provides the actual sockets and disk; tests drive the
same on_event with synthetic events. This is the pleme-io
interpreter idiom — a pure (state, event) -> (state, actions) core,
the same shape as mado’s overlay FSM and the sui-spec interpreters.
Scope (M3): the leech path — connect, exchange bitfields, become
interested, pipeline block requests rarest-first, assemble + SHA-1
verify pieces, announce completion. Seeding/choke-algorithm and the
endgame refinement layer onto this core (theory/ENXAME.md M4).
Structs§
- Session
- The download session for one torrent.
Enums§
- Action
- Something the daemon must do on the engine’s behalf.
- Event
- Something happened that the engine must react to.
Constants§
- BLOCK_
LEN - 16 KiB — the canonical block size BitTorrent peers request in.
- PIPELINE_
DEPTH - How many block requests to keep in flight per peer (the pipeline).
Type Aliases§
- PeerKey
- A peer handle the engine assigns; the daemon maps it to a socket.