Skip to content

Commit

Permalink
Minor Fleet Manager interface improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sesposito committed Mar 12, 2024
1 parent 1b607aa commit 68febf2
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,21 @@ const (
)

type FmCallbackHandler interface {
GeneratePlacementId() string
SetCallback(placementId string, fn FmCreateCallbackFn)
InvokeCallback(placementId string, status FmCreateStatus, instanceInfo *InstanceInfo, sessionInfo []*SessionInfo, metadata map[string]any, err error)
// Generate a new callback id.
GenerateCallbackId() string
// Set the callback indexed by the generated id.
SetCallback(callbackId string, fn FmCreateCallbackFn)
// Invoke a callback by callback Id.
InvokeCallback(callbackId string, status FmCreateStatus, instanceInfo *InstanceInfo, sessionInfo []*SessionInfo, metadata map[string]any, err error) error
}

type FleetUserLatencies struct {
// User id
UserId string
// Latency experienced by the user contacting a server in a fleet instance region.
LatencyInMilliseconds float32
// Region associated to the experienced latency value.
RegionIdentifier string
}

// FmCreateCallbackFn is the function that is invoked when Create asynchronously succeeds or fails (due to timeout or issues bringing up a new instance).
Expand Down Expand Up @@ -1242,7 +1254,8 @@ type FleetManager interface {
// creation process was either successful or failed.
// If a list of userIds is optionally provided, the new instance (on successful creation) will reserve slots
// for the respective clients to connect, and the callback will contain the required []*SessionInfo.
Create(ctx context.Context, maxPlayers int, userIds []string, metadata map[string]any, callback FmCreateCallbackFn) (err error)
// Latencies is optional and its support depends on the Fleet Manager provider.
Create(ctx context.Context, maxPlayers int, userIds []string, latencies []FleetUserLatencies, metadata map[string]any, callback FmCreateCallbackFn) (err error)

// Join reserves a number of player slots in the target instance. These slots are reserved for a minute, after which,
// if clients do not connect to the instance to claim them, the returned SessionInfo will become invalid and the
Expand Down

0 comments on commit 68febf2

Please sign in to comment.