mco_edge_total_space

Returns the total size of the edge database ring buffer in bytes.

For an overview, see the Edge Client page.

Prototype

    MCO_RET mco_edge_total_space(mco_edge_h con, mco_size_t *psize);
    

Arguments

con
Connection handle obtained from a previous mco_edge_connect() call.
psize
Pointer to a mco_size_t variable that will receive the total size of the ring buffer in bytes. This value represents the entire memory region allocated for the edge database, including headers, communication buffers, and the data storage area.

Description

Returns the total size of the edge database ring buffer in bytes, analogous to calculating mco_db_total_pages() * mco_db_page_size() in the core runtime.

This function is useful for monitoring memory usage, calculating the remaining available space for new transactions, or implementing custom buffer management strategies. The returned size includes all internal structures allocated within the memory region provided to mco_edge_open().

Note that the actual usable space for storing transaction data is less than the total size, as some memory is reserved for the database header, RX/TX communication buffers, and alignment padding.

Return Codes

MCO_S_OK
The total size was successfully retrieved.
MCO_E_ILLEGAL_PARAM
One or more parameter values are invalid (e.g., NULL con or psize).

Files

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