Class Database
- All Implemented Interfaces:
Closeable, AutoCloseable
All the data of the Database is stored into a persistent file which just can be created or open through a Sparksee instance.
Also, all the manipulation of a Database must be done by means of a Session which can be initiated from a Database instance.
Multiple Databases do not share the memory, that is there is no negotiation among them. In those cases, memory must be prefixed for each Database. To do that, use the SPARKSEEConfig.
- Author:
- Sparsity Technologies http://www.sparsity-technologies.com
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddQueryStreamManager(QueryStreamManager queryStreamManager) Add a QueryStreamManager to the database.voidclose()Closes the Database instance.voidDisables the rollback mechanism.voiddumpSchema(String filePath) Dump the database schema to the given file using the Sparksee scripting format.voidEnables the rollback mechanism.voidSets the cache maximum size to the current cache size in use.getAlias()Gets the alias of the Database.intGets the cache maximum size (in MB).getPath()Gets the path of the Database.voidgetStatistics(DatabaseStatistics stats) Gets Database statistics.booleanisClosed()Gets if Database instance has been closed or not.Creates a new Session.voidredoPrecommitted(long txId) Redo a pending precommitted transaction recovered.voidsetCacheMaxSize(int megaBytes) Sets the cache maximum size (in MB).
-
Method Details
-
dumpSchema
Dump the database schema to the given file using the Sparksee scripting format.- Parameters:
filePath- null
-
addQueryStreamManager
Add a QueryStreamManager to the database.The user is responsible of keeping the manager alive for the duration of the Database. The Managers will be used in reverse order of addition while searching for a matching Stream.
- Parameters:
queryStreamManager- [In] A reference to a QueryStreamManager
-
newSession
-
getPath
-
enableRollback
public void enableRollback()Enables the rollback mechanism. -
fixCurrentCacheMaxSize
public void fixCurrentCacheMaxSize()Sets the cache maximum size to the current cache size in use. -
isClosed
public boolean isClosed()Gets if Database instance has been closed or not.- Returns:
- TRUE if the Database instance has been closed, FALSE otherwise.
- See Also:
-
redoPrecommitted
public void redoPrecommitted(long txId) Redo a pending precommitted transaction recovered.YOU SHOULD NOT USE THIS METHOD. This method only exists for a specific service.
- Parameters:
txId- null
-
getStatistics
Gets Database statistics.- Parameters:
stats- [out] The DatabaseStatistics instance.
-
setCacheMaxSize
public void setCacheMaxSize(int megaBytes) Sets the cache maximum size (in MB).0 means unlimited which is all the physical memory of the computer minus a small margin.
- Parameters:
megaBytes- [in] The new cache max size.
-
disableRollback
public void disableRollback()Disables the rollback mechanism. -
close
public void close()Closes the Database instance.It must be called to ensure the integrity of all data.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getAlias
-
getCacheMaxSize
public int getCacheMaxSize()Gets the cache maximum size (in MB).- Returns:
- Returns the current cache max size.
-