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 of UIDSequencer.

We use MongoDB upsert feature to provide a sequencer.

Since:
9.1
  • Field Details

  • Constructor Details

    • MongoDBUIDSequencer

      public MongoDBUIDSequencer()
  • Method Details

    • init

      public void init()
      Description copied from interface: UIDSequencer
      Init Sequencer
    • initSequence

      public void initSequence(String key, long id)
      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 interface UIDSequencer
      Overrides:
      initSequence in class AbstractUIDSequencer
    • getSequencerCollection

      public com.mongodb.client.MongoCollection<org.bson.Document> getSequencerCollection()
    • getNextLong

      public long getNextLong(String key)
      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

      public List<Long> getNextBlock(String key, int blockSize)
      Description copied from interface: UIDSequencer
      Returns a block containing blockSize sequences.
    • incrementBy

      protected long incrementBy(String key, int value)
    • dispose

      public void dispose()
      Description copied from interface: UIDSequencer
      Cleanup callback