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 Summary
Constructors Constructor Description KVStoreManagerImpl(List<KVStorePlugin> kvStorePlugins)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear(String collection)Removes all elements from a collection.intcount(String collection)<C> Optional<C>find(String collection, String id, Class<C> clazz)Finds the optional element to which the id is mapped inside the specified collection.<C> List<C>findAll(String collection, int skip, Integer limit, Class<C> clazz)Finds all elements contained inside the specified collectionvoidput(String collection, String id, Object element)Adds an element defined by an id in a collection.voidremove(String collection, String id)Removes an element defined by an id from a collection.
-
-
-
Constructor Detail
-
KVStoreManagerImpl
@Inject public KVStoreManagerImpl(List<KVStorePlugin> kvStorePlugins)
Constructor.- Parameters:
kvStorePlugins- kvStore list
-
-
Method Detail
-
count
public int count(String collection)
- Specified by:
countin interfaceKVStoreManager- Parameters:
collection- the collection- Returns:
- count of elements into collection
-
put
public void put(String collection, String id, Object element)
Adds an element defined by an id in a collection.- Specified by:
putin interfaceKVStoreManager- Parameters:
collection- the collectionid- the idelement- the element
-
remove
public void remove(String 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:
removein interfaceKVStoreManager- Parameters:
collection- the collectionid- the id
-
clear
public void clear(String collection)
Removes all elements from a collection.- Specified by:
clearin interfaceKVStoreManager- Parameters:
collection- the collection
-
find
public <C> Optional<C> find(String 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:
findin interfaceKVStoreManager- Type Parameters:
C- Element type- Parameters:
collection- the collectionid- the idclazz- the type of the searched element- Returns:
- the option
-
findAll
public <C> List<C> findAll(String collection, int skip, Integer limit, Class<C> clazz)
Finds all elements contained inside the specified collection. *- Specified by:
findAllin interfaceKVStoreManager- Type Parameters:
C- Element type- Parameters:
collection- the collectionskip- the position from which the elements are returnedlimit- the limit size of elementsclazz- the type of the searched element- Returns:
- the list of elements.
-
-