treedb_set_callback()

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

tranger

json_t *

Pointer to the tranger instance managing the tree database.

treedb_name

const char *

Name of the tree database where the callback will be set.

treedb_callback

treedb_callback_t

Function pointer to the callback that will be invoked on node operations.

user_data

void *

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