treedb_set_callback()
#
Sets a callback function for treedb_name
in tranger
. The callback is triggered on node operations such as creation, update, or deletion.
Prototype
int treedb_set_callback(
json_t *tranger,
const char *treedb_name,
treedb_callback_t treedb_callback,
void *user_data
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Pointer to the |
|
|
Name of the tree database where the callback will be set. |
|
|
Function pointer to the callback that will be invoked on node operations. |
|
|
User-defined data that will be passed to the callback function. |
Return Value
Returns 0
on success, or a negative error code on failure.
Notes
The callback function must follow the treedb_callback_t
signature and will receive parameters such as tranger
, treedb_name
, topic_name
, operation
, and node
. The callback is triggered on events like EV_TREEDB_NODE_CREATED
, EV_TREEDB_NODE_UPDATED
, and EV_TREEDB_NODE_DELETED
.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples