Class KVStoreManagerImpl

java.lang.Object
io.vertigo.datastore.impl.kvstore.KVStoreManagerImpl
All Implemented Interfaces:
io.vertigo.core.node.component.Component, io.vertigo.core.node.component.CoreComponent, io.vertigo.core.node.component.Manager, KVStoreManager

public final class KVStoreManagerImpl extends Object implements KVStoreManager
Standard implementation of the Key-Value DataBase.
Author:
pchretien
  • Constructor Details

    • KVStoreManagerImpl

      @Inject public KVStoreManagerImpl(List<KVStorePlugin> kvStorePlugins)
      Constructor.
      Parameters:
      kvStorePlugins - kvStore list
  • Method Details

    • count

      public int count(KVCollection collection)
      Specified by:
      count in interface KVStoreManager
      Parameters:
      collection - the collection
      Returns:
      count of elements into collection
    • put

      public void put(KVCollection collection, String id, Object element)
      Adds an element defined by an id in a collection.
      Specified by:
      put in interface KVStoreManager
      Parameters:
      collection - the collection
      id - the id
      element - the element
    • remove

      public void remove(KVCollection collection, String id)
      Removes an element defined by an id from a collection. If the collection doesn't contain the is then a exception is thrown.
      Specified by:
      remove in interface KVStoreManager
      Parameters:
      collection - the collection
      id - the id
    • removeIfExists

      public boolean removeIfExists(KVCollection collection, String id)
      Removes an element defined by an id from a collection.
      Specified by:
      removeIfExists in interface KVStoreManager
      Parameters:
      collection - the collection
      id - the id
      Returns:
      if remove has been applied
    • clear

      public void clear(KVCollection collection)
      Removes all elements from a collection.
      Specified by:
      clear in interface KVStoreManager
      Parameters:
      collection - the collection
    • find

      public <C> Optional<C> find(KVCollection collection, String id, Class<C> clazz)
      Finds the optional element to which the id is mapped inside the specified collection. If the element is not found then an empty option is returned.
      Specified by:
      find in interface KVStoreManager
      Type Parameters:
      C - Element type
      Parameters:
      collection - the collection
      id - the id
      clazz - the type of the searched element
      Returns:
      the option
    • findAll

      public <C> List<C> findAll(KVCollection collection, int skip, Integer limit, Class<C> clazz)
      Finds all elements contained inside the specified collection. *
      Specified by:
      findAll in interface KVStoreManager
      Type Parameters:
      C - Element type
      Parameters:
      collection - the collection
      skip - the position from which the elements are returned
      limit - the limit size of elements
      clazz - the type of the searched element
      Returns:
      the list of elements.