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
public class ESUIDSequencer extends AbstractUIDSequencer
Elasticsearch implementation ofUIDSequencer.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
-
-
Constructor Summary
Constructors Constructor Description ESUIDSequencer()
-
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.protected longgetNextBlockWithRetry(String key, int blockSize)longgetNextLong(String sequenceName)ExtendsUIDSequencer.getNext(java.lang.String)to return a long 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
-
MAX_RETRY
protected static final int MAX_RETRY
- See Also:
- Constant Field Values
-
esClient
protected ESClient esClient
-
indexName
protected String indexName
-
-
Method Detail
-
init
public void init()
Description copied from interface:UIDSequencerInit Sequencer
-
dispose
public void dispose()
Description copied from interface:UIDSequencerCleanup callback
-
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
-
getNextLong
public long getNextLong(String sequenceName)
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.
-
getNextBlockWithRetry
protected long getNextBlockWithRetry(String key, int blockSize)
-
-