Documentation ¶
Index ¶
- func GetAvailableSpawnerForGame(gameId shared.GameIDType) (models.Spawner, error)
- func RegisterSpawner(spawner models.Spawner)
- func SendCheckStatusRequest(spawner models.Spawner) (*hotel_pb.SpawnerStatus, error)
- func SendSpawnServerRequest(spawner models.Spawner) (*hotel_pb.SpawnServerResponse, error)
- func SpawnServerForGame(spawner models.Spawner, gameId shared.GameIDType) (models.GameServer, error)
- type MasterService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAvailableSpawnerForGame ¶
func GetAvailableSpawnerForGame(gameId shared.GameIDType) (models.Spawner, error)
GetAvailableSpawnerForGame returns the best available spawner for the given game ID. Spawners are attempted to be load balanced by capacity, so this function should return a spawner with the most capacity.
func RegisterSpawner ¶
RegisterSpawner adds the given spawner to the database.
func SendCheckStatusRequest ¶
func SendCheckStatusRequest(spawner models.Spawner) (*hotel_pb.SpawnerStatus, error)
SendCheckStatusRequest asks the given spawner to report its current status.
func SendSpawnServerRequest ¶
func SendSpawnServerRequest(spawner models.Spawner) (*hotel_pb.SpawnServerResponse, error)
SendSpawnServerRequest makes an RPC to a spawner to spawn a game server instance.
func SpawnServerForGame ¶
func SpawnServerForGame(spawner models.Spawner, gameId shared.GameIDType) (models.GameServer, error)
SpawnServerForGame asks the given spawner to spawn a game server for the given game ID. If successful, a GameServer representing the newly running server is returned (or the expected game server that is being started).
Types ¶
type MasterService ¶
type MasterService struct{}
MasterService contains RPC implementations for the master service.
func (*MasterService) RegisterSpawner ¶
func (s *MasterService) RegisterSpawner(ctx context.Context, request *hotel_pb.RegisterSpawnerRequest) (*hotel_pb.RegisterSpawnerResponse, error)
RegisterSpawner adds the requesting spawner to the database and makes it available to clients for requesting spawns.