Staging database
The staging database is a global database that you can use to store keys and value pairs under key spaces. This database supports creating and deleting key spaces and keys, reading and updating values of keys.
This database is shared between threads. To avoid locking issues, a queue based producer-consumer model is built. In this model, the staging database is controlled by a thread and reads requests from a queue. Each request has a callback that is called when the request is completed. The thread is an operating system thread and not a Cloverleaf engine thread.
By default all keys are written to the global key space. DTC creates a new key space for each transaction.
Staging database access from TCL is through the stageXXX TCL API.
This table shows the key/value pairs of the staging database:
Field | Name | Type | Notes | |
---|---|---|---|---|
1 | Row ID | rowid |
INTEGER
|
SQLite default |
2 | Timestamp | timestamp |
INTEGER
|
Use SQLite’s strftime('%Y-%m-%d
%H:%M:%f', ‘now’) function to store value. %f stores milliseconds. |
3 | Value type | datatype |
INTEGER
|
This field can take these values:
|
4 | Key space | keyspace |
VARCHAR |
"Global," or user-defined key space. For DTC, this
is " |
5 | Key | key |
VARCHAR |
User-defined key. For DTC, this is "step^state ." These SQLite functions can
be used for DTC:
To get the state, use: To get the step: |
6 | Data | data |
BLOB
|
Message or user-defined data. |
7 | Meta Data | metadata |
VARCHAR |
Message metadata. |