feat: status api

This commit is contained in:
Ilia Denisov
2026-01-07 18:38:06 +02:00
parent 1b0ab7a079
commit 204d3df8cf
20 changed files with 188 additions and 40 deletions
+4 -2
View File
@@ -22,6 +22,8 @@ type Repo interface {
// LoadState retrieves game current state
LoadState() (game.Game, error)
LoadStateSafe() (game.Game, error)
}
type Controller struct {
@@ -50,7 +52,7 @@ func NewController(configure func(*Param)) (*Controller, error) {
}, nil
}
func (c *Controller) ExecuteInit(consumer func(Repo)) error {
func (c *Controller) ExecuteState(consumer func(Repo)) error {
if err := c.Repo.Lock(); err != nil {
return fmt.Errorf("execute: lock failed: %s", err)
}
@@ -58,7 +60,7 @@ func (c *Controller) ExecuteInit(consumer func(Repo)) error {
return c.Repo.Release()
}
func (c *Controller) Execute(consumer func(Repo, game.Game)) error {
func (c *Controller) ExecuteGame(consumer func(Repo, game.Game)) error {
if err := c.Repo.Lock(); err != nil {
return fmt.Errorf("execute: lock failed: %s", err)
}