Package me.ahoo.cosid.segment
Interface IdSegment
- All Superinterfaces:
Comparable<IdSegment>
,Grouped
- All Known Implementing Classes:
DefaultIdSegment
,IdSegmentChain
,MergedIdSegment
Id Segment.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
static final long
-
Method Summary
Modifier and TypeMethodDescriptiondefault int
default void
ensureNextIdSegment
(IdSegment nextIdSegment) long
ID segment fetch time.long
getMaxId()
long
long
long
getStep()
default long
getTtl()
the id segment time to live.long
default boolean
not expired and not overflow.default boolean
id segment has expired?.default boolean
default boolean
isOverflow
(long nextSeq)
-
Field Details
-
SEQUENCE_OVERFLOW
static final long SEQUENCE_OVERFLOW- See Also:
-
TIME_TO_LIVE_FOREVER
static final long TIME_TO_LIVE_FOREVER- See Also:
-
-
Method Details
-
getFetchTime
long getFetchTime()ID segment fetch time. unitTimeUnit.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. unitTimeUnit.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
- Specified by:
compareTo
in interfaceComparable<IdSegment>
-
ensureNextIdSegment
- Throws:
NextIdSegmentExpiredException
-