In this set of changes, we refactor how SQLiteGame handes the GetCustomStateData method, i.e. how it exposes state reads (e.g. to RPC calls in GSPs). Whenever the instance state changes (game state or things like connected/disconnected/catching up), we update a "current state snapshot". This contains both the instance state and a database snapshot of the full game state. With this, we can then use this to service state reads without requiring a lock on Game::mut. This allows us to continue supporting state reads even when a block update takes a long time.
In this set of changes, we refactor how
SQLiteGame
handes theGetCustomStateData
method, i.e. how it exposes state reads (e.g. to RPC calls in GSPs). Whenever the instance state changes (game state or things like connected/disconnected/catching up), we update a "current state snapshot". This contains both the instance state and a database snapshot of the full game state. With this, we can then use this to service state reads without requiring a lock onGame::mut
. This allows us to continue supporting state reads even when a block update takes a long time.This implements #136.