Package org.nuxeo.elasticsearch.seqgen
Class ESUIDSequencer
java.lang.Object
org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
org.nuxeo.elasticsearch.seqgen.ESUIDSequencer
- All Implemented Interfaces:
UIDSequencer
Elasticsearch implementation of
UIDSequencer
.
Since elasticsearch does not seem to support a notion of native sequence, the implementation uses the auto-increment of the version attribute as described in the ElasticSearch::Sequence - a blazing fast ticket server blog post.
- Since:
- 7.3
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
name
Fields inherited from interface org.nuxeo.ecm.core.uidgen.UIDSequencer
SEQUENCE_DOES_NOT_EXIST
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Cleanup callbacklong
getCurrent
(String sequenceName) getKeys()
getNextBlock
(String key, int blockSize) Returns a block containingblockSize
sequences.protected long
getNextBlockWithRetry
(String key, int blockSize) long
getNextLong
(String sequenceName) For the given key returns the incremented UID which is also stored in the same sequence entry.void
init()
Init Sequencervoid
initSequence
(String key, long id) Initializes the sequencer with the given key to at least the given long id.protected static void
validateKey
(String key) Methods inherited from class org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
getName, setName
-
Field Details
-
MAX_RETRY
protected static final int MAX_RETRY- See Also:
-
esClient
-
indexName
-
-
Constructor Details
-
ESUIDSequencer
public ESUIDSequencer()
-
-
Method Details
-
init
public void init()Description copied from interface:UIDSequencer
Init Sequencer -
dispose
public void dispose()Description copied from interface:UIDSequencer
Cleanup callback -
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
-
getKeys
- Returns:
- all keys known to this sequencer
-
getCurrent
- Returns:
- the current sequence value for the given key, or
UIDSequencer.SEQUENCE_DOES_NOT_EXIST
if the sequence doesn't exist
-
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. -
getNextBlockWithRetry
-
validateKey
-