Class MongoDBUIDSequencer
java.lang.Object
org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
org.nuxeo.ecm.core.mongodb.seqgen.MongoDBUIDSequencer
- All Implemented Interfaces:
UIDSequencer
MongoDB implementation of
UIDSequencer
.
We use MongoDB upsert feature to provide a sequencer.
- Since:
- 9.1
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.mongodb.client.MongoCollection<org.bson.Document>
static final String
static final String
protected static final int
static final String
static final String
Fields inherited from class org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Cleanup callbackgetNextBlock
(String key, int blockSize) Returns a block containingblockSize
sequences.long
getNextLong
(String key) For the given key returns the incremented UID which is also stored in the same sequence entry.com.mongodb.client.MongoCollection<org.bson.Document>
protected long
incrementBy
(String key, int value) void
init()
Init Sequencervoid
initSequence
(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, setName
-
Field Details
-
SEQUENCE_DATABASE_ID
- See Also:
-
COLLECTION_NAME_PROPERTY
- See Also:
-
DEFAULT_COLLECTION_NAME
- See Also:
-
SEQUENCE_VALUE_FIELD
- See Also:
-
ERROR_IMMUTABLE_FIELD
protected static final int ERROR_IMMUTABLE_FIELD- See Also:
-
coll
protected com.mongodb.client.MongoCollection<org.bson.Document> coll
-
-
Constructor Details
-
MongoDBUIDSequencer
public MongoDBUIDSequencer()
-
-
Method Details
-
init
public void init()Description copied from interface:UIDSequencer
Init Sequencer -
initSequence
Description copied from interface:UIDSequencer
Initializes 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:
initSequence
in interfaceUIDSequencer
- Overrides:
initSequence
in classAbstractUIDSequencer
-
getSequencerCollection
public com.mongodb.client.MongoCollection<org.bson.Document> getSequencerCollection() -
getNextLong
Description copied from interface:UIDSequencer
For the given key returns the incremented UID which is also stored in the same sequence entry. This is a "one time use" function for a document. -
getNextBlock
Description copied from interface:UIDSequencer
Returns a block containingblockSize
sequences. -
incrementBy
-
dispose
public void dispose()Description copied from interface:UIDSequencer
Cleanup callback
-