mco_edge_clear

Removes completed transactions from the edge database ring buffer to free up space.

For an overview, see the Edge Client page.

Prototype

    MCO_RET mco_edge_clear(mco_edge_h con, unsigned int clear_flags);
    

Arguments

con
Connection handle obtained from a previous mco_edge_connect() call.
clear_flags
A bitmask specifying which transactions should be removed. Can be a combination of the flags listed in the Description section below.

Description

Removes completed transactions from the local ring buffer, freeing space for new data. This function is essential for maintaining the continuous operation of the edge database, as the ring buffer has a fixed size.

The behavior of the clearing process is controlled by the clear_flags parameter, which can be a combination of the following flags:

Clear Callback: If a clear_callback was specified in the mco_edge_params_t structure during database initialization, mco_edge_clear() will invoke this callback for each object being removed. This allows the application to perform custom cleanup or logging operations.

The callback function prototype is:

    typedef MCO_RET (*mco_edge_clear_callback_t)(
        MCO_Ef *obj,
        mco_uint2 class_code,
        unsigned int clear_flags,
        void *context
    );

Where:

To mark the end of a transaction, the callback is also invoked with a null object handle:

    (*clear_callback)(0, 0, clear_flags | MCO_EDGE_CLEAR_TRANSACTION_END, context);

The MCO_EDGE_CLEAR_TRANSACTION_END (0x200) flag indicates that all objects for the current transaction have been processed.

Return Codes

MCO_S_OK
Transactions were successfully cleared from the ring buffer.
MCO_S_NOTFOUND
No completed transactions matching the specified flags were found in the ring buffer.
MCO_E_ILLEGAL_PARAM
One or more parameter values are invalid (e.g., NULL con or invalid flag combination).
MCO_E_NOINSTANCE
The connection handle con does not refer to a valid, open edge database instance.

Files

Header file:
mcoedge.h
Source file:
mcoedgecomm.c
Library:
libmcoiotedge.a