mco_trans_rt_estimate_rollback_time

Prototype

    MCO_RET mco_trans_rt_estimate_rollback_time(mco_trans_h t, mco_interval_t* estimation)

Arguments

t
Transaction handle
estimation
Address of the output interval

Description

This function returns the time in milliseconds required to roll back the current transaction. The time is calculated based on the current number of memory and persistent dirty pages (pages that have been modified by the current transaction).

This function can be used by the deadline policy callbacks. For instance the predefined callback for the adjustable deadline policy is implemented as follows:

    MCO_RET mco_trans_rt_rollback_deadline_check(mco_trans_h t)
    {
        mco_interval_t remaining;

        MCO_RET ret = mco_trans_rt_get_remaining_time(t, &remaining);

        if (ret == MCO_S_OK)
        {
            mco_interval_t rollback_time_estimation;

            ret = mco_trans_rt_estimate_rollback_time(t,
            &rollback_time_estimation);

            if (ret == MCO_S_OK)
            {
                if (remaining < rollback_time_estimation)
                {
                    ret = MCO_E_INTERRUPTED;
                }
            }
        }
        return ret;
    }

Return Codes

MCO_S_OK
Interval obtained successfully

Files

Header file:
mco.h
Source file:
mcotrans.c
Library:
libmcolib.a