Class MongoDBUIDSequencer
- java.lang.Object
-
- org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
-
- org.nuxeo.ecm.core.mongodb.seqgen.MongoDBUIDSequencer
-
- All Implemented Interfaces:
UIDSequencer
public class MongoDBUIDSequencer extends AbstractUIDSequencer
MongoDB implementation ofUIDSequencer.We use MongoDB upsert feature to provide a sequencer.
- Since:
- 9.1
-
-
Field Summary
Fields Modifier and Type Field Description protected com.mongodb.client.MongoCollection<org.bson.Document>collstatic StringCOLLECTION_NAME_PROPERTYstatic StringDEFAULT_COLLECTION_NAMEstatic StringSEQUENCE_DATABASE_IDstatic StringSEQUENCE_VALUE_FIELD-
Fields inherited from class org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
name
-
-
Constructor Summary
Constructors Constructor Description MongoDBUIDSequencer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Cleanup callbackList<Long>getNextBlock(String key, int blockSize)Returns a block containingblockSizesequences.longgetNextLong(String key)ExtendsUIDSequencer.getNext(java.lang.String)to return a long value.com.mongodb.client.MongoCollection<org.bson.Document>getSequencerCollection()protected longincrementBy(String key, int value)voidinit()Init SequencervoidinitSequence(String key, long id)Initializes the sequencer with the given key to at least the given long id.-
Methods inherited from class org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
getName, getNext, initSequence, setName
-
-
-
-
Field Detail
-
SEQUENCE_DATABASE_ID
public static final String SEQUENCE_DATABASE_ID
- See Also:
- Constant Field Values
-
COLLECTION_NAME_PROPERTY
public static final String COLLECTION_NAME_PROPERTY
- See Also:
- Constant Field Values
-
DEFAULT_COLLECTION_NAME
public static final String DEFAULT_COLLECTION_NAME
- See Also:
- Constant Field Values
-
SEQUENCE_VALUE_FIELD
public static final String SEQUENCE_VALUE_FIELD
- See Also:
- Constant Field Values
-
coll
protected com.mongodb.client.MongoCollection<org.bson.Document> coll
-
-
Method Detail
-
init
public void init()
Description copied from interface:UIDSequencerInit Sequencer
-
initSequence
public void initSequence(String key, long id)
Description copied from interface:UIDSequencerInitializes the sequencer with the given key to at least the given long id.A sequence can only be incremented, so if its current id is greater than the given id the sequence won't be decremented to reach the given id.
- Specified by:
initSequencein interfaceUIDSequencer- Overrides:
initSequencein classAbstractUIDSequencer
-
getSequencerCollection
public com.mongodb.client.MongoCollection<org.bson.Document> getSequencerCollection()
-
getNextLong
public long getNextLong(String key)
Description copied from interface:UIDSequencerExtendsUIDSequencer.getNext(java.lang.String)to return a long value. This method is compatible with getNext in the integer range.
-
getNextBlock
public List<Long> getNextBlock(String key, int blockSize)
Description copied from interface:UIDSequencerReturns a block containingblockSizesequences.
-
incrementBy
protected long incrementBy(String key, int value)
-
dispose
public void dispose()
Description copied from interface:UIDSequencerCleanup callback
-
-