Package io.eventuate.common.id
Class DatabaseIdGenerator
- java.lang.Object
-
- io.eventuate.common.id.DatabaseIdGenerator
-
- All Implemented Interfaces:
IdGenerator
public class DatabaseIdGenerator extends java.lang.Object implements IdGenerator
-
-
Field Summary
Fields Modifier and Type Field Description static longCOUNTER_MAX_VALUEstatic longSERVICE_ID_MAX_VALUE
-
Constructor Summary
Constructors Constructor Description DatabaseIdGenerator(long serviceId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandatabaseIdRequired()Int128genId(java.lang.Long databaseId, java.lang.Integer partitionOffset)java.util.Optional<Int128>incrementIdIfPossible(Int128 anchorId)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.eventuate.common.id.IdGenerator
genId, genIdAsString, genIdAsString
-
-
-
-
Field Detail
-
SERVICE_ID_MAX_VALUE
public static final long SERVICE_ID_MAX_VALUE
- See Also:
- Constant Field Values
-
COUNTER_MAX_VALUE
public static final long COUNTER_MAX_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
databaseIdRequired
public boolean databaseIdRequired()
- Specified by:
databaseIdRequiredin interfaceIdGenerator
-
genId
public Int128 genId(java.lang.Long databaseId, java.lang.Integer partitionOffset)
- Specified by:
genIdin interfaceIdGenerator
-
incrementIdIfPossible
public java.util.Optional<Int128> incrementIdIfPossible(Int128 anchorId)
- Specified by:
incrementIdIfPossiblein interfaceIdGenerator
-
-