Class ExpiringRangeCursor

java.lang.Object
me.ahoo.cosid.internal.RangeCursor
me.ahoo.cosid.internal.ExpiringRangeCursor

public final class ExpiringRangeCursor extends RangeCursor
A cursor with a deadline, for BatchPolicy.rangeTtl (04-segment.md ยง2): past it the rest of the range is dropped. A separate class, so generators without a time to live pay nothing for it.
  • Constructor Details

    • ExpiringRangeCursor

      public ExpiringRangeCursor(long start, long end, long expiresAtMillis, TimeSource time)
      A cursor on [start, end) until expiresAtMillis.
      Parameters:
      start - the first value
      end - the end, exclusive, already capped
      expiresAtMillis - from this time on nothing is issued
      time - the time source
  • Method Details

    • expiresAtMillis

      public long expiresAtMillis()
    • take

      public long take()
      Description copied from class: RangeCursor
      Takes the next value.
      Overrides:
      take in class RangeCursor
      Returns:
      the value, or -1 if the cursor is used up (or expired)
    • remaining

      public long remaining(long nowMillis)
      Description copied from class: RangeCursor
      The values not taken yet.
      Overrides:
      remaining in class RangeCursor
      Parameters:
      nowMillis - the current time
      Returns:
      the values left, 0 if none or expired