feat: status api
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user