fleetmanager

package
v0.0.0-...-ca7b91e Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageGameLiftIndex               = "_gamelift_instances_idx"
	StorageGameLiftInstancesCollection = "_gamelift_instances"
)
View Source
const (
	GameSessionDataKey = "GameSessionData"
	GamePropertiesKey  = "GameProperties"
	GameSessionNameKey = "GameSessionName"
)
View Source
const (
	RpcIdUpdateInstanceInfo = "update_instance_info"
	RpcIdDeleteInstanceInfo = "delete_instance_info"
)
View Source
const (
	GameLiftEventIdPlacementFulfilled = "PlacementFulfilled"
	GameLiftEventIdPlacementCancelled = "PlacementCancelled"
	GameLiftEventIdPlacementTimedOut  = "PlacementTimedOut"
	GameLiftEventIdPlacementFailed    = "PlacementFailed"
)

Variables

View Source
var (
	ErrInvalidInput  = runtime.NewError("input is invalid", 3)       // INVALID_ARGUMENT
	ErrInternalError = runtime.NewError("internal server error", 13) // INTERNAL
)

Functions

func InstanceIdToStorageKey

func InstanceIdToStorageKey(id string) (string, error)

func NewInstanceInfo

func NewInstanceInfo(gs types.GameSession) *runtime.InstanceInfo

Types

type DeleteInstanceInfoRequest

type DeleteInstanceInfoRequest struct {
	Id string `json:"id"`
}

type GameLiftConfig

type GameLiftConfig struct {
	NakamaNode               string        // Nakama node
	AwsKey                   string        // AWS Key
	AwsSecret                string        // AWS Secret
	AwsRegion                string        // AWS Fleet Region
	AwsFleetAlias            string        // AWS GameLift Fleet Alias
	AwsPlacementQueueName    string        // AWS GameLift Placement Queue Name
	AwsPlacementEventsSqsUrl string        // AWS GameLift Placement Events SQS Queue URL
	AwsGameLiftPollingPeriod time.Duration // Periodicity of the polling to the Aws GameLift APIs
	IndexMaxEntries          int           // Nakama storage index max entries - limits the number of game sessions that can be indexed.
	HttpRequestTimeout       time.Duration // AWS Http Client request timeout
	HttpDialerTimeout        time.Duration // AWS Http Client request dialing timeout
	SqsVisibilityTimeout     time.Duration // AWS SQS Client Visibility Timeout
	SqsWaitTime              time.Duration // AWS SQS Client Wait Time
}

func NewGameLiftConfig

func NewGameLiftConfig(awsKey, awsSecret, awsRegion, awsGameLiftFleetAlias, awsGameLiftPlacementQueueName, awsGameLiftPlacementEventsSqsUrl string) GameLiftConfig

func (*GameLiftConfig) Validate

func (glc *GameLiftConfig) Validate() error

type GameLiftFleetManager

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

func (*GameLiftFleetManager) Create

func (fm *GameLiftFleetManager) Create(ctx context.Context, maxPlayers int, userIds []string, latencies []runtime.FleetUserLatencies, metadata map[string]any, callback runtime.FmCreateCallbackFn) error

func (*GameLiftFleetManager) Delete

func (fm *GameLiftFleetManager) Delete(ctx context.Context, id string) error

func (*GameLiftFleetManager) DeleteInstanceInfo

func (fm *GameLiftFleetManager) DeleteInstanceInfo(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, payload string) (string, error)

func (*GameLiftFleetManager) Get

func (fm *GameLiftFleetManager) Get(ctx context.Context, id string) (instance *runtime.InstanceInfo, err error)

func (*GameLiftFleetManager) Init

func (*GameLiftFleetManager) Join

func (fm *GameLiftFleetManager) Join(ctx context.Context, id string, userIds []string, metadata map[string]string) (joinInfo *runtime.JoinInfo, err error)

func (*GameLiftFleetManager) List

func (fm *GameLiftFleetManager) List(ctx context.Context, query string, limit int, prevCursor string) (list []*runtime.InstanceInfo, nextCursor string, err error)

func (*GameLiftFleetManager) Update

func (fm *GameLiftFleetManager) Update(ctx context.Context, id string, playerCount int, metadata map[string]any) error

func (*GameLiftFleetManager) UpdateInstanceInfo

func (fm *GameLiftFleetManager) UpdateInstanceInfo(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, payload string) (string, error)

type SqsMessage

type SqsMessage struct {
	Type             string    `json:"Type"`
	MessageId        string    `json:"MessageId"`
	TopicArn         string    `json:"TopicArn"`
	Message          string    `json:"Message"`
	Timestamp        time.Time `json:"Timestamp"`
	SignatureVersion string    `json:"SignatureVersion"`
	Signature        string    `json:"Signature"`
	SigningCertURL   string    `json:"SigningCertURL"`
	UnsubscribeURL   string    `json:"UnsubscribeURL"`
}

type SqsMessagePlacementEventBody

type SqsMessagePlacementEventBody struct {
	Version    string    `json:"version"`
	Id         string    `json:"id"`
	DetailType string    `json:"detail-type"`
	Source     string    `json:"source"`
	Account    string    `json:"account"`
	Time       time.Time `json:"time"`
	Region     string    `json:"region"`
	Resources  []string  `json:"resources"`
	Detail     struct {
		Type                 string    `json:"type"`
		PlacementId          string    `json:"placementId"`
		Port                 string    `json:"port"`
		GameSessionArn       string    `json:"gameSessionArn"`
		IpAddress            string    `json:"ipAddress"`
		DnsName              string    `json:"dnsName"`
		StartTime            time.Time `json:"startTime"`
		EndTime              time.Time `json:"endTime"`
		GameSessionRegion    string    `json:"gameSessionRegion"`
		PlacedPlayerSessions []struct {
			PlayerId        string `json:"playerId"`
			PlayerSessionId string `json:"playerSessionId"`
		} `json:"placedPlayerSessions"`
	} `json:"detail"`
}

type UpdateInstanceInfoRequest

type UpdateInstanceInfoRequest struct {
	Id          string         `json:"id"`
	PlayerCount int            `json:"player_count"`
	Metadata    map[string]any `json:"metadata"`
}

Jump to

Keyboard shortcuts

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