Sends successfully committed transactions from the edge database to the remote server.
For an overview, see the Edge Client page.
MCO_RET mco_edge_sync(mco_edge_h con, unsigned int sync_flags, timer_unit timeout);
con
mco_edge_connect() call.sync_flags
MCO_EDGE_SYNC_DEFAULT.timeout
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:
MCO_EDGE_SYNC_WAIT (0x01): Performs a blocking call. The function returns only after receiving an acknowledgment from the server
that the data has been received.MCO_EDGE_SYNC_RESEND (0x02): Forces the resending of transactions that were previously sent but not yet acknowledged. Useful for
recovering from network interruptions.MCO_EDGE_SYNC_AUTO_CLEAR (0x04): Automatically invokes mco_edge_clear(con, MCO_EDGE_CLEAR_ACK) upon successful
acknowledgment. This removes the acknowledged transactions from the local ring buffer, freeing space for new data.MCO_EDGE_SINGLE_TRANSACTION (0x100): Limits the synchronization to sending at most one transaction per call. Useful for fine-grained
control over bandwidth or latency.MCO_EDGE_SYNC_DEFAULT: Equivalent to MCO_EDGE_SYNC_AUTO_CLEAR. This is the recommended mode for most applications
as it ensures efficient buffer management.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.
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.