xaya / libxayagame

MIT License
21 stars 19 forks source link

Unblock state reads from block updates #137

Closed domob1812 closed 2 months ago

domob1812 commented 2 months ago

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.

This implements #136.