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:
- AllocateAsync(MatchRequest, CancellationToken) does not return until the server is actually reachable at Endpoint and Code already resolves to it.
- ReleaseAsync(MatchAllocation, CancellationToken) is idempotent: releasing an allocation twice, or one the provider no longer knows about, does nothing and does not throw.
- Both throw MatchAllocationException (never a provider-specific exception type) when the provider refuses the request or cannot be reached.
Properties
DisplayName
A name for people and for logs ("Edgegap", "Gameye", ...).
string DisplayName { get; }
Property Value
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
requestMatchRequestcancellationTokenCancellationToken
Returns
Exceptions
- ArgumentNullException
requestis 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
allocationMatchAllocationcancellationTokenCancellationToken
Returns
Exceptions
- ArgumentNullException
allocationis null.- MatchAllocationException
The provider could not be reached (a refusal because the allocation is already gone is swallowed, not thrown).