lib: add user attributes property to metadata, stream, and trace objects
This patch adds an optional user attributes property to the following
trace IR objects:
* Clock class
* Event class
* Field class
* Structure field class member
* Variant field class option
* Stream class
* Stream
* Trace class
* Trace
A user attributes object is a map value object which adds custom
information to any of the objects above. It is entirely up to the user
to set user attributes. At creation time, all the objects above contain
an initial, empty map value.
CTF 2 will very likely have such user attributes for metadata objects,
so Babeltrace 2.0 will be ready.
For CTF 2, it is intended that user attributes will be namespaced to
reduce or eliminate clashes, for example using URLs or domain names,
which are also typically used for Java packages and XML namespaces:
{
"https://lttng.org": {
"some-attribute": true
}
}
CTF 2 will only have user attributes for metadata objects, but I decided
to also have user attributes for long-lived data objects: streams and
traces.
This is not enforced in Babeltrace however: the user is free to put
whatever she needs into this map value.
There's a bt_*_set_user_attributes() function to set the user attributes
of an object and
bt_*_borrow_user_attributes()/bt_*_borrow_user_attributes_const()
functions to borrow them from the object.
This patch changes when structure field class members and variant field
class options are frozen:
Before this patch:
When you append to a structure/variant field class, the
member/option is frozen, including its field class.
With this patch:
When you append to a structure/variant field class, the
member/option itself is not frozen, but its field class is.
The member/option is frozen when its containing structure/variant
field class is frozen.
This makes it possible to append a member/option to a structure/variant
field class, borrow that member/option, and then set its user attributes
before the whole structure/variant field class is frozen.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibb12de23fb2c4d752b13381769d2ac1841eb5dc9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1922
Tested-by: jenkins <jenkins@lttng.org>
28 files changed:
This page took 0.028779 seconds and 4 git commands to generate.