Checks whether there is sufficient space in the ring buffer to create a new object of the specified class.
For an overview, see the Edge Client page.
MCO_RET mco_edge_has_space(mco_trans_h t, mco_uint2 class_code);
t
mco_edge_trans_start() call.class_code
CLASS_Sensor) or can be retrieved via dictionary query functions.Checks whether there is sufficient space in the edge database ring buffer to create a new object of the specified class.
The most common error during an edge transaction is insufficient buffer space for creating a new object. In such cases, the
generated Class_new() function returns MCO_E_NOMEM. This error is recorded in the transaction context
and will automatically trigger a rollback when mco_edge_trans_commit() is called.
To proactively avoid this situation, mco_edge_has_space() should be called before invoking Class_new().
If it returns MCO_S_OK, the creation of the object is guaranteed to succeed within the current transaction.
Buffer Management & Concurrency: The available buffer space is dynamic. Space may be freed by transmitting
and clearing completed transactions via mco_edge_sync() and mco_edge_clear(). These functions can
be invoked within the same transaction (if the execution model permits) or concurrently in another thread. The application
is responsible for coordinating synchronization and commit operations (e.g., implementing appropriate waiting, retry, or backoff strategies).
MCO_S_OK
MCO_E_ILLEGAL_PARAM
MCO_S_BUSY
mco_edge_sync() and/or
mco_edge_clear() may free the required space (i.e., the buffer is occupied by completed but not
yet transmitted transactions). These functions may be invoked within the same transaction or
executed concurrently in another thread. Coordination between sync() and commit() threads
(e.g., waiting strategies) must be handled by the application.MCO_E_NOMEM
sync()/clear() cannot free sufficient
space (uncommitted transactions cannot be transmitted). The current transaction must be completed (committed or rolled back) before
attempting to create more objects.