Record Class RetentionPolicy

java.lang.Object
java.lang.Record
org.j7m.middleware.api.durablelog.RetentionPolicy
Record Components:
mode - retention mode
maxBytes - maximum retained bytes for size retention
maxAge - maximum retained age for age retention
All Implemented Interfaces:
Serializable

public record RetentionPolicy(RetentionPolicy.RetentionMode mode, long maxBytes, Duration maxAge) extends Record implements Serializable
Durable-log retention policy.
See Also:
  • Constructor Details

  • Method Details

    • disabled

      public static RetentionPolicy disabled()
      Disabled retention.
      Returns:
      disabled retention policy
    • maxBytes

      public static RetentionPolicy maxBytes(long bytes)
      Size-based retention.
      Parameters:
      bytes - maximum retained bytes
      Returns:
      size-based retention policy
    • maxAge

      public static RetentionPolicy maxAge(Duration age)
      Age-based retention.
      Parameters:
      age - maximum retained age
      Returns:
      age-based retention policy
    • 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. 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.
    • mode

      Returns the value of the mode record component.
      Returns:
      the value of the mode record component
    • maxBytes

      public long maxBytes()
      Returns the value of the maxBytes record component.
      Returns:
      the value of the maxBytes record component
    • maxAge

      public Duration maxAge()
      Returns the value of the maxAge record component.
      Returns:
      the value of the maxAge record component