Deletes data that has been transmitted and acknowledged by the peer.
MCO_RET mco_iot_replicator_clear(mco_iot_replicator_h repl,
mco_iot_agent_id_t agent_id);
repl
agent_id
The device_id to clear or one of the following constants:
MCO_IOT_ALL_AGENTS — Synchronizes all connected devices.MCO_IOT_SERVER_AGENT_ID — Denotes the server node.MCO_IOT_ALL_UP_AGENTS — All directly or indirectly connected nodes with a lower level value.MCO_IOT_ALL_DOWN_AGENTS — All directly or indirectly connected nodes with a higher level value.
The function deletes data that has been transmitted and acknowledged by the peer, where
agent_id is the ID of a specific agent or
MCO_IOT_ALL_AGENTS.
MCO_S_OK
MCO_E_IOT_INVALID_HANDLE
repl.MCO_E_IOT_NOT_INITIALIZED
MCO_E_IOT_WRONG_AGENT_ID
agent_id is not valid.MCO_E_ILLEGAL_PARAM
agent_id=MCO_IOT_SERVER_AGENT_ID cannot be used on the server.
MCO_E_SESLIMIT
connect() errors if the function cannot create a database connection.mco_trans_start()
errors
mco_trans_commit()
errors
other errors
// onAck callback
int iot_on_ack(mco_iot_connection_h iotc, const iot_ack_t *ack, void *context)
{
// Remove unnecessary data on receiving positive ACK
if (ack->error_code == MCO_S_OK)
{
mco_iot_replicator_h repl = (mco_iot_replicator_h) context;
mco_iot_agent_id_t agent_id = mco_iot_conn_get_agent_id(iotc);
mco_iot_replicator_clear(repl, agent_id);
}
return IOT_CALLBACK_OK;
}