Interface IdSegment

All Superinterfaces:
Comparable<IdSegment>, Grouped
All Known Implementing Classes:
DefaultIdSegment, IdSegmentChain, MergedIdSegment

@ThreadSafe public interface IdSegment extends Comparable<IdSegment>, Grouped
Id Segment.

SegmentId

  • Field Details

  • Method Details

    • getFetchTime

      long getFetchTime()
      ID segment fetch time. unit TimeUnit.SECONDS
      Returns:
      fetch time
    • getMaxId

      long getMaxId()
    • getOffset

      long getOffset()
    • getSequence

      long getSequence()
    • getStep

      long getStep()
    • getTtl

      default long getTtl()
      the id segment time to live. unit TimeUnit.SECONDS
      Returns:
      time to live
    • isExpired

      default boolean isExpired()
      id segment has expired?.
      Returns:
      expired?
    • isOverflow

      default boolean isOverflow()
    • isOverflow

      default boolean isOverflow(long nextSeq)
    • isAvailable

      default boolean isAvailable()
      not expired and not overflow.
      Returns:
      true when not expired and not overflow
    • incrementAndGet

      long incrementAndGet()
    • compareTo

      default int compareTo(IdSegment other)
      Specified by:
      compareTo in interface Comparable<IdSegment>
    • ensureNextIdSegment

      default void ensureNextIdSegment(IdSegment nextIdSegment) throws NextIdSegmentExpiredException
      Throws:
      NextIdSegmentExpiredException