Record Class ConfigEntry

java.lang.Object
java.lang.Record
com.loomcache.server.config.ConfigEntry
Record Components:
key - the configuration key (e.g., "cache.max-size")
value - the configuration value as a string
version - monotonically increasing version number for this key
updatedAt - timestamp (millis since epoch) when last updated
updatedBy - node ID or user that made the update

public record ConfigEntry(String key, String value, long version, long updatedAt, String updatedBy) extends Record
Immutable configuration entry with version tracking and audit information.

Records cluster-wide configuration changes with version numbers and update metadata. Used for distributed storage and replication via Raft.

  • Constructor Details

    • ConfigEntry

      public ConfigEntry(String key, String value, long version, long updatedAt, String updatedBy)
      Creates an instance of a ConfigEntry record class.
      Parameters:
      key - the value for the key record component
      value - the value for the value record component
      version - the value for the version record component
      updatedAt - the value for the updatedAt record component
      updatedBy - the value for the updatedBy record component
  • Method Details

    • create

      public static ConfigEntry create(String key, String value, long version, String updatedBy)
      Create a new ConfigEntry with current timestamp.
      Parameters:
      key - the configuration key
      value - the configuration value
      version - the version number
      updatedBy - the node ID or user
      Returns:
      a new ConfigEntry
    • update

      public static ConfigEntry update(ConfigEntry oldEntry, String newValue, String updatedBy)
      Create a ConfigEntry from an existing entry with an incremented version.
      Parameters:
      oldEntry - the existing entry
      newValue - the new value
      updatedBy - the updater identifier
      Returns:
      a new ConfigEntry with incremented version
    • 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.
    • key

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

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

      public long version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • updatedAt

      public long updatedAt()
      Returns the value of the updatedAt record component.
      Returns:
      the value of the updatedAt record component
    • updatedBy

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