Class MapDBEngine
- java.lang.Object
-
- com.datumbox.framework.common.storage.abstracts.AbstractStorageEngine<SC>
-
- com.datumbox.framework.common.storage.abstracts.AbstractFileStorageEngine<MapDBConfiguration>
-
- com.datumbox.framework.storage.mapdb.MapDBEngine
-
- All Implemented Interfaces:
StorageEngine,AutoCloseable
public class MapDBEngine extends AbstractFileStorageEngine<MapDBConfiguration>
The MapDBEngine is responsible for saving and loading data from MapDB files, creating BigMaps which are backed by files and storing data. The MapDBEngine does not load all the contents of BigMaps in memory, maintains an LRU cache to speed up data retrieval and stores all data in MapDB files.- Author:
- Vasilis Vryniotis
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.datumbox.framework.common.storage.interfaces.StorageEngine
StorageEngine.MapType, StorageEngine.StorageHint
-
-
Field Summary
-
Fields inherited from class com.datumbox.framework.common.storage.abstracts.AbstractStorageEngine
logger, storageConfiguration, storageName
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMapDBEngine(String storageName, MapDBConfiguration storageConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidclose()<T extends Map>
voiddropBigMap(String name, T map)booleanexistsObject(String name)<K,V>
Map<K,V>getBigMap(String name, Class<K> keyClass, Class<V> valueClass, StorageEngine.MapType type, StorageEngine.StorageHint storageHint, boolean isConcurrent, boolean isTemporary)<T extends Serializable>
TloadObject(String name, Class<T> klass)protected Set<Class>nonSerializableBigMaps()booleanrename(String newStorageName)<T extends Serializable>
voidsaveObject(String name, T serializableObject)-
Methods inherited from class com.datumbox.framework.common.storage.abstracts.AbstractFileStorageEngine
createDirectoryIfNotExists, deleteDirectory, deleteIfExistsRecursively, getDirectory, getRootPath, moveDirectory
-
Methods inherited from class com.datumbox.framework.common.storage.abstracts.AbstractStorageEngine
assertConnectionOpen, getStorageName, isClosed, postDeserializer, postSerializer, preSerializer
-
-
-
-
Constructor Detail
-
MapDBEngine
protected MapDBEngine(String storageName, MapDBConfiguration storageConfiguration)
- Parameters:
storageName-storageConfiguration-- See Also:
AbstractStorageEngine(String, StorageConfiguration)
-
-
Method Detail
-
rename
public boolean rename(String newStorageName)
-
existsObject
public boolean existsObject(String name)
-
saveObject
public <T extends Serializable> void saveObject(String name, T serializableObject)
-
loadObject
public <T extends Serializable> T loadObject(String name, Class<T> klass) throws NoSuchElementException
- Throws:
NoSuchElementException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classAbstractStorageEngine<MapDBConfiguration>
-
clear
public void clear()
-
getBigMap
public <K,V> Map<K,V> getBigMap(String name, Class<K> keyClass, Class<V> valueClass, StorageEngine.MapType type, StorageEngine.StorageHint storageHint, boolean isConcurrent, boolean isTemporary)
-
nonSerializableBigMaps
protected Set<Class> nonSerializableBigMaps()
- Specified by:
nonSerializableBigMapsin classAbstractStorageEngine<MapDBConfiguration>
-
-