mco_edge_used_space

Returns the amount of used space in the edge database ring buffer in bytes.

For an overview, see the Edge Client page.

Prototype

    MCO_RET mco_edge_used_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 amount of currently used space in the ring buffer, in bytes. This includes space occupied by both committed (pending sync) and uncommitted transaction data.

Description

Returns the amount of used space in the edge database ring buffer in bytes, analogous to calculating (mco_db_total_pages() - mco_db_free_pages()) * mco_db_page_size() in the core runtime.

This function is useful for monitoring buffer utilization, estimating remaining capacity for new transactions, or implementing custom memory management strategies. The returned value reflects the total space consumed by all active and pending transactions within the ring buffer structure.

To determine the available free space, you can subtract the result of mco_edge_used_space() from the result of mco_edge_total_space().

Return Codes

MCO_S_OK
The used space size was successfully retrieved.
MCO_E_ILLEGAL_PARAM
One or more parameter values are invalid.

Files

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