Record Class NetworkConsensusConfig
java.lang.Object
java.lang.Record
org.j7m.middleware.consensus.NetworkConsensusConfig
- Record Components:
nodeId- local identity, present in peerspeers- authorized identities and fixed endpoints, including learnersinitialMembers- initial voters used only on first bootstrapdirectory- exclusively owned durable directoryauthenticationKey- at least 32 secret byteselectionTimeout- minimum election timeout, at least 150 msheartbeatInterval- heartbeat interval, positive and less than one third of election timeoutmaxFrameBytes- maximum authenticated frame bytes, at least 4096maxSnapshotBytes- maximum application snapshot bytes, at least maxFrameBytestlsContext- mutual TLS context, or null only for loopback developmentgroupId- stable group identity, distinct for independent replication groups
public record NetworkConsensusConfig(String nodeId, Map<String, InetSocketAddress> peers, Set<String> initialMembers, Path directory, byte[] authenticationKey, Duration electionTimeout, Duration heartbeatInterval, int maxFrameBytes, int maxSnapshotBytes, SSLContext tlsContext, String groupId)
extends Record
Immutable bootstrap and bounded authenticated transport settings. The shared authentication
key grants full peer authority and must come from protected deployment configuration. Non-loopback endpoints require mutual TLS. A null TLS context is a loopback-only
development profile; its HMAC authenticated frames are not encrypted.
Discovery never changes the voting set. A nonvoter may start as a learner.
-
Constructor Summary
ConstructorsConstructorDescriptionNetworkConsensusConfig(String nodeId, Map<String, InetSocketAddress> peers, Set<String> initialMembers, Path directory, byte[] authenticationKey, Duration electionTimeout, Duration heartbeatInterval, int maxFrameBytes, int maxSnapshotBytes) Creates a loopback-only authenticated development profile.NetworkConsensusConfig(String nodeId, Map<String, InetSocketAddress> peers, Set<String> initialMembers, Path directory, byte[] authenticationKey, Duration electionTimeout, Duration heartbeatInterval, int maxFrameBytes, int maxSnapshotBytes, SSLContext tlsContext) Creates a group whose identity is derived from its immutable authorized endpoint roster.NetworkConsensusConfig(String nodeId, Map<String, InetSocketAddress> peers, Set<String> initialMembers, Path directory, byte[] authenticationKey, Duration electionTimeout, Duration heartbeatInterval, int maxFrameBytes, int maxSnapshotBytes, SSLContext tlsContext, String groupId) Validates and defensively copies settings. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Returns an independent secret copy.Returns the value of thedirectoryrecord component.Returns the value of theelectionTimeoutrecord component.final booleanIndicates whether some other object is "equal to" this one.groupId()Returns the value of thegroupIdrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theheartbeatIntervalrecord component.Returns the value of theinitialMembersrecord component.intReturns the value of themaxFrameBytesrecord component.intReturns the value of themaxSnapshotBytesrecord component.nodeId()Returns the value of thenodeIdrecord component.peers()Returns the value of thepeersrecord component.Returns the value of thetlsContextrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
NetworkConsensusConfig
public NetworkConsensusConfig(String nodeId, Map<String, InetSocketAddress> peers, Set<String> initialMembers, Path directory, byte[] authenticationKey, Duration electionTimeout, Duration heartbeatInterval, int maxFrameBytes, int maxSnapshotBytes, SSLContext tlsContext, String groupId) Validates and defensively copies settings.- Parameters:
nodeId- local identitypeers- authorized endpointsinitialMembers- initial electoratedirectory- durable storageauthenticationKey- shared secretelectionTimeout- minimum election timeoutheartbeatInterval- heartbeat periodmaxFrameBytes- frame byte limitmaxSnapshotBytes- snapshot byte limittlsContext- mutual TLS context or null on loopbackgroupId- stable replication group identity- Throws:
IllegalArgumentException- if settings violate bounds
-
NetworkConsensusConfig
public NetworkConsensusConfig(String nodeId, Map<String, InetSocketAddress> peers, Set<String> initialMembers, Path directory, byte[] authenticationKey, Duration electionTimeout, Duration heartbeatInterval, int maxFrameBytes, int maxSnapshotBytes) Creates a loopback-only authenticated development profile.- Parameters:
nodeId- local identitypeers- authorized loopback endpointsinitialMembers- bootstrap votersdirectory- storage directoryauthenticationKey- shared secretelectionTimeout- election timeoutheartbeatInterval- heartbeat intervalmaxFrameBytes- frame size limitmaxSnapshotBytes- snapshot size limit
-
NetworkConsensusConfig
public NetworkConsensusConfig(String nodeId, Map<String, InetSocketAddress> peers, Set<String> initialMembers, Path directory, byte[] authenticationKey, Duration electionTimeout, Duration heartbeatInterval, int maxFrameBytes, int maxSnapshotBytes, SSLContext tlsContext) Creates a group whose identity is derived from its immutable authorized endpoint roster.- Parameters:
nodeId- local identitypeers- authorized endpoints, identical on every memberinitialMembers- bootstrap electoratedirectory- storage directoryauthenticationKey- shared secretelectionTimeout- minimum election timeoutheartbeatInterval- heartbeat intervalmaxFrameBytes- frame limitmaxSnapshotBytes- snapshot limittlsContext- mutual TLS context or null for loopback
-
-
Method Details
-
authenticationKey
public byte[] authenticationKey()Returns an independent secret copy.- Returns:
- authentication key copy
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
nodeId
-
peers
-
initialMembers
Returns the value of theinitialMembersrecord component.- Returns:
- the value of the
initialMembersrecord component
-
directory
-
electionTimeout
Returns the value of theelectionTimeoutrecord component.- Returns:
- the value of the
electionTimeoutrecord component
-
heartbeatInterval
Returns the value of theheartbeatIntervalrecord component.- Returns:
- the value of the
heartbeatIntervalrecord component
-
maxFrameBytes
public int maxFrameBytes()Returns the value of themaxFrameBytesrecord component.- Returns:
- the value of the
maxFrameBytesrecord component
-
maxSnapshotBytes
public int maxSnapshotBytes()Returns the value of themaxSnapshotBytesrecord component.- Returns:
- the value of the
maxSnapshotBytesrecord component
-
tlsContext
Returns the value of thetlsContextrecord component.- Returns:
- the value of the
tlsContextrecord component
-
groupId
-