Documentation ¶
Index ¶
- Constants
- Variables
- func BuildQueryParams(path string, filter map[string]string) string
- func EncodeFilter(filter map[string]string) string
- func HasCapacity(group *pb.AssignmentGroup, gs *GameServer) bool
- func IsAssignmentGroupValidForAllocation(group *pb.AssignmentGroup) error
- func ValueIsEmpty(value string, err error) (bool, error)
- type AgonesAllocator
- type AgonesAllocatorClient
- type AgonesAllocatorClientConfig
- type AgonesDiscoverAllocator
- func (c *AgonesDiscoverAllocator) Allocate(ctx context.Context, req *pb.AssignTicketsRequest) error
- func (c *AgonesDiscoverAllocator) FindGameServers(ctx context.Context, filters map[string]string) ([]byte, error)
- func (c *AgonesDiscoverAllocator) ListGameServers(ctx context.Context, filter *extensions.AllocatorFilterExtension) ([]*GameServer, error)
- type AgonesDiscoverClient
- type AgonesDiscoverClientHTTP
- type AllocatorService
- type GameServer
- type GameServerAllocator
- type GameServerAllocatorClient
- type GameServerAllocatorService
- type GameServerDiscoveryClient
- type GameServerStatus
- type GameServersResponse
- type GameSessionAllocatorService
- type PlayerStatus
Constants ¶
View Source
const (
GET_GAMESERVER_PATH = "/api/v1/gameservers"
)
Variables ¶
View Source
var ( ErrKeyFileInvalid = errors.New("the private key file for the client certificate is invalid") ErrCertFileInvalid = errors.New("the public key file for the client certificate is invalid") ErrCaCertFileInvalid = errors.New("the CA cert file for server signing certificate is invalid") ErrAllocatorServiceHostInvalid = errors.New("the Allocator Service host is invalid") ErrAllocatorServicePortInvalid = errors.New("the Allocator Service port is invalid") ErrAllocatorServiceNamespace = errors.New("the Allocator Service namespace is invalid") )
View Source
var (
ErrGameServersNotFound = errors.New("gameservers not found")
)
View Source
var (
NotAvailableGameServerToAllocateMessage = "there is no available GameServer to allocate"
)
Functions ¶
func EncodeFilter ¶
func HasCapacity ¶
func HasCapacity(group *pb.AssignmentGroup, gs *GameServer) bool
func IsAssignmentGroupValidForAllocation ¶
func IsAssignmentGroupValidForAllocation(group *pb.AssignmentGroup) error
Types ¶
type AgonesAllocator ¶
type AgonesAllocator struct {
Client *AgonesAllocatorClient
}
func NewAgonesAllocator ¶
func NewAgonesAllocator(client *AgonesAllocatorClient) *AgonesAllocator
func (*AgonesAllocator) Allocate ¶
func (a *AgonesAllocator) Allocate(ctx context.Context, req *pb.AssignTicketsRequest) error
type AgonesAllocatorClient ¶
type AgonesAllocatorClient struct { Config *AgonesAllocatorClientConfig DialOpts grpc.DialOption }
AgonesAllocatorClient is the gRPC Client for Agones Allocator Service
func NewAgonesAllocatorClient ¶
func NewAgonesAllocatorClient(config *AgonesAllocatorClientConfig) (*AgonesAllocatorClient, error)
func (*AgonesAllocatorClient) Allocate ¶
func (c *AgonesAllocatorClient) Allocate(ctx context.Context, request *pb.AllocationRequest) (*pb.AllocationResponse, error)
type AgonesDiscoverAllocator ¶
type AgonesDiscoverAllocator struct {
Client AgonesDiscoverClient
}
func (*AgonesDiscoverAllocator) Allocate ¶
func (c *AgonesDiscoverAllocator) Allocate(ctx context.Context, req *pb.AssignTicketsRequest) error
Allocate will only assign a GameServer to an Assignment if the Capacity (Players.Status.Capacity - Players.Stats.Count) is <= the number of the TicketsIds part of the Assignment
func (*AgonesDiscoverAllocator) FindGameServers ¶
func (*AgonesDiscoverAllocator) ListGameServers ¶
func (c *AgonesDiscoverAllocator) ListGameServers(ctx context.Context, filter *extensions.AllocatorFilterExtension) ([]*GameServer, error)
type AgonesDiscoverClient ¶
type AgonesDiscoverClientHTTP ¶
type AgonesDiscoverClientHTTP struct { ServerURI string // contains filtered or unexported fields }
func NewAgonesDiscoverClientHTTP ¶
func NewAgonesDiscoverClientHTTP(serverURI string) (*AgonesDiscoverClientHTTP, error)
func (*AgonesDiscoverClientHTTP) ListGameServers ¶
type AllocatorService ¶
type AllocatorService struct { GameServerAllocator // contains filtered or unexported fields }
func NewAllocatorService ¶
func NewAllocatorService(service GameServerAllocator) *AllocatorService
func (*AllocatorService) Allocate ¶
func (s *AllocatorService) Allocate(ctx context.Context, req *pb.AssignTicketsRequest) error
type GameServer ¶
type GameServer struct { UID string `json:"uid,omitempty"` Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` ResourceVersion string `json:"resource_version,omitempty"` Labels map[string]string `json:"labels,omitempty"` Status *GameServerStatus `json:"status,omitempty"` }
func ParseGameServersResponse ¶
func ParseGameServersResponse(resp []byte) ([]*GameServer, error)
type GameServerAllocator ¶
type GameServerAllocator interface {
Allocate(ctx context.Context, req *pb.AssignTicketsRequest) error
}
type GameServerAllocatorClient ¶
type GameServerAllocatorClient interface {
Allocate(ctx context.Context, req *pb.AssignTicketsRequest) error
}
GameServerAllocatorClient allocates GameServers without knowing them beforehand Usually that could be done by pushing a GameServerAllocation request or talking directly to the GameServer Allocator Service from Agones
type GameServerAllocatorService ¶
type GameServerAllocatorService interface { GameServerAllocatorClient }
Allocate Dedicated GameServers
type GameServerDiscoveryClient ¶
type GameServerDiscoveryClient interface {
FindGameServers(ctx context.Context, filters map[string]string) ([]byte, error)
}
GameServerDiscoveryClient communicates with some sort of underlying infrastructure or service and return GameServers for a given filter
type GameServerStatus ¶
type GameServerStatus struct { State string `json:"state,omitempty"` Address string `json:"address,omitempty"` Players *PlayerStatus `json:"players,omitempty"` }
type GameServersResponse ¶
type GameServersResponse struct {
Data []*GameServer `json:"data"`
}
type GameSessionAllocatorService ¶
type GameSessionAllocatorService interface { GameServerAllocatorClient GameServerDiscoveryClient }
Allocate GameServers by Sessions
type PlayerStatus ¶
Click to show internal directories.
Click to hide internal directories.