Skip to main content

Module hub

Module hub 

Source
Expand description

Live combats on this instance: command execution and fan-out of events to connected clients.

Nothing here is the source of truth; the database is. Several instances can serve the same combat at once:

  • Commands are serialised by locking the combat’s row, and each instance catches its cached state up from the log under that lock before deciding anything.
  • Every append is announced with a Postgres notification. Each instance listens, reads the new events from the log and pushes them to its own clients, so a command executed anywhere reaches everyone.

A combat nobody is watching is dropped from memory after a while and rebuilt from its log when next used, so combats can sit paused for days.

Structs§

Hub
Every combat this instance has in memory, and what they need: the store, the other services and the limits.
LiveCombat
A combat in memory: its state, and the feed its watchers get.

Enums§

Outcome
What running a command did.