Interface StorageEngine
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AbstractFileStorageEngine,AbstractStorageEngine
public interface StorageEngine extends AutoCloseable
StorageEngines that give access to a permanent storage should implement this interface. The storage engine should open the connection on its constructor and be responsible for managing and storing the data.- Author:
- Vasilis Vryniotis
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classStorageEngine.MapTypeThe supported MapTypes.static classStorageEngine.StorageHintA hint on where to ideally store the map.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Clears all the data stored in the storage while keeping the connection open.<T extends Map>
voiddropBigMap(String name, T map)Drops the Big Map.booleanexistsObject(String name)Checks if an object exists with the particular 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)Creates or loads a Big Map collection.StringgetStorageName()Returns the name of the storage.booleanisClosed()Checks if the storage engine is closed.<T extends Serializable>
TloadObject(String name, Class<T> klass)Loads a serializable object from the storage.booleanrename(String newStorageName)Renames the storage.<T extends Serializable>
voidsaveObject(String name, T serializableObject)Stores a serializable object in the storage.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
rename
boolean rename(String newStorageName)
Renames the storage. Returns true if the operation was completed and false if it was not necessary.- Parameters:
newStorageName-- Returns:
-
isClosed
boolean isClosed()
Checks if the storage engine is closed.- Returns:
-
clear
void clear()
Clears all the data stored in the storage while keeping the connection open.
-
existsObject
boolean existsObject(String name)
Checks if an object exists with the particular name.- Parameters:
name-- Returns:
-
saveObject
<T extends Serializable> void saveObject(String name, T serializableObject) throws NoSuchElementException
Stores a serializable object in the storage.- Type Parameters:
T-- Parameters:
name-serializableObject-- Throws:
NoSuchElementException
-
loadObject
<T extends Serializable> T loadObject(String name, Class<T> klass)
Loads a serializable object from the storage.- Type Parameters:
T-- Parameters:
name-klass-- Returns:
-
getBigMap
<K,V> Map<K,V> getBigMap(String name, Class<K> keyClass, Class<V> valueClass, StorageEngine.MapType type, StorageEngine.StorageHint storageHint, boolean isConcurrent, boolean isTemporary)
Creates or loads a Big Map collection.- Type Parameters:
K-V-- Parameters:
name-keyClass-valueClass-type-storageHint-isConcurrent-isTemporary-- Returns:
-
dropBigMap
<T extends Map> void dropBigMap(String name, T map)
Drops the Big Map.- Type Parameters:
T-- Parameters:
name-map-
-
getStorageName
String getStorageName()
Returns the name of the storage.- Returns:
-
-