theLink 10.0
Loading...
Searching...
No Matches
MqContextC_StorageApi_RB_API

MqContextC - setup and manage a storage used to persist data-packagesMore...

+ Collaboration diagram for MqContextC_StorageApi_RB_API:

Functions

static OT_ProcRet rbmqmsgque_MqContextC_StorageDelete (MqContextC_ARGS)
  Ruby: int32 ctx.StorageDelete(?*transLIdP_inout:int32=0?) C-API
delete the storage-row identified by the transLIdP_inout
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageImport (MqContextC_ARGS)
  Ruby: int32 ctx.StorageImport(?*transLIdP_inout:int32=0?) C-API
import the storage-package into the read-data-package
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageClose (MqContextC_ARGS)
  Ruby: ctx.StorageClose() C-API
close the storage. …
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageDecrRef (MqContextC_ARGS)
  Ruby: ctx.StorageDecrRef(transLId:int32) C-API
decrease the internal refCount lock of the database-entry
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageIncrRef (MqContextC_ARGS)
  Ruby: ctx.StorageIncrRef(transLId:int32) C-API
increase the internal refCount lock of the database-entry
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageLog (MqContextC_ARGS)
  Ruby: ctx.StorageLog(?callfunc:string="MK_NULL"?) C-API
log the storage the status of the open transactions
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageOpen (MqContextC_ARGS)
  Ruby: ctx.StorageOpen(storageFile:string) C-API
switch to a file-based-transaction-database
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageCount (MqContextC_ARGS)
  Ruby: int32 ctx.StorageCount() C-API
count the number of storage-rows
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageErrCnt (MqContextC_ARGS)
  Ruby: int32 ctx.StorageErrCnt(transLId:int32) C-API
increment and return the database row-error-count for the row defined with transLId
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageExport (MqContextC_ARGS)
  Ruby: int32 ctx.StorageExport() C-API
export the read-data-package into the STORAGE
 
static OT_ProcRet rbmqmsgque_MqContextC_StorageResolve (MqContextC_ARGS)
  Ruby: {otherCtxP:MqContextC otherLIdP:int32} ctx.StorageResolve() C-API
extract the context->link.protect.rmtTransLId entry from the database
 

Detailed Description

MqContextC - setup and manage a storage used to persist data-packages

The storage is divided into: INTERNAL and EXTERNAL storage. Only the read-data-package can be stored or dumped into the storage.

The read-data-package is saved into the storage using:

ServiceStorage setup a service listen on a MqContextC_ServiceApi_Identifer and save all read-data-package into the STORAGE
StorageExport export the read-data-package into the STORAGE

The read-data-package is restored from the storage using:

StorageImport import the storage-package into the read-data-package
ProxyForward send the entire read-data-package-data to the link-target
All this usually happen in an Event Handler

Some important facts of the storage-feature:

The following internal storages are supported:

default
The default-storage is set with the configuration parameter --storage fileName and defaults to "#memdb#". If a package have to be saved into the storage and the storage is not open the default-storage id used. The open will always be performed. If an explicit storage is required the default can be changed or a storage can explicit be opened with MqStorageOpen. Keep in mind that the default-storage is a per-context configuration but only one storage per process or thread is currently supported.
memdb
This is the default storage and can be set explicitly with MqStorageOpen using the "#memdb#" parameter.
tmpdb
This storage is like an in-memory-storage but export data to the TEMPORARY filesystem if the application run out of memory. This storage can explicit be set with MqStorageOpen with the parameter "#tmpdb#".
filedb
This storage always work on files. Only this storage is persistent and can explicit be set with MqStorageOpen with the storageFile parameter.

Performance analyse:

database performance host crash application crash info
memdb 30.000 data lost data lost non persistent
tempdb < 30.000 data lost data lost uses memory and/or temporary file
filedb (mem) 10.000 data lost data safe in memory filesystem
filedb (disc) 50 data safe data safe disc-speed is the key factor

Function Documentation

◆ rbmqmsgque_MqContextC_StorageClose()

static OT_ProcRet rbmqmsgque_MqContextC_StorageClose ( MqContextC_ARGS )
static

Ruby: ctx.StorageClose() C-API
close the storage. …

Definition at line 2825 of file MqContextC_rb.c.

