Record Class NetworkConsensusConfig

java.lang.Object
java.lang.Record
org.j7m.middleware.consensus.NetworkConsensusConfig
Record Components:
nodeId - local identity, present in peers
peers - authorized identities and fixed endpoints, including learners
initialMembers - initial voters used only on first bootstrap
directory - exclusively owned durable directory
authenticationKey - at least 32 secret bytes
electionTimeout - minimum election timeout, at least 150 ms
heartbeatInterval - heartbeat interval, positive and less than one third of election timeout
maxFrameBytes - maximum authenticated frame bytes, at least 4096
maxSnapshotBytes - maximum application snapshot bytes, at least maxFrameBytes
tlsContext - mutual TLS context, or null only for loopback development
groupId - 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 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 identity
      peers - authorized endpoints
      initialMembers - initial electorate
      directory - durable storage
      authenticationKey - shared secret
      electionTimeout - minimum election timeout
      heartbeatInterval - heartbeat period
      maxFrameBytes - frame byte limit
      maxSnapshotBytes - snapshot byte limit
      tlsContext - mutual TLS context or null on loopback
      groupId - 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 identity
      peers - authorized loopback endpoints
      initialMembers - bootstrap voters
      directory - storage directory
      authenticationKey - shared secret
      electionTimeout - election timeout
      heartbeatInterval - heartbeat interval
      maxFrameBytes - frame size limit
      maxSnapshotBytes - 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 identity
      peers - authorized endpoints, identical on every member
      initialMembers - bootstrap electorate
      directory - storage directory
      authenticationKey - shared secret
      electionTimeout - minimum election timeout
      heartbeatInterval - heartbeat interval
      maxFrameBytes - frame limit
      maxSnapshotBytes - snapshot limit
      tlsContext - mutual TLS context or null for loopback
  • Method Details

    • authenticationKey

      public byte[] authenticationKey()
      Returns an independent secret copy.
      Returns:
      authentication key copy
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • nodeId

      public String nodeId()
      Returns the value of the nodeId record component.
      Returns:
      the value of the nodeId record component
    • peers

      public Map<String, InetSocketAddress> peers()
      Returns the value of the peers record component.
      Returns:
      the value of the peers record component
    • initialMembers

      public Set<String> initialMembers()
      Returns the value of the initialMembers record component.
      Returns:
      the value of the initialMembers record component
    • directory

      public Path directory()
      Returns the value of the directory record component.
      Returns:
      the value of the directory record component
    • electionTimeout

      public Duration electionTimeout()
      Returns the value of the electionTimeout record component.
      Returns:
      the value of the electionTimeout record component
    • heartbeatInterval

      public Duration heartbeatInterval()
      Returns the value of the heartbeatInterval record component.
      Returns:
      the value of the heartbeatInterval record component
    • maxFrameBytes

      public int maxFrameBytes()
      Returns the value of the maxFrameBytes record component.
      Returns:
      the value of the maxFrameBytes record component
    • maxSnapshotBytes

      public int maxSnapshotBytes()
      Returns the value of the maxSnapshotBytes record component.
      Returns:
      the value of the maxSnapshotBytes record component
    • tlsContext

      public SSLContext tlsContext()
      Returns the value of the tlsContext record component.
      Returns:
      the value of the tlsContext record component
    • groupId

      public String groupId()
      Returns the value of the groupId record component.
      Returns:
      the value of the groupId record component