Class StatsTrack

java.lang.Object
org.apache.zookeeper.StatsTrack

public class StatsTrack extends Object
a class that represents the stats associated with quotas
  • Constructor Details

    • StatsTrack

      public StatsTrack()
      a default constructor for stats
    • StatsTrack

      public StatsTrack(byte[] stat)
      Parameters:
      stat - the byte[] stat to be initialized with
    • StatsTrack

      public StatsTrack(String stat)
      the stat string should be of the form key1str=long,key2str=long,.. where either , or ; are valid separators uninitialized values are returned as -1
      Parameters:
      stat - the stat string to be initialized with
  • Method Details

    • isValidStatsData

      public static boolean isValidStatsData(byte[] data)
      Strictly validate that data is a well-formed stats/limits value, i.e. a (possibly empty) list of key=long pairs separated by , or ;. Unlike the constructor, this performs no repair — it is used at request-preparation time to reject malformed writes to the quota zookeeper_stats/zookeeper_limits nodes before they are ever committed, so clients get a clear error and the quota bookkeeping never ingests garbage.
      Parameters:
      data - the candidate node data (UTF-8 encoded); empty is accepted (treated as uninitialized), null is rejected
      Returns:
      true if the data parses cleanly as StatsTrack content
    • getCount

      public long getCount()
      get the count of nodes allowed as part of quota
      Returns:
      the count as part of this string
    • setCount

      public void setCount(long count)
      set the count for this stat tracker.
      Parameters:
      count - the count to set with
    • getCountHardLimit

      public long getCountHardLimit()
      get the count of nodes allowed as part of quota (hard limit)
      Returns:
      the count as part of this string
    • setCountHardLimit

      public void setCountHardLimit(long count)
      set the count hard limit
      Parameters:
      count - the count limit to set
    • getBytes

      public long getBytes()
      get the count of bytes allowed as part of quota
      Returns:
      the bytes as part of this string
    • setBytes

      public void setBytes(long bytes)
      set the bytes for this stat tracker.
      Parameters:
      bytes - the bytes to set with
    • getByteHardLimit

      public long getByteHardLimit()
      get the count of bytes allowed as part of quota (hard limit)
      Returns:
      the bytes as part of this string
    • setByteHardLimit

      public void setByteHardLimit(long bytes)
      set the byte hard limit
      Parameters:
      bytes - the byte limit to set
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getStatsBytes

      public byte[] getStatsBytes()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object