public final class BerkeleyKVStorePlugin extends Object implements KVStorePlugin, Activeable
| Constructor and Description |
|---|
BerkeleyKVStorePlugin(String collections,
String dbFilePath,
VTransactionManager transactionManager,
CodecManager codecManager)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear(String collection)
Removes all elements from a collection.
|
int |
count(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 collection.
|
List<String> |
getCollections()
Returns the list of collections managed by this plugin.
|
void |
put(String collection,
String id,
Object element)
Adds an element defined by an id in a collection.
|
void |
remove(String collection,
String id)
Removes an element defined by an id from a collection.
|
void |
removeTooOldElements()
Remove too old elements.
|
void |
start() |
void |
stop() |
@Inject
public BerkeleyKVStorePlugin(@Named(value="collections")
String collections,
@Named(value="dbFilePath")
String dbFilePath,
VTransactionManager transactionManager,
CodecManager codecManager)
collections - List of collections managed by this plugin (comma separated)dbFilePath - Base Berkeley DB file system path (Could use java env param like user.home user.dir or java.io.tmpdir)minFreeDisk - Minimum free disk space to maintain, in bytes. If the limit is exceeded, write operations will be prohibited. Default to 100M.transactionManager - Transaction managercodecManager - Codec managerpublic List<String> getCollections()
getCollections in interface KVStorePluginpublic void start()
start in interface Activeablepublic void stop()
stop in interface Activeablepublic void removeTooOldElements()
public void remove(String collection, String id)
remove in interface KVStorePlugincollection - the collectionid - the idpublic void clear(String collection)
clear in interface KVStorePlugincollection - the collectionpublic void put(String collection, String id, Object element)
put in interface KVStorePlugincollection - the collectionid - the idelement - the elementpublic <C> Optional<C> find(String collection, String id, Class<C> clazz)
find in interface KVStorePluginC - Element typecollection - the collectionid - the idclazz - the type of the searched elementpublic <C> List<C> findAll(String collection, int skip, Integer limit, Class<C> clazz)
findAll in interface KVStorePluginC - Element typecollection - the collectionskip - the position from which the elements are returnedlimit - the limit size of elementsclazz - the type of the searched elementpublic int count(String collection)
count in interface KVStorePlugincollection - the collectionCopyright © 2019. All Rights Reserved.