mco_trans_rt_start

Start a real-time transaction.

Prototype

 
    typedef struct mco_trans_rt_params_t_
    {
         mco_interval_t            deadline;
    } mco_trans_rt_params_t;

    // static initializer for mco_trans_rt_params_t
    #define MCO_TRANS_DEFAULT_PARAMS {MCO_MAX_DEADLINE}

    MCO_RET mco_trans_rt_start(mco_db_h db, MCO_TRANS_TYPE type, MCO_TRANS_PRIORITY pri, mco_trans_rt_params_t const*  params, /*OUT*/mco_trans_h* p_trans);
 

Arguments

db The database handle that was established by mco_db_connect()
type value from the enum MCO_TRANS_TYPE
pri value from the enum MCO_TRANS_PRIORITY
params The address of parameters (deadline)

p_trans

The address of a mco_trans_h to receive the transaction handle

Description

Start a real-time transaction with a deadline set by params->deadline (MCO_MAX_DEADLINE for "usual" non-real-time transactions).

mco_trans_rt_start() won't allow to a real-time transaction with a finite deadline to start unless the rollback buffer is enabled. It is possible to disable the rollback buffer and revert to the classic implementation for running non-real-time transactions (with infinite deadlines).

Return Codes

MCO_S_OK Transaction was started successfully
MCO_E_INTERRUPTED Transaction was interrupted by timer, callback or another transaction

MCO_ERR_TRN

A database transaction error occurred.

MCO_E_INCOMPATIBLE_ROLLBACK

An attempt to start a real-time transaction with a finite deadline without the rollback buffer enabled.