game-common / pragma.matchcapacity / CapacityProvider /

CapacityProvider #

interface CapacityProvider

CapacityProvider provides an abstract interface for defining a game server capacity model.

Pragma provides some reference examples for existing platforms:

  • PragmaNomadCapacityProvider - Run game servers using Nomad.
  • MultiplayCapacityProvider - Run game servers using Multiplay.
  • LocalProcessCapacityProvider - Run game servers using local hardware.
  • NoOpCapacityProvider - Used when not running game servers (eg. local platform development).

Functions #

NameSummary

add

abstract suspend fun add(gameVersion: String, gameServerZone: String, extraMatchCapacity: Int, capacityTracker: CapacityTracker)

Add extraMatchCapacity more capacity for gameVersion gameVersion. After creating the new capacity, register it with the capacityTracker.

init

abstract fun init(client: TimedHttpClient)

Provides an HttpClient to communicate with external resources for capacity. Hint: Consider inheriting CapacityProviderImpl for an implementation of this!

shutdown

abstract fun shutdown()

Executes during Pragma service shutdown. Use to perform any cleanup tasks.