mco_edge_sync

Sends successfully committed transactions from the edge database to the remote server.

For an overview, see the Edge Client page.

Prototype

    MCO_RET mco_edge_sync(mco_edge_h con, unsigned int sync_flags, timer_unit timeout);
    

Arguments

con
Connection handle obtained from a previous mco_edge_connect() call.
sync_flags
A bitmask specifying the synchronization behavior. Can be a combination of the flags listed in the Description section below. The default mode is MCO_EDGE_SYNC_DEFAULT.
timeout
Maximum time to wait for the operation to complete, in milliseconds. If the timeout expires before the operation finishes, the function returns an error code.

Description

Transmits all successfully committed but not yet acknowledged transactions from the local edge database ring buffer to the remote server. This function is the core mechanism for data replication in the Active Replication Fabric (ARF) architecture.

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

If MCO_EDGE_SYNC_AUTO_CLEAR is not specified, the application must manually call mco_edge_clear() to free up space in the ring buffer. Failure to clear acknowledged transactions will eventually lead to a full buffer and MCO_E_NOMEM errors during subsequent Class_new() calls.

This function should typically be called periodically by a dedicated synchronization thread or within the main application loop, depending on the real-time requirements of the system.

Return Codes

MCO_S_OK
Synchronization completed successfully. All pending transactions were sent and (if requested) acknowledged.
MCO_S_NOTFOUND
Search operation failed.
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:
mcoedgedb.c
Library:
libmcoiotedge.a