Documentation ¶
Index ¶
- type Store
- func (s *Store) CreateGame(ctx context.Context, g *pb.Game, frames []*pb.GameFrame) error
- func (s *Store) GameQueueLength(ctx context.Context) (running int, waiting int, err error)
- func (s *Store) GetGame(c context.Context, id string) (*pb.Game, error)
- func (s *Store) ListGameFrames(ctx context.Context, id string, limit, offset int) ([]*pb.GameFrame, error)
- func (s *Store) Lock(ctx context.Context, key, token string) (string, error)
- func (s *Store) PopGameID(ctx context.Context) (string, error)
- func (s *Store) PushGameFrame(ctx context.Context, id string, t *pb.GameFrame) error
- func (s *Store) SetGameStatus(ctx context.Context, id string, status rules.GameStatus) error
- func (s *Store) Unlock(ctx context.Context, key, token string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store represents an SQL store.
func NewSQLStore ¶
NewSQLStore returns a new store using a postgres database.
func (*Store) CreateGame ¶
CreateGame will insert a game with the default game frames.
func (*Store) GameQueueLength ¶ added in v0.2.17
func (*Store) ListGameFrames ¶
func (s *Store) ListGameFrames(ctx context.Context, id string, limit, offset int) ([]*pb.GameFrame, error)
ListGameFrames will list frames by an offset and limit, it supports negative offset.
func (*Store) Lock ¶
Lock will lock a specific game, returning a token that must be used to write frames to the game.
func (*Store) PopGameID ¶
PopGameID returns a new game that is unlocked and running. Workers call this method through the controller to find games to process.
func (*Store) PushGameFrame ¶
PushGameFrame will push a game frame onto the list of frames.
func (*Store) SetGameStatus ¶
SetGameStatus is used to set a specific game status. This operation should be atomic.
Click to show internal directories.
Click to hide internal directories.