Record Class MergePolicy.MergeEntry<V>

java.lang.Object
java.lang.Record
com.loomcache.server.wan.merge.MergePolicy.MergeEntry<V>
Type Parameters:
V - value type
Record Components:
value - the entry value (non-null — use an explicit tombstone if needed)
timestampMs - epoch millis of the write
writerNodeId - deterministic identifier of the writing node (non-null)
hitCount - successful read count for the entry (non-negative)
lastAccessTimeMs - epoch millis of the last successful read (non-negative, 0 when unknown)
expirationTimeMs - epoch millis when this entry expires, or MergePolicy.NO_EXPIRATION_TIME_MILLIS when it does not expire
Enclosing interface:
MergePolicy<K,V>

public static record MergePolicy.MergeEntry<V>(@NonNull V value, long timestampMs, @NonNull String writerNodeId, long hitCount, long lastAccessTimeMs, long expirationTimeMs) extends Record
A replication entry with timestamp, writer-id, read-hit, access-time, and expiration-time metadata for merge policies.

timestampMs is the wall-clock time (epoch millis) at which the write occurred on the originating cluster. writerNodeId is a deterministic identifier of the writer (e.g. the source cluster id for an incoming WAN event, or DistributedMap.getLocalWriterId() for an existing local value) used as a tie-breaker when two writes land on the same millisecond. hitCount is the number of successful reads recorded for the entry on the source that produced it, used by HigherHitsMergePolicy. lastAccessTimeMs is the epoch millis of the last successful read, used by LatestAccessMergePolicy. expirationTimeMs is the epoch millis at which the entry expires, or MergePolicy.NO_EXPIRATION_TIME_MILLIS for entries that do not expire, used by ExpirationTimeMergePolicy.

BLK-2026-04-22-011: replacing the prior long version field with a String writerNodeId is what gives LatestUpdateMergePolicy a deterministic same-millisecond tie-break — lexicographic ordering over writer ids is commutative across replicas, so two clusters seeing the same pair of events converge to the same winner regardless of arrival order.

Since:
2.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    MergeEntry(@NonNull V value, long timestampMs, @NonNull String writerNodeId)
    Backward-compatible constructor for policies that do not use hit metadata.
    MergeEntry(@NonNull V value, long timestampMs, @NonNull String writerNodeId, long hitCount)
    Backward-compatible constructor for policies that use hit metadata only.
    MergeEntry(@NonNull V value, long timestampMs, @NonNull String writerNodeId, long hitCount, long lastAccessTimeMs)
    Backward-compatible constructor for policies that use hit/access metadata.
    MergeEntry(@NonNull V value, long timestampMs, @NonNull String writerNodeId, long hitCount, long lastAccessTimeMs, long expirationTimeMs)
    Compact constructor — validates required fields and non-negative metadata.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    long
    Returns the value of the expirationTimeMs record component.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the hitCount record component.
    long
    Returns the value of the lastAccessTimeMs record component.
    long
    Returns the value of the timestampMs record component.
    final String
    Returns a string representation of this record class.
    @NonNull V
    Returns the value of the value record component.
    @NonNull String
    Returns the value of the writerNodeId record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MergeEntry

      public MergeEntry(@NonNull V value, long timestampMs, @NonNull String writerNodeId)
      Backward-compatible constructor for policies that do not use hit metadata.
    • MergeEntry

      public MergeEntry(@NonNull V value, long timestampMs, @NonNull String writerNodeId, long hitCount)
      Backward-compatible constructor for policies that use hit metadata only.
    • MergeEntry

      public MergeEntry(@NonNull V value, long timestampMs, @NonNull String writerNodeId, long hitCount, long lastAccessTimeMs)
      Backward-compatible constructor for policies that use hit/access metadata.
    • MergeEntry

      public MergeEntry(@NonNull V value, long timestampMs, @NonNull String writerNodeId, long hitCount, long lastAccessTimeMs, long expirationTimeMs)
      Compact constructor — validates required fields and non-negative metadata.
  • Method Details

    • 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.
    • value

      public @NonNull V value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • timestampMs

      public long timestampMs()
      Returns the value of the timestampMs record component.
      Returns:
      the value of the timestampMs record component
    • writerNodeId

      public @NonNull String writerNodeId()
      Returns the value of the writerNodeId record component.
      Returns:
      the value of the writerNodeId record component
    • hitCount

      public long hitCount()
      Returns the value of the hitCount record component.
      Returns:
      the value of the hitCount record component
    • lastAccessTimeMs

      public long lastAccessTimeMs()
      Returns the value of the lastAccessTimeMs record component.
      Returns:
      the value of the lastAccessTimeMs record component
    • expirationTimeMs

      public long expirationTimeMs()
      Returns the value of the expirationTimeMs record component.
      Returns:
      the value of the expirationTimeMs record component