Documentation ¶
Index ¶
- type RedisClient
- func (c *RedisClient) DeleteGame(ctx context.Context, gameId string) error
- func (c *RedisClient) ListRecentGames(ctx context.Context, limit int) ([]*pb.GameInfo, error)
- func (c *RedisClient) LoginPlayer(ctx context.Context, playerId hexz.PlayerId, name string) error
- func (c *RedisClient) LookupGame(ctx context.Context, gameId string) (*pb.GameState, error)
- func (c *RedisClient) LookupPlayer(ctx context.Context, playerId hexz.PlayerId) (hexz.Player, error)
- func (c *RedisClient) Ping() error
- func (c *RedisClient) Publish(ctx context.Context, gameId string, message string) error
- func (c *RedisClient) StoreNewGame(ctx context.Context, s *pb.GameState) (bool, error)
- func (c *RedisClient) Subscribe(ctx context.Context, gameId string, ch chan<- string)
- func (c *RedisClient) UpdateGame(ctx context.Context, s *pb.GameState) error
- type RedisClientConfig
- type RemotePlayerStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
func NewRedisClient ¶
func NewRedisClient(config *RedisClientConfig) (*RedisClient, error)
func (*RedisClient) DeleteGame ¶
func (c *RedisClient) DeleteGame(ctx context.Context, gameId string) error
func (*RedisClient) ListRecentGames ¶
func (*RedisClient) LoginPlayer ¶
func (*RedisClient) LookupGame ¶
func (*RedisClient) LookupPlayer ¶
func (*RedisClient) Ping ¶
func (c *RedisClient) Ping() error
func (*RedisClient) Publish ¶
Sends a message to the channel for the given game. Returns the number of subscribers that received the message.
func (*RedisClient) StoreNewGame ¶
Stores the given game state in Redis, unless a game with the same ID already exists. This method updates the Modified fields of the game state.
func (*RedisClient) Subscribe ¶
func (c *RedisClient) Subscribe(ctx context.Context, gameId string, ch chan<- string)
func (*RedisClient) UpdateGame ¶
Stores the given game state in Redis, overwriting any existing game with the same ID. This method updates the Seqnum and Modified fields of the game state.
type RedisClientConfig ¶
type RemotePlayerStore ¶
type RemotePlayerStore struct {
*RedisClient
}
RemotePlayerStore is an interface adapter that lets RedisClient implement PlayerStore.
Click to show internal directories.
Click to hide internal directories.