Skip to content

Meta Data Interface

Florian Forster edited this page Nov 26, 2023 · 1 revision
Clone this wiki locally

The meta data interface provides code with a simple and straight forward possibility to attach some information to an already existing struct. It is currently included in the value-list-t structure and in the global-cache. It will be added to the notification-t structure (which already has a similar data structure which will be replaced).

Data attached to a value list will be discarded when the value list is freed. This can be used to pass data along with the value, for example “was received via the network plugin”. This is how the Forward option is currently implemented. Meta data in the global cache can be used to store arbitrary information about an identifier, for example “has been sent over the network”. This is currently used to avoid loops when forwarding is enabled. Another example is the implementation of the Scale target.

A set of meta data is represented by an opaque data structure of type meta_data_t. A pointer to a newly allocated data structure can be obtained using meta_data_create. The pointer must be freed using meta_data_destroy.

The information stored within such a structure is organized in a key-value fashion, i. e. a string value is used to identify values. If the key already exists when adding a new value, the old value will be discarded. The use of a prefix to prevent name clashes is recommended.


All declarations are in the src/meta_data.h header file.

 #include "meta_data.h"

See also