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 stringversion- monotonically increasing version number for this keyupdatedAt- timestamp (millis since epoch) when last updatedupdatedBy- 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 Summary
ConstructorsConstructorDescriptionConfigEntry(String key, String value, long version, long updatedAt, String updatedBy) Creates an instance of aConfigEntryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigEntryCreate a new ConfigEntry with current timestamp.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.final StringtoString()Returns a string representation of this record class.static ConfigEntryupdate(ConfigEntry oldEntry, String newValue, String updatedBy) Create a ConfigEntry from an existing entry with an incremented version.longReturns the value of theupdatedAtrecord component.Returns the value of theupdatedByrecord component.value()Returns the value of thevaluerecord component.longversion()Returns the value of theversionrecord component.
-
Constructor Details
-
ConfigEntry
Creates an instance of aConfigEntryrecord class.
-
-
Method Details
-
create
Create a new ConfigEntry with current timestamp.- Parameters:
key- the configuration keyvalue- the configuration valueversion- the version numberupdatedBy- the node ID or user- Returns:
- a new ConfigEntry
-
update
Create a ConfigEntry from an existing entry with an incremented version.- Parameters:
oldEntry- the existing entrynewValue- the new valueupdatedBy- the updater identifier- Returns:
- a new ConfigEntry with incremented version
-
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. -
key
-
value
-
version
-
updatedAt
-
updatedBy
-