app/broadcast.h

choosing what to mirror (broadcast-docs/PLAN.md §4, B3).

Two selection steps sit in front of BroadcastSession, and both are pure:

  1. WHICH TOURNAMENT. /api/broadcast/top lists what is live now, each entry carrying a tournament and its most relevant round. The round’s 8-character id is what the stream endpoint takes.

  2. WHICH BOARD. A round’s PGN carries every game in the tournament — often a hundred boards. The stream re-sends a whole game whenever that game changes, so a round is not a list you fetch once; it is a set of boards accumulated and upserted as snapshots arrive. BroadcastRound is that state.

The upsert must key on game identity, never on arrival order or position in the file: the API explicitly adds games to a round mid-stream, so an index would silently re-point a running mirror at a different board.

Real rounds contain boards that cannot be mirrored — ones with no moves yet (normal: a round is published before play starts), ones with no pairing set, and non-standard variants. playable() is the picker’s filter; nothing here treats any of them as an error.

namespace kirin
struct BroadcastGame
#include <broadcast.h>

Public Functions

inline bool paired() const
inline bool standard() const
inline bool finished() const
inline bool playable() const

Public Members

std::string key
std::string white
std::string black
std::string whiteElo
std::string blackElo
std::string variant
std::string result
std::string whiteClock
std::string blackClock
int plies = 0
class BroadcastRound
#include <broadcast.h>

Public Functions

int apply(const PgnGame &game)
int applyPgn(const std::string &pgnText)
inline const std::vector<BroadcastGame> &games() const
const BroadcastGame *find(const std::string &key) const
std::vector<BroadcastGame> playable() const
inline size_t size() const
inline void clear()

Private Members

std::vector<BroadcastGame> games_
struct BroadcastRoundRef
#include <broadcast.h>

Public Members

std::string id
std::string name
std::string url
bool ongoing = false
bool finished = false
struct BroadcastTournamentRef
#include <broadcast.h>

Public Functions

bool likelyClassical() const

Public Members

std::string id
std::string name
std::string timeControl
std::string location
BroadcastRoundRef round