Vixen
02b45cc4
csharp
public record class RealmSpec

Everything a realm process needs to know at boot, and nothing it can ask for later.

Read the guide page for this →

Remarks

One value, produced by whoever decided the shard should exist and consumed by the process that carries it. It crosses the boundary as one argument (ArgumentName) or one environment variable (EnvironmentVariable), which is what lets the three placement backends — a pod spec, a container's command, Process.Start — differ in nothing but how they set a string.

⚠ The endpoint is in here and the shard id is in here. A realm that discovered either by asking the orchestrator after boot would have a window in which it is running and unaddressable, and every backend would need a different answer for how that window ends. Handed the spec, the process is either the shard it was told to be or it exited.

⚠ Endpoint may arrive unbound. A spec with no port says "the backend chooses" — a hostPort from the node's range, a published container port, a port from a pool — and one with no host either says the backend chooses that too, which is the only thing an orchestrator placing onto a Kubernetes scheduler can say. StartAsync rewrites it before the process ever sees it: what the process is handed is always bound.

Fields and properties (12)

  • public const string ArgumentName

    The single argument a realm is launched with.

  • public const string EnvironmentVariable

    Where a realm looks when no argument was given.

  • public ShardId Shard

    Which shard this process is.

  • public ShardKey Key

    The map, the region and the version pair.

  • public ShardKind Kind

    Who is admitted and when it may stop.

  • public RealmEndpoint Endpoint

    Where clients open their sessions. Possibly unbound; see the type's remarks.

  • public ShardCapacity Capacity

    How full it may get.

  • public int TickRate

    Simulation ticks per second.

  • public ulong Seed

    The seed for anything the shard generates — spawn jitter, weather, a roaming boss's route.

  • public string ClusterEndpoint

    How to reach the control plane, or empty for a realm that has none.

  • public IReadOnlyDictionary<string, string> Options

    Whatever else the game's own realm wants, carried verbatim.

  • public bool IsValid

    Whether this spec names a runnable shard.

Methods (7)

  • public string Encode()

    The spec as the one string that crosses a process boundary.

  • public static bool TryDecode(string? text, out RealmSpec? spec, out string error)

    Reads a spec back, or says what was wrong with it.

  • public IReadOnlyList<string> ToCommandLine()

    The arguments a placement backend launches a realm with.

  • public static bool TryRead(IReadOnlyList<string>? arguments, Func<string, string?>? environment, out RealmSpec? spec, out string error)

    Finds the spec a realm process was started with.

  • public bool Equals(RealmSpec? other)

    Whether two specs say the same thing, options included.

  • public override int GetHashCode()

    Serves as the default hash function.

  • public override string ToString()

    Returns a string that represents the current object.

Used by (21)

  • DockerPlacementVixen.Live.Placement.Docker
  • DockerPlacementTestsVixen.Live.Placement.Docker.Tests
  • FakeProcessVixen.Live.Placement.Process.Tests
  • IRealmPlacementVixen.Live.Abstractions
  • KubernetesPlacementVixen.Live.Placement.Kubernetes
  • KubernetesPlacementTestsVixen.Live.Placement.Kubernetes.Tests
  • LiveVocabularyTestsVixen.Live.Abstractions.Tests
  • MapGrainVixen.Live.Orchestrator
  • PlayerAdmissionVixen.Live.Realm
  • ProcessPlacementVixen.Live.Placement.Process
  • ProcessPlacementTestsVixen.Live.Placement.Process.Tests
  • RealmVixen.Live.Realm
  • RealmVixen.Live.Realm.Tests
  • RealmAppVixen.Live.Realm
  • RealmClusterVixen.Live.Realm.Cluster
  • RealmClusterTestsVixen.Live.Realm.Cluster.Tests
  • RealmFixtureVixen.Live.Realm.Tests
  • RealmHostVixen.Live.Realm
  • RealmHostTestsVixen.Live.Realm.Tests
  • RealmSpecTestsVixen.Live.Abstractions.Tests
  • TransferFleetVixen.Live.Realm.Tests