Class HubDefinitionFile.Parsed
java.lang.Object
com.iizix.server.hub.HubDefinitionFile.Parsed
- Enclosing class:
HubDefinitionFile
The result of a parse: the values, the defaults where the file sets nothing, and the diagnostics. The lists are unmodifiable.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionfinal List<HubDefinitionFile.Diagnostic> The diagnostics, in file order, the whole-file ones last.final intThe fail-open grace, in seconds.final intThe hold of a switched client, in seconds.final StringThe path of the interim cluster key file as written, null when not set.final intThe lease, in seconds.final intThe margin a challenger waits beyond the lease, in seconds.final List<HubDefinitionFile.Member> The members in file order, which is the priority order.final StringThe hub's name, null when the file does not set a valid one: the file is then not usable.The further allowed origins, normalised to lower case, in file order without duplicates.final HubDefinitionFile.PolicyThe election policy.Method Summary
Modifier and TypeMethodDescriptioneligible()Gets the eligible members: those flaggedprincipal, in priority order.booleanTells whether any line or value was refused.intGets the position of a member in the priority order.booleanisUsable()Tells whether the file can serve as a definition: it sets a validname.Finds a member by its ID, exactly as written.booleanTells whether another parse defines the same election: the same policy and the same members in the same order (ID, URL and flag, wherever the lines are).
Field Details
name
The hub's name, null when the file does not set a valid one: the file is then not usable.policy
The election policy.lease
public final int leaseThe lease, in seconds.margin
public final int marginThe margin a challenger waits beyond the lease, in seconds.grace
public final int graceThe fail-open grace, in seconds.hold
public final int holdThe hold of a switched client, in seconds.keyPath
The path of the interim cluster key file as written, null when not set.members
The members in file order, which is the priority order.origins
diagnostics
The diagnostics, in file order, the whole-file ones last.
Method Details
hasSevere
public boolean hasSevere()Tells whether any line or value was refused.- Returns:
- true when a SEVERE diagnostic is present.
isUsable
public boolean isUsable()Tells whether the file can serve as a definition: it sets a validname.- Returns:
- true when usable.
member
Finds a member by its ID, exactly as written.- Parameters:
id- The member ID.- Returns:
- The member, or null when not named.
indexOf
Gets the position of a member in the priority order.- Parameters:
id- The member ID.- Returns:
- The zero-based index, or -1 when not named.
eligible
Gets the eligible members: those flaggedprincipal, in priority order.- Returns:
- The list, never null.
sameElection
Tells whether another parse defines the same election: the same policy and the same members in the same order (ID, URL and flag, wherever the lines are).- Parameters:
other- The other parse.- Returns:
- true when an election would read the same from both.