sdkserver

package
v1.10.0-rc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2020 License: Apache-2.0 Imports: 37 Imported by: 2

Documentation

Overview

Package sdkserver implements Agones SDK server (sidecar).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalSDKServer

type LocalSDKServer struct {
	// contains filtered or unexported fields
}

LocalSDKServer type is the SDKServer implementation for when the sidecar is being run for local development, and doesn't connect to the Kubernetes cluster

func NewLocalSDKServer

func NewLocalSDKServer(filePath string) (*LocalSDKServer, error)

NewLocalSDKServer returns the default LocalSDKServer

func (*LocalSDKServer) Allocate added in v0.10.0

func (l *LocalSDKServer) Allocate(context.Context, *sdk.Empty) (*sdk.Empty, error)

Allocate logs that an allocate request has been received

func (*LocalSDKServer) Close

func (l *LocalSDKServer) Close()

Close tears down all the things

func (*LocalSDKServer) EqualSets added in v1.6.0

func (l *LocalSDKServer) EqualSets(expected, received []string) bool

EqualSets tells whether expected and received slices contain the same elements. A nil argument is equivalent to an empty slice.

func (*LocalSDKServer) GenerateUID added in v0.12.0

func (l *LocalSDKServer) GenerateUID()

GenerateUID - generate gameserver UID at random for testing

func (*LocalSDKServer) GetConnectedPlayers added in v1.6.0

func (l *LocalSDKServer) GetConnectedPlayers(c context.Context, empty *alpha.Empty) (*alpha.PlayerIDList, error)

GetConnectedPlayers returns the list of the currently connected player ids. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*LocalSDKServer) GetGameServer

func (l *LocalSDKServer) GetGameServer(context.Context, *sdk.Empty) (*sdk.GameServer, error)

GetGameServer returns current GameServer configuration.

func (*LocalSDKServer) GetPlayerCapacity added in v1.5.0

func (l *LocalSDKServer) GetPlayerCapacity(_ context.Context, _ *alpha.Empty) (*alpha.Count, error)

GetPlayerCapacity returns the current player capacity. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*LocalSDKServer) GetPlayerCount added in v1.5.0

func (l *LocalSDKServer) GetPlayerCount(ctx context.Context, _ *alpha.Empty) (*alpha.Count, error)

GetPlayerCount returns the current player count. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*LocalSDKServer) Health

func (l *LocalSDKServer) Health(stream sdk.SDK_HealthServer) error

Health logs each health ping that comes down the stream

func (*LocalSDKServer) IsPlayerConnected added in v1.6.0

func (l *LocalSDKServer) IsPlayerConnected(c context.Context, id *alpha.PlayerID) (*alpha.Bool, error)

IsPlayerConnected returns if the playerID is currently connected to the GameServer. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*LocalSDKServer) PlayerConnect added in v1.5.0

func (l *LocalSDKServer) PlayerConnect(ctx context.Context, id *alpha.PlayerID) (*alpha.Bool, error)

PlayerConnect should be called when a player connects. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*LocalSDKServer) PlayerDisconnect added in v1.5.0

func (l *LocalSDKServer) PlayerDisconnect(ctx context.Context, id *alpha.PlayerID) (*alpha.Bool, error)

PlayerDisconnect should be called when a player disconnects. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*LocalSDKServer) Ready

Ready logs that the Ready request has been received

func (*LocalSDKServer) Reserve added in v0.12.0

func (l *LocalSDKServer) Reserve(ctx context.Context, d *sdk.Duration) (*sdk.Empty, error)

Reserve moves this GameServer to the Reserved state for the Duration specified

func (*LocalSDKServer) SetAnnotation

func (l *LocalSDKServer) SetAnnotation(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error)

SetAnnotation applies a Annotation to the backing GameServer metadata

func (*LocalSDKServer) SetExpectedSequence added in v0.12.0

func (l *LocalSDKServer) SetExpectedSequence(sequence []string)

SetExpectedSequence set expected request sequence which would be verified against after run was completed

func (*LocalSDKServer) SetLabel

func (l *LocalSDKServer) SetLabel(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error)

SetLabel applies a Label to the backing GameServer metadata

func (*LocalSDKServer) SetPlayerCapacity added in v1.5.0

func (l *LocalSDKServer) SetPlayerCapacity(_ context.Context, count *alpha.Count) (*alpha.Empty, error)

SetPlayerCapacity to change the game server's player capacity. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*LocalSDKServer) SetSdkName added in v1.6.0

func (l *LocalSDKServer) SetSdkName(sdkName string)

SetSdkName set SDK name to be added to the logs

func (*LocalSDKServer) SetTestMode added in v0.12.0

func (l *LocalSDKServer) SetTestMode(testMode bool)

SetTestMode set test mode to collect the sequence of performed requests

func (*LocalSDKServer) Shutdown

func (l *LocalSDKServer) Shutdown(context.Context, *sdk.Empty) (*sdk.Empty, error)

