Record Class TopologyAwareRouter.TopologyRouterStats

java.lang.Object
java.lang.Record
com.loomcache.server.cluster.TopologyAwareRouter.TopologyRouterStats
Record Components:
requestsByDistance - cumulative distance-weighted requests
localReads - number of reads routed locally (distance 0)
remoteReads - number of reads routed remotely
Enclosing class:
TopologyAwareRouter

public static record TopologyAwareRouter.TopologyRouterStats(long requestsByDistance, long localReads, long remoteReads) extends Record
Statistics for topology-aware routing.
Since:
1.0
  • Constructor Details

    • TopologyRouterStats

      public TopologyRouterStats(long requestsByDistance, long localReads, long remoteReads)
      Creates an instance of a TopologyRouterStats record class.
      Parameters:
      requestsByDistance - the value for the requestsByDistance record component
      localReads - the value for the localReads record component
      remoteReads - the value for the remoteReads record component
  • Method Details

    • getLocalReadPercentage

      public double getLocalReadPercentage()
      Calculate the percentage of local reads.
      Returns:
      percentage of local reads (0-100), or 0 if no reads
    • 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.
    • requestsByDistance

      public long requestsByDistance()
      Returns the value of the requestsByDistance record component.
      Returns:
      the value of the requestsByDistance record component
    • localReads

      public long localReads()
      Returns the value of the localReads record component.
      Returns:
      the value of the localReads record component
    • remoteReads

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