public interface BlueDb
BlueDb
is a set of BlueCollection
instances. Each collection must have a different name and can be of
a different type.Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current
thread is interrupted, whichever happens first.
|
void |
backup(java.nio.file.Path path)
Creates a backup of the entire database
|
<K extends BlueKey,V extends java.io.Serializable> |
collectionBuilder(java.lang.String name,
java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Creates a
BlueCollectionBuilder object for this BlueDb |
<V extends java.io.Serializable> |
getCollection(java.lang.String name,
java.lang.Class<V> valueType)
Gets an existing
BlueCollection |
<V extends java.io.Serializable> |
initializeCollection(java.lang.String name,
java.lang.Class<? extends BlueKey> keyType,
java.lang.Class<V> valueType,
java.lang.Class<? extends java.io.Serializable>... additionalClassesToRegister)
Creates a
BlueCollection , or returns the existing one of the same name, if one exists |
void |
shutdown()
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
This method does not wait for previously submitted tasks to complete execution. |
void |
shutdownNow()
Attempts to stop all actively executing tasks and halts the processing of waiting tasks.
This method does not wait for actively executing tasks to terminate. |
<V extends java.io.Serializable> BlueCollection<V> initializeCollection(java.lang.String name, java.lang.Class<? extends BlueKey> keyType, java.lang.Class<V> valueType, java.lang.Class<? extends java.io.Serializable>... additionalClassesToRegister) throws BlueDbException
BlueCollection
, or returns the existing one of the same name, if one existsV
- the object type of values to be serialized into the collectionname
- the unique name of the collectionkeyType
- the class type of the collection's keysvalueType
- the class type of the values stored in the collectionadditionalClassesToRegister
- classes to optimize for in the serializer (should be classes that will be stored in collection keys or values)BlueDbException
- if any problems are encountered, such as the collection already existing with a different type<K extends BlueKey,V extends java.io.Serializable> BlueCollectionBuilder<K,V> collectionBuilder(java.lang.String name, java.lang.Class<K> keyType, java.lang.Class<V> valueType)
BlueCollectionBuilder
object for this BlueDb
K
- the key type of the collectionV
- the object type of values to be serialized into the collectionname
- The unique name of the collectionkeyType
- the class type of the collection's keysvalueType
- the class type of the values stored in the collectionBlueCollectionBuilder
object for this BlueDb
<V extends java.io.Serializable> BlueCollection<V> getCollection(java.lang.String name, java.lang.Class<V> valueType) throws BlueDbException
BlueCollection
V
- the object type of values to be serialized into the collectionname
- The unique name of the collectionvalueType
- the class type of the values stored in the collectionBlueCollection
if it exists, else nullBlueDbException
- if any issues encountered, such as the existing collection having a different key typevoid backup(java.nio.file.Path path) throws BlueDbException
path
- where the backup will be createdBlueDbException
- if any issues encountered, such as file system problemsvoid shutdown()
void shutdownNow()
boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit timeUnit) throws BlueDbException
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argumentBlueDbException
- if any issues are encountered, such as being interrupted