Interface IMatchAllocator

Namespace
Unity.Multiplayer.Core

Requests and releases one server per match from a game-server platform that allocates on demand (Edgegap, Gameye, ...), as distinct from IHostingProfile's provision-once, keep-running profiles (GenericVps, RunPod and the rest of RFC 0001's hosting table). A matchmaker calls AllocateAsync(MatchRequest, CancellationToken) when a match is ready to start and ReleaseAsync(MatchAllocation, CancellationToken) once it ends; the adapter's NetSession.JoinAllocatedServerAsync is the client side, joining the endpoint an allocation carries.

public interface IMatchAllocator

Remarks

Contract every implementation keeps:

Properties

DisplayName

A name for people and for logs ("Edgegap", "Gameye", ...).

string DisplayName { get; }

Property Value

string

Methods

AllocateAsync(MatchRequest, CancellationToken)

Requests a server for request and waits until it can be joined.

Task<MatchAllocation> AllocateAsync(MatchRequest request, CancellationToken cancellationToken = default)

Parameters

request MatchRequest
cancellationToken CancellationToken

Returns

Task<MatchAllocation>

Exceptions

ArgumentNullException

request is null.

MatchAllocationException

The provider refused the request, could not be reached, or never came up in time.

ReleaseAsync(MatchAllocation, CancellationToken)

Tears down a server AllocateAsync(MatchRequest, CancellationToken) returned, once the match is over.

Task ReleaseAsync(MatchAllocation allocation, CancellationToken cancellationToken = default)

Parameters

allocation MatchAllocation
cancellationToken CancellationToken

Returns

Task

Exceptions

ArgumentNullException

allocation is null.

MatchAllocationException

The provider could not be reached (a refusal because the allocation is already gone is swallowed, not thrown).