Shutdown logs that the shutdown request has been received

func (*LocalSDKServer) WatchGameServer

func (l *LocalSDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameServerServer) error

WatchGameServer will return current GameServer configuration, 3 times, every 5 seconds

type Operation

type Operation string

Operation is a synchronisation action

type SDKServer

type SDKServer struct {
	// contains filtered or unexported fields
}

SDKServer is a gRPC server, that is meant to be a sidecar for a GameServer that will update the game server status on SDK requests nolint: maligned

func NewSDKServer

func NewSDKServer(gameServerName, namespace string, kubeClient kubernetes.Interface,
	agonesClient versioned.Interface) (*SDKServer, error)

NewSDKServer creates a SDKServer that sets up an InClusterConfig for Kubernetes

func (*SDKServer) Allocate added in v0.10.0

func (s *SDKServer) Allocate(ctx context.Context, e *sdk.Empty) (*sdk.Empty, error)

Allocate enters an Allocate state change into the workqueue, so it can be updated

func (*SDKServer) GetConnectedPlayers added in v1.6.0

func (s *SDKServer) GetConnectedPlayers(c context.Context, empty *alpha.Empty) (*alpha.PlayerIDList, error)

GetConnectedPlayers returns the list of the currently connected player ids. This is always accurate, even if the value hasn’t been updated to the GameServer status yet. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*SDKServer) GetGameServer

func (s *SDKServer) GetGameServer(context.Context, *sdk.Empty) (*sdk.GameServer, error)

GetGameServer returns the current GameServer configuration and state from the backing GameServer CRD

func (*SDKServer) GetPlayerCapacity added in v1.5.0

func (s *SDKServer) GetPlayerCapacity(ctx context.Context, _ *alpha.Empty) (*alpha.Count, error)

GetPlayerCapacity returns the current player capacity, as set by SDK.SetPlayerCapacity() [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*SDKServer) GetPlayerCount added in v1.5.0

func (s *SDKServer) GetPlayerCount(ctx context.Context, _ *alpha.Empty) (*alpha.Count, error)

GetPlayerCount returns the current player count. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*SDKServer) Health

func (s *SDKServer) Health(stream sdk.SDK_HealthServer) error

Health receives each health ping, and tracks the last time the health check was received, to track if a GameServer is healthy

func (*SDKServer) IsPlayerConnected added in v1.6.0

func (s *SDKServer) IsPlayerConnected(ctx context.Context, id *alpha.PlayerID) (*alpha.Bool, error)

IsPlayerConnected returns if the playerID is currently connected to the GameServer. This is always accurate, even if the value hasn’t been updated to the GameServer status yet. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*SDKServer) PlayerConnect added in v1.5.0

func (s *SDKServer) PlayerConnect(ctx context.Context, id *alpha.PlayerID) (*alpha.Bool, error)

PlayerConnect should be called when a player connects. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*SDKServer) PlayerDisconnect added in v1.5.0

func (s *SDKServer) PlayerDisconnect(ctx context.Context, id *alpha.PlayerID) (*alpha.Bool, error)

PlayerDisconnect should be called when a player disconnects. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*SDKServer) Ready

func (s *SDKServer) Ready(ctx context.Context, e *sdk.Empty) (*sdk.Empty, error)

Ready enters the RequestReady state change for this GameServer into the workqueue so it can be updated

func (*SDKServer) Reserve added in v0.12.0

func (s *SDKServer) Reserve(ctx context.Context, d *sdk.Duration) (*sdk.Empty, error)

Reserve moves this GameServer to the Reserved state for the Duration specified

func (*SDKServer) Run

func (s *SDKServer) Run(stop <-chan struct{}) error

Run processes the rate limited queue. Will block until stop is closed

func (*SDKServer) SetAnnotation

func (s *SDKServer) SetAnnotation(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error)

SetAnnotation adds the Key/Value to be used to set the annotations with the metadataPrefix to the `GameServer` metdata

func (*SDKServer) SetLabel

func (s *SDKServer) SetLabel(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error)

SetLabel adds the Key/Value to be used to set the label with the metadataPrefix to the `GameServer` metdata

func (*SDKServer) SetPlayerCapacity added in v1.5.0

func (s *SDKServer) SetPlayerCapacity(ctx context.Context, count *alpha.Count) (*alpha.Empty, error)

SetPlayerCapacity to change the game server's player capacity. [Stage:Alpha] [FeatureFlag:PlayerTracking]

func (*SDKServer) Shutdown

func (s *SDKServer) Shutdown(ctx context.Context, e *sdk.Empty) (*sdk.Empty, error)

Shutdown enters the Shutdown state change for this GameServer into the workqueue so it can be updated

func (*SDKServer) WatchGameServer

func (s *SDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameServerServer) error

WatchGameServer sends events through the stream when changes occur to the backing GameServer configuration / status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL