Record Class JournalEntry

java.lang.Object
java.lang.Record
com.loomcache.server.journal.JournalEntry
Record Components:
sequence - Monotonically increasing sequence number
timestamp - Event creation time in nanoseconds
eventType - Type classifier for the event
key - Key associated with the event (may be null)
payload - Event payload as bytes (may be empty)
metadata - Optional metadata (never null, may be empty)

public record JournalEntry(long sequence, long timestamp, String eventType, String key, byte[] payload, Map<String,String> metadata) extends Record
Represents a single entry in the distributed event journal.

Each entry is immutable and contains:

  • sequence: Monotonically increasing identifier
  • timestamp: Creation time in nanoseconds
  • eventType: Type classifier for the event
  • key: Associated key (may be null)
  • payload: Event data as bytes
  • metadata: Optional key-value pairs
Since:
1.0
  • Constructor Details

    • JournalEntry

      public JournalEntry(long sequence, long timestamp, String eventType, String key, byte[] payload, Map<String,String> metadata)
      Creates an instance of a JournalEntry record class.
      Parameters:
      sequence - the value for the sequence record component
      timestamp - the value for the timestamp record component
      eventType - the value for the eventType record component
      key - the value for the key record component
      payload - the value for the payload record component
      metadata - the value for the metadata record component
  • Method Details

    • payload

      public byte[] payload()
      Returns the value of the payload record component.
      Returns:
      the value of the payload record component
    • toString

      public String toString()
      Compact representation for logging and debugging.
      Specified by:
      toString in class Record
      Returns:
      formatted string with key fields
    • 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.
    • sequence

      public long sequence()
      Returns the value of the sequence record component.
      Returns:
      the value of the sequence record component
    • timestamp

      public long timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • eventType

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

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

      public Map<String,String> metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component