Class KeyValueStoreUIDSequencer

java.lang.Object
org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
org.nuxeo.ecm.core.uidgen.KeyValueStoreUIDSequencer
All Implemented Interfaces:
UIDSequencer

public class KeyValueStoreUIDSequencer extends AbstractUIDSequencer
UID Sequencer based on a key/value store. The store is the same for all sequencers, but they are using different keys, prefixed by the sequencer name.
Since:
10.2
  • Field Details

  • Constructor Details

    • KeyValueStoreUIDSequencer

      public KeyValueStoreUIDSequencer()
  • Method Details

    • init

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

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

      protected KeyValueStore getStore()
    • getKey

      protected String getKey(String key)
    • 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
    • getKeys

      public List<String> getKeys()
      Returns:
      all keys known to this sequencer
    • getCurrent

      public long getCurrent(String key)
      Returns:
      the current sequence value for the given key, or UIDSequencer.SEQUENCE_DOES_NOT_EXIST if the sequence doesn't exist
    • 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.