2825 {
2829 MkErrorC_Check(hdl,MqStorageClose (hdl));
2831 end: MK_UNUSED /* LONG JUMP on error */
2833}
#define OT_SETUP_NOARG(d)
#define OT_retObj_SET_None
#define OT_retObj_RETURN
#define OT_CHECK_NOARGS
#define MkErrorC_Check(mng, PROC)
#define StorageClose_doc
#define OT_SETUP_hdl
#define MK_UNUSED
#define MqStorageClose(...)

◆ rbmqmsgque_MqContextC_StorageCount()

static OT_ProcRet rbmqmsgque_MqContextC_StorageCount ( MqContextC_ARGS )
static

Ruby: int32 ctx.StorageCount() C-API
count the number of storage-rows

Definition at line 2892 of file MqContextC_rb.c.

2892 {
2896 MQ_LTR cnt_out;
2897 MkErrorC_Check(hdl,MqStorageCount (hdl, &cnt_out));
2898 OT_retObj_SET_I32(cnt_out);
2899 end: MK_UNUSED /* LONG JUMP on error */
2901}
#define OT_retObj_SET_I32(nat)
#define StorageCount_doc
#define MqStorageCount(...)
int MQ_LTR
32bit longterm transaction token because PHP-32 does NOT support long long

◆ rbmqmsgque_MqContextC_StorageDecrRef()

static OT_ProcRet rbmqmsgque_MqContextC_StorageDecrRef ( MqContextC_ARGS )
static

Ruby: ctx.StorageDecrRef(transLId:int32) C-API
decrease the internal refCount lock of the database-entry

Definition at line 2836 of file MqContextC_rb.c.

2836 {
2839 MQ_LTR transLId = 0;
2842 MkErrorC_Check(hdl,MqStorageDecrRef (hdl, transLId));
2844 end: MK_UNUSED /* LONG JUMP on error */
2846}
#define OT_SETUP_ONEARG(d)
#define OT_CHECK_NI4(val)
#define OT_CHECK_REQUIRED(val)
#define StorageDecrRef_doc
#define MqStorageDecrRef(...)

◆ rbmqmsgque_MqContextC_StorageDelete()

static OT_ProcRet rbmqmsgque_MqContextC_StorageDelete ( MqContextC_ARGS )
static

Ruby: int32 ctx.StorageDelete(?*transLIdP_inout:int32=0?) C-API
delete the storage-row identified by the transLIdP_inout

Definition at line 2797 of file MqContextC_rb.c.

2797 {
2800 MQ_LTR transLIdP_inout = 0;
2801 OT_CHECK_OPTIONAL(OT_CHECK_NI4 (transLIdP_inout))
2803 MkErrorC_Check(hdl,MqStorageDelete (hdl, &transLIdP_inout));
2804 OT_retObj_SET_I32(transLIdP_inout);
2805 end: MK_UNUSED /* LONG JUMP on error */
2807}
#define OT_SETUP_VARARGS(min, max, d)
#define OT_CHECK_OPTIONAL(val)
#define StorageDelete_doc
#define MqStorageDelete(...)

◆ rbmqmsgque_MqContextC_StorageErrCnt()

static OT_ProcRet rbmqmsgque_MqContextC_StorageErrCnt ( MqContextC_ARGS )
static

Ruby: int32 ctx.StorageErrCnt(transLId:int32) C-API
increment and return the database row-error-count for the row defined with transLId

Definition at line 2904 of file MqContextC_rb.c.

2904 {
2907 MQ_LTR transLId = 0;
2910 MK_I32 cnt_out;
2911 MkErrorC_Check(hdl,MqStorageErrCnt (hdl, transLId, &cnt_out));
2912 OT_retObj_SET_I32(cnt_out);
2913 end: MK_UNUSED /* LONG JUMP on error */
2915}
#define StorageErrCnt_doc
signed int MK_I32
#define MqStorageErrCnt(...)

◆ rbmqmsgque_MqContextC_StorageExport()

static OT_ProcRet rbmqmsgque_MqContextC_StorageExport ( MqContextC_ARGS )
static

Ruby: int32 ctx.StorageExport() C-API
export the read-data-package into the STORAGE

Definition at line 2918 of file MqContextC_rb.c.

2918 {
2922 MQ_LTR ltid_out;
2923 MkErrorC_Check(hdl,MqStorageExport (hdl, &ltid_out));
2924 OT_retObj_SET_I32(ltid_out);
2925 end: MK_UNUSED /* LONG JUMP on error */
2927}
#define StorageExport_doc
#define MqStorageExport(...)

