Package cloud.spawnery.agent.api
Record Class ServerInfo
java.lang.Object
java.lang.Record
cloud.spawnery.agent.api.ServerInfo
- Record Components:
registered- whether the proxies have this server in their routing tables. A server can beServerPhase.READYand not registered, during the first half of a drain, so a plugin deciding where to send somebody wants this and not the phase.state- what the server said it was doing, or""if it has said nothing; seeSpawneryApi.announce(java.lang.String, java.util.Map<java.lang.String, java.lang.String>). Unrelated tophase().attributes- whatever else that server chose to publish, empty until it publishes something. Immutable.incarnation- which run of this server this is: an opaque token that changes whenever the process behind the name is replaced, and never otherwise. Compare it, never parse it.A persistent server keeps its name across restarts, so anything that remembers a server and later asks whether this is still the one it meant compares this and not the name.
Empty for a server whose pod the operator has not seen yet, which is a server nobody is being sent to.
number- which of its group's servers this is, counted the way a person counts: the second hub is 2. Stable for as long as the server exists.Given out again once this server is gone, so two servers that were both "Hub-2" at different times are told apart by
incarnation()and never by this.0 for a server nobody numbered, and for the ordinal-zero server of a persistent group, which reports its ordinal here. Show the name for those rather than a zero.
held- whether an admin took this server's retirement back: nothing automatic removes it any more; it stays until it ends by itself.node- the Kubernetes node the server's pod runs on, empty while it is not scheduled.playableSlots- how many ofslotscount as capacity. Equal toslotswhen nothing narrowed it, and for a report from an operator older than this field.resources- the resources stamped on this server when it was started,ServerResources.NONEfor one without any and for a report from an operator older than this field.unschedulable- whether the Kubernetes scheduler has found no node for this server's pod: the cluster has no room for it right now, whatever the cause, and left alone the server fails at the startup deadline. Never true together with a non-emptynode(). False while the scheduler has not looked yet, once the pod is placed, and for a report from an operator older than this field.
public record ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String,String> attributes, String incarnation, int number, boolean held, String node, int playableSlots, ServerResources resources, boolean unschedulable)
extends Record
One backend, as the operator last described it.
A value and not a handle: call SpawneryApi.server(java.lang.String) again for a
newer one.
-
Constructor Summary
ConstructorsConstructorDescriptionServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number) The record as it was beforeheld, which it reads as false.ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held) The record as it was beforenode, which it reads as not scheduled.ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held, String node) The record as it was beforeplayableSlots, which it reads as every seat.ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held, String node, int playableSlots) The record as it was beforeresources, which it reads as none.ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held, String node, int playableSlots, ServerResources resources) The record as it was beforeunschedulable, which it reads as false.ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held, String node, int playableSlots, ServerResources resources, boolean unschedulable) Creates an instance of aServerInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributesrecord component.final booleanIndicates whether some other object is "equal to" this one.intHow many more players this server would accept, never negative: a report can show more players than slots while a loweredmaxPlayersreaches the running pods.group()Returns the value of thegrouprecord component.final inthashCode()Returns a hash code value for this object.booleanheld()Returns the value of theheldrecord component.Returns the value of theincarnationrecord component.name()Returns the value of thenamerecord component.node()Returns the value of thenoderecord component.intnumber()Returns the value of thenumberrecord component.phase()Returns the value of thephaserecord component.intReturns the value of theplayableSlotsrecord component.intplayers()Returns the value of theplayersrecord component.booleanReturns the value of theregisteredrecord component.Returns the value of theresourcesrecord component.intslots()Returns the value of theslotsrecord component.state()Returns the value of thestaterecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theunschedulablerecord component.
-
Constructor Details
-
ServerInfo
public ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held, String node, int playableSlots, ServerResources resources, boolean unschedulable) Creates an instance of aServerInforecord class.- Parameters:
name- the value for thenamerecord componentgroup- the value for thegrouprecord componentphase- the value for thephaserecord componentplayers- the value for theplayersrecord componentslots- the value for theslotsrecord componentregistered- the value for theregisteredrecord componentstate- the value for thestaterecord componentattributes- the value for theattributesrecord componentincarnation- the value for theincarnationrecord componentnumber- the value for thenumberrecord componentheld- the value for theheldrecord componentnode- the value for thenoderecord componentplayableSlots- the value for theplayableSlotsrecord componentresources- the value for theresourcesrecord componentunschedulable- the value for theunschedulablerecord component
-
ServerInfo
public ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held, String node, int playableSlots, ServerResources resources) The record as it was beforeunschedulable, which it reads as false. -
ServerInfo
public ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held, String node, int playableSlots) The record as it was beforeresources, which it reads as none. -
ServerInfo
public ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held, String node) The record as it was beforeplayableSlots, which it reads as every seat. -
ServerInfo
public ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number, boolean held) The record as it was beforenode, which it reads as not scheduled. -
ServerInfo
public ServerInfo(String name, String group, ServerPhase phase, int players, int slots, boolean registered, String state, Map<String, String> attributes, String incarnation, int number) The record as it was beforeheld, which it reads as false.
-
-
Method Details
-
freeSlots
public int freeSlots()How many more players this server would accept, never negative: a report can show more players than slots while a loweredmaxPlayersreaches the running pods. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
group
Returns the value of thegrouprecord component.- Returns:
- the value of the
grouprecord component
-
phase
Returns the value of thephaserecord component.- Returns:
- the value of the
phaserecord component
-
players
public int players()Returns the value of theplayersrecord component.- Returns:
- the value of the
playersrecord component
-
slots
public int slots()Returns the value of theslotsrecord component.- Returns:
- the value of the
slotsrecord component
-
registered
public boolean registered()Returns the value of theregisteredrecord component.- Returns:
- the value of the
registeredrecord component
-
state
Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-
attributes
Returns the value of theattributesrecord component.- Returns:
- the value of the
attributesrecord component
-
incarnation
Returns the value of theincarnationrecord component.- Returns:
- the value of the
incarnationrecord component
-
number
public int number()Returns the value of thenumberrecord component.- Returns:
- the value of the
numberrecord component
-
held
public boolean held()Returns the value of theheldrecord component.- Returns:
- the value of the
heldrecord component
-
node
Returns the value of thenoderecord component.- Returns:
- the value of the
noderecord component
-
playableSlots
public int playableSlots()Returns the value of theplayableSlotsrecord component.- Returns:
- the value of the
playableSlotsrecord component
-
resources
Returns the value of theresourcesrecord component.- Returns:
- the value of the
resourcesrecord component
-
unschedulable
public boolean unschedulable()Returns the value of theunschedulablerecord component.- Returns:
- the value of the
unschedulablerecord component
-