Runtime Control in C#

The startup procedure that initializes the eXtremeDB runtime environment in C# applications is implemented in the Database.RuntimeStart() method which is invoked automatically by the constructor when a Database object is instantiated. And Database.RuntimeStop() is invoked automatically to shutdown the runtime in an orderly manner when the Database object is destroyed.

Runtime Libraries

For C# applications, the runtime library options are specified in the Database constructor call. There are four constructors for the Database class:

 
    Database()
 
    Database(Mode mode)
 
    Database(Mode mode, string runtime_path)
 
    Database(ExtremedbWrapper)
     

The first (default) constructor loads the default runtime which uses conventional memory for all-in-memory databases and the MURSIW transaction manager in the release mode libraries.

The second constructor allows selecting which runtime libraries to load. Prior to instantiating the Database object, it is common practice to set runtime options to load specific eXtremeDB DLLs by setting Database.Mode values.

The possible options are:

DebugSupport Load debug versions of libraries to provide additional diagnostic exceptions
SharedMemorySupport Load "_shm" versions of libraries for databases using shared memory
DiskSupport Load persistent storage libraries
MVCCTransactionManager Load "_mvcc" versions of libraries to use the MVCC transaction manager - by default "_mursiw" (MURSIW transaction manager) versions are loaded
TransactionLoggingSupport Load eXtremeDB Transaction Logging libraries
HighAvailabilitySupport Load eXtremeDB High Availability libraries
ClusterSupport Load eXtremeDB Cluster libraries
MPIClusterSupport Load eXtremeDB Cluster libraries for the MPI channel transport layer

Multiple options are combined using the or operator “|”. For example the following options together specify the disk-based version of the MVCC transaction manager and the Debug libraries:

 
    db = new Database( Database.DiskSupport | Database.MVCCTransactionManager | Database.DebugSupport);
     

When a mode argument is specified, the runtime libraries to be loaded are searched using the standard rules for loading .NET Framework assemblies: first the Global Assembly Cache (GAC) is searched, then the local application directory. If another location is desired for loading the runtime libraries, the third constructor can be used to specify a runtime file path runtime_path.

For backward compatibility with applications created with previous versions or the .NET Framework API, the fourth constructor accepts the ExtremedbWrapper argument. This constructor is typically invoked as follows:

 
    Database db = new Database( new ExtremedbWrapper() );
     

ExtremedbWrapper is the wrapper class necessary for the eXtremeDB managed API (implemented in managed C++). The other constructors instantiate this wrapper interface automatically.

Persistent Databases

For Persistent Database applications, the Database.Mode.DiskSupport flag must be specified in the Database constructor call. For example:

 
    Database.Mode mode = Database.Mode.DiskSupport;
    db = new Database(mode);
     

 

GetRuntimeInfo

The Database.GetRunTimeInfo() method can be called any time after Database instantiation to obtain the specific configuration details of the current runtime. (Please refer to SDK sample csharp/open for an example.)

The typical sequence of API calls would look like the following:

 
    public static void Main(String[] args)
    {
        Database db;
        ...
        Database.Mode mode = Database.Mode.SharedMemorySupport | Database.Mode.MVCCTransactionManager;
        ...
         
        mode |= Database.Mode.DebugSupport;
         
        // Initialize runtime and open database with shared memory, MVCC and debug libraries
        db = new Database(mode);
        ...
        // Call method GetRunTimeInfo() to view runtime options
        Database.RuntimeInfo ri = db.GetRunTimeInfo();
    }