ctf: refactor metadata decoder to always have an instance
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 9 Jul 2019 23:40:45 +0000 (19:40 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2019 15:38:52 +0000 (11:38 -0400)
commit06be99464988953e390114337ccdd20622fb50d1
treeae727bca4a0ebc7cefd22cafadb46b8991ff8c57
parent87c882849d73c8567c517d630d4fba6d48b555cb
ctf: refactor metadata decoder to always have an instance

This patch changes the internal `ctf` plugin's metadata decoder API so
that you need to create a decoder instance to read properties instead of
calling ctf_metadata_decoder_packetized_file_stream_to_buf().

Now, you create a metadata decoder, you call
ctf_metadata_decoder_append_content() (similar to what was called
ctf_metadata_decoder_decode()), and then you can get the decoder's
current properties:

* ctf_metadata_decoder_get_ir_trace_class()
* ctf_metadata_decoder_borrow_ctf_trace_class()
* ctf_metadata_decoder_get_byte_order()
* ctf_metadata_decoder_get_uuid()
* ctf_metadata_decoder_get_text()

The decoder's configuration contains two new flags:

`create_trace_class`:
    Controls whether or not ctf_metadata_decoder_append_content()
    invokes the AST visitor to generate trace class objects.

    Trace classes are not needed, for example, for the `metadata-info`
    query.

`keep_plain_text`:
    Controls whether or not the decoder accumulates the metadata
    stream's plain text when you call
    ctf_metadata_decoder_append_content().

    This needs to be true to use ctf_metadata_decoder_get_text().

The goal of all this is to eventually add new metadata property getters
which do not need to create trace classes or to keep the metadata plain
text.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If1095da91aee0f446d7f5efcec765e5abbb2b30a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1842
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/ctf/common/metadata/decoder.c
src/plugins/ctf/common/metadata/decoder.h
src/plugins/ctf/fs-src/metadata.c
src/plugins/ctf/fs-src/query.c
src/plugins/ctf/lttng-live/metadata.c
This page took 0.0252 seconds and 4 git commands to generate.