mco_edge_trans_commit

Commits the changes made within an edge database transaction.

For an overview, see the Edge Client page.

Prototype

    MCO_RET mco_edge_trans_commit(mco_trans_h t);
    

Arguments

t
Transaction handle obtained from a previous mco_edge_trans_start() call.

Description

Commits all modifications made during the specified transaction, analogous to mco_trans_commit() in the core runtime.

If an error occurs during transaction execution (e.g., within a wrapper API call such as Class_field_put()), the error is recorded internally and will be returned by all subsequent API calls for that transaction, including mco_edge_trans_commit(). In such cases, the transaction is automatically rolled back, and the stored error code is returned to the caller.

After a successful commit, the transaction becomes eligible for transmission to the main eXtremeDB instance via mco_edge_sync() Note that edge data transmission is only initiated when mco_edge_sync() is called, not automatically at the transaction commit time. That provides extra flexibility to edge applications. For example, the application can call the synchronization API in a separate thread, transferring the data in parallel. Or the applications can call _sync() not after every commit, but only when the edge database becomes full.

Return Codes

MCO_S_OK
Transaction committed successfully.
MCO_E_ILLEGAL_PARAM
The transaction handle t is invalid or NULL.
<stored_error_code>
Any error code recorded during transaction execution. The transaction is automatically rolled back, and this code is returned.

Files

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