Record Class MeterCounterData

java.lang.Object
java.lang.Record
io.github.zhh2001.jp4.entity.MeterCounterData
Record Components:
green - cumulative counter for green-marked packets
yellow - cumulative counter for yellow-marked packets
red - cumulative counter for red-marked packets

public record MeterCounterData(CounterData green, CounterData yellow, CounterData red) extends Record
Per-color cumulative packet and byte counters for one P4 meter cell. The three slots correspond to the green / yellow / red traffic-color marking defined by RFC 2697 (srTCM) and RFC 2698 (trTCM): a packet conforming to both the CIR and the CBurst is marked green, a packet exceeding the CIR but conforming to the PIR (trTCM) or the EBS (srTCM) is marked yellow, and a packet exceeding the PIR or the EBS is marked red.

The MeterCounterData message was added in P4Runtime v1.4.0; devices on older spec versions may return zero counters across the board. Each color slot is non-null — the record stores zero counters explicitly rather than null.

Since:
1.4.0
  • Constructor Details

    • MeterCounterData

      public MeterCounterData(CounterData green, CounterData yellow, CounterData red)
      Creates an instance of a MeterCounterData record class.
      Parameters:
      green - the value for the green record component
      yellow - the value for the yellow record component
      red - the value for the red 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 Objects::equals(Object,Object).
      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.
    • green

      public CounterData green()
      Returns the value of the green record component.
      Returns:
      the value of the green record component
    • yellow

      public CounterData yellow()
      Returns the value of the yellow record component.
      Returns:
      the value of the yellow record component
    • red

      public CounterData red()
      Returns the value of the red record component.
      Returns:
      the value of the red record component