Removes completed transactions from the edge database ring buffer to free up space.
For an overview, see the Edge Client page.
MCO_RET mco_edge_clear(mco_edge_h con, unsigned int clear_flags);
con
mco_edge_connect() call.clear_flags
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:
MCO_EDGE_CLEAR_ACK (0x01): Removes only transactions that have been successfully sent to the server and acknowledged (ACK).
This is the safest mode, guaranteeing no data loss.MCO_EDGE_CLEAR_SENT (0x02): Removes transactions that have been sent to the server but not yet acknowledged. Use with caution,
as data loss is possible if the server fails before acknowledging.MCO_EDGE_CLEAR_ALL (0x04): Removes all completed transactions, regardless of their synchronization status. This may result
in significant data loss and should only be used in specific recovery scenarios.MCO_EDGE_SINGLE_TRANSACTION (0x100): Limits the operation to removing at most one transaction per call. Useful for
fine-grained buffer management.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:
obj: Handle of the object being removed. It can be used with generated Class_get() wrappers to access field
values before the object is destroyed.class_code: Internal identifier of the object's class.clear_flags: Indicates the state of the transaction to which the object belongs:
MCO_EDGE_CLEAR_ACK: Transaction was sent and acknowledged (no data loss).MCO_EDGE_CLEAR_SENT: Transaction was sent but not acknowledged (data loss is possible).MCO_EDGE_CLEAR_ALL: Transaction was not sent (data loss is guaranteed).context: User-defined context pointer provided during callback registration.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.
MCO_S_OK
MCO_S_NOTFOUND
MCO_E_ILLEGAL_PARAM
NULL con or invalid flag combination).MCO_E_NOINSTANCE
con does not refer to a valid, open edge database instance.