Record Class LogStats

java.lang.Object
java.lang.Record
com.loomcache.server.consensus.LogStats
Record Components:
size - Number of entries in memory (including sentinel)
firstIndex - The index of the first entry in memory (usually 1 or lastSnapshotIndex + 1)
lastIndex - The highest index in the log (accounting for snapshots)
committedIndex - The highest index known to be committed (0 if none)
compactedUpTo - The index of the last snapshot (0 if no snapshot)
totalAppends - Total number of append operations performed
totalCompactions - Total number of compaction operations performed
sizeInBytes - Approximate memory usage in bytes

public record LogStats(int size, long firstIndex, long lastIndex, long committedIndex, long compactedUpTo, long totalAppends, long totalCompactions, long sizeInBytes) extends Record
Statistics snapshot of the RaftLog state.

Captures a point-in-time view of log metrics including size, indices, and operation counts.

  • Constructor Details

    • LogStats

      public LogStats(int size, long firstIndex, long lastIndex, long committedIndex, long compactedUpTo, long totalAppends, long totalCompactions, long sizeInBytes)
      Creates an instance of a LogStats record class.
      Parameters:
      size - the value for the size record component
      firstIndex - the value for the firstIndex record component
      lastIndex - the value for the lastIndex record component
      committedIndex - the value for the committedIndex record component
      compactedUpTo - the value for the compactedUpTo record component
      totalAppends - the value for the totalAppends record component
      totalCompactions - the value for the totalCompactions record component
      sizeInBytes - the value for the sizeInBytes record component
  • 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. All components in this record class 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.
    • size

      public int size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • firstIndex

      public long firstIndex()
      Returns the value of the firstIndex record component.
      Returns:
      the value of the firstIndex record component
    • lastIndex

      public long lastIndex()
      Returns the value of the lastIndex record component.
      Returns:
      the value of the lastIndex record component
    • committedIndex

      public long committedIndex()
      Returns the value of the committedIndex record component.
      Returns:
      the value of the committedIndex record component
    • compactedUpTo

      public long compactedUpTo()
      Returns the value of the compactedUpTo record component.
      Returns:
      the value of the compactedUpTo record component
    • totalAppends

      public long totalAppends()
      Returns the value of the totalAppends record component.
      Returns:
      the value of the totalAppends record component
    • totalCompactions

      public long totalCompactions()
      Returns the value of the totalCompactions record component.
      Returns:
      the value of the totalCompactions record component
    • sizeInBytes

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