mco_edge_close

Shuts down an edge database instance and releases its associated resources.

For an overview, see the Edge Client page.

Prototype

    MCO_RET mco_edge_close(const char *db_name);
    

Arguments

db_name
Null-terminated string specifying the name of the edge database instance to close. Must match the name used in the corresponding mco_edge_open() call.

Description

Shuts down the specified edge database instance and releases all associated resources, including the ring buffer, communication buffers, and internal data structures. This function is analogous to mco_db_close() in the core runtime.

Before calling mco_edge_close(), ensure that all transactions on the database have been committed or rolled back, and that no active connections remain. The function will fail if the database is still in use.

After successful closure, the memory region originally passed to mco_edge_open() may be safely reused or freed by the application.

Return Codes

MCO_S_OK
Database instance closed successfully.
MCO_E_OPENED_SESSIONS
The database has active connections. Close all sessions before calling mco_edge_close().
MCO_E_NOINSTANCE
No edge database instance with the specified db_name exists.

Files

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