Record Class WatchEvent
java.lang.Object
java.lang.Record
com.loomcache.server.watch.WatchEvent
- Record Components:
type- the event type (PUT or DELETE, must not be null)key- the key that was mutated (must not be null)value- the new value (null for DELETE events)prevValue- the previous value (null for new keys or DELETE events)revision- the global revision when this event occurred (must be positive)modRevision- the key's modification revision (must be positive)
public record WatchEvent(WatchEvent.Type type, String key, @Nullable String value, @Nullable String prevValue, long revision, long modRevision)
extends Record
A watch event representing a key mutation (put or delete).
Includes full MVCC revision information for consistent event ordering and causality tracking (similar to etcd watch events).
Thread-safe: This record is immutable and inherently thread-safe.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionWatchEvent(WatchEvent.Type type, String key, @Nullable String value, @Nullable String prevValue, long revision, long modRevision) Creates an instance of aWatchEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal 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.longReturns the value of themodRevisionrecord component.@Nullable StringReturns the value of theprevValuerecord component.longrevision()Returns the value of therevisionrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.@Nullable Stringvalue()Returns the value of thevaluerecord component.
-
Constructor Details
-
WatchEvent
public WatchEvent(WatchEvent.Type type, String key, @Nullable String value, @Nullable String prevValue, long revision, long modRevision) Creates an instance of aWatchEventrecord class.- Parameters:
type- the value for thetyperecord componentkey- the value for thekeyrecord componentvalue- the value for thevaluerecord componentprevValue- the value for theprevValuerecord componentrevision- the value for therevisionrecord componentmodRevision- the value for themodRevisionrecord component
-
-
Method Details
-
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. -
type
-
key
-
value
-
prevValue
-
revision
-
modRevision
public long modRevision()Returns the value of themodRevisionrecord component.- Returns:
- the value of the
modRevisionrecord component
-