◆ rbmqmsgque_MqContextC_StorageImport()

static OT_ProcRet rbmqmsgque_MqContextC_StorageImport ( MqContextC_ARGS )
static

Ruby: int32 ctx.StorageImport(?*transLIdP_inout:int32=0?) C-API
import the storage-package into the read-data-package

Definition at line 2810 of file MqContextC_rb.c.

2810 {
2813 MQ_LTR transLIdP_inout = 0;
2814 OT_CHECK_OPTIONAL(OT_CHECK_NI4 (transLIdP_inout))
2816 MkErrorC_Check(hdl,MqStorageImport (hdl, &transLIdP_inout));
2817 OT_retObj_SET_I32(transLIdP_inout);
2818 end: MK_UNUSED /* LONG JUMP on error */
2820}
#define StorageImport_doc
#define MqStorageImport(...)

◆ rbmqmsgque_MqContextC_StorageIncrRef()

static OT_ProcRet rbmqmsgque_MqContextC_StorageIncrRef ( MqContextC_ARGS )
static

Ruby: ctx.StorageIncrRef(transLId:int32) C-API
increase the internal refCount lock of the database-entry

Definition at line 2849 of file MqContextC_rb.c.

2849 {
2852 MQ_LTR transLId = 0;
2855 MkErrorC_Check(hdl,MqStorageIncrRef (hdl, transLId));
2857 end: MK_UNUSED /* LONG JUMP on error */
2859}
#define StorageIncrRef_doc
#define MqStorageIncrRef(...)

◆ rbmqmsgque_MqContextC_StorageLog()

static OT_ProcRet rbmqmsgque_MqContextC_StorageLog ( MqContextC_ARGS )
static

Ruby: ctx.StorageLog(?callfunc:string="MK_NULL"?) C-API
log the storage the status of the open transactions

Definition at line 2862 of file MqContextC_rb.c.

2862 {
2865 MK_STRN callfunc = NULL;
2868 if (MkSysStringIsNULL(callfunc)) {callfunc = OT_GET_CALL_PROC;}
2869 MkErrorC_Check(hdl,MqStorageLog (hdl, callfunc));
2871 end: MK_UNUSED /* LONG JUMP on error */
2874}
#define OT_FRAME_CLEANUP
#define OT_GET_CALL_PROC
#define OT_CHECK_STRN(val)
#define StorageLog_doc
const MK_STRB * MK_STRN
static bool MkSysStringIsNULL(MK_STRN str)
#define MqStorageLog(...)

◆ rbmqmsgque_MqContextC_StorageOpen()

static OT_ProcRet rbmqmsgque_MqContextC_StorageOpen ( MqContextC_ARGS )
static

Ruby: ctx.StorageOpen(storageFile:string) C-API
switch to a file-based-transaction-database

Definition at line 2877 of file MqContextC_rb.c.

2877 {
2880 MK_STRN storageFile = 0;
2881 OT_CHECK_REQUIRED(OT_CHECK_STRN (storageFile))
2883 MkErrorC_Check(hdl,MqStorageOpen (hdl, storageFile));
2885 end: MK_UNUSED /* LONG JUMP on error */
2887}
#define StorageOpen_doc
#define MqStorageOpen(...)

◆ rbmqmsgque_MqContextC_StorageResolve()

static OT_ProcRet rbmqmsgque_MqContextC_StorageResolve ( MqContextC_ARGS )
static

Ruby: {otherCtxP:MqContextC otherLIdP:int32} ctx.StorageResolve() C-API
extract the context->link.protect.rmtTransLId entry from the database

Definition at line 2930 of file MqContextC_rb.c.

2930 {
2934 MQ_CTX otherCtxP_out;
2935 MQ_LTR otherLIdP_out;
2936 MkErrorC_Check(hdl,MqStorageResolve (hdl, &otherCtxP_out, &otherLIdP_out));
2938 OT_retObj_APPEND(OT_TMP_CTX_OBJ(otherCtxP_out));
2939 OT_retObj_APPEND(OT_TMP_I32_OBJ(otherLIdP_out));
2940 end: MK_UNUSED /* LONG JUMP on error */
2942}
#define OT_retObj_SET_List
#define OT_TMP_I32_OBJ(val)
#define OT_retObj_APPEND(var)
#define OT_TMP_CTX_OBJ(val)
#define StorageResolve_doc
#define MqStorageResolve(...)
PUBLIC data structure for the rbmqmsgque-specific-data