Class Database

java.lang.Object
com.sparsity.sparksee.gdb.Database
All Implemented Interfaces:
Closeable, AutoCloseable

public class Database extends Object implements Closeable
Database class.

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 Details

    • dumpSchema

      public void dumpSchema(String filePath)
      Dump the database schema to the given file using the Sparksee scripting format.

      Parameters:
      filePath - null
    • addQueryStreamManager

      public void addQueryStreamManager(QueryStreamManager queryStreamManager)
      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

      public Session newSession()
      Creates a new Session.

      Returns:
      A new Session instance.
    • getPath

      public String getPath()
      Gets the path of the Database.

      Returns:
      The path of the Database.
    • 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

      public void getStatistics(DatabaseStatistics stats)
      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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getAlias

      public String getAlias()
      Gets the alias of the Database.

      Returns:
      The alias of the Database.
    • getCacheMaxSize

      public int getCacheMaxSize()
      Gets the cache maximum size (in MB).

      Returns:
      Returns the current cache max size.