lib: make it mandatory to have seek_X if can_seek_X is defined
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 26 Sep 2019 18:26:29 +0000 (14:26 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 3 Oct 2019 17:27:58 +0000 (13:27 -0400)
commit2e1b56154a3032b52687751ed2e5c1a8a5134f7c
tree635ad6904dc1b28a60a08cb2af8117392ebc7997
parentc0e46a7c2b7bdd588eb716191940bf5b34f9fc5b
lib: make it mandatory to have seek_X if can_seek_X is defined

It's currently possible for a component class to provide can_seek_X
(can_seek_beginning or can_seek_ns_from_origin) without the
corresponding seek_X.  This doesn't make much sense, as if can_seek_X
returns true, Babeltrace assumes that seek_X can be called (which is
inconvenient if it's not provided).  That only leaves room for the case
where can_seek_X always returns false, which is not useful.

This patch makes it only possible to provide a can_seek_X if the
corresponding seek_X is provided, for both C and Python user component
classes.  It's still possible, however, to provide seek_X without
can_seek_X, in which case Babeltrace assumes that it's always possible
to call seek_X.

In the C API, component class method setters for seek_X and can_seek_X
are merged in a single function that sets both.  Since we assert that
seek_X is not NULL, this ensures that can_seek_X can only provided along
with a seek_X.

In the Python API, this verification is done dynamically when a user
message iterator class is assigned to a source or filter component
class.

Change-Id: If596d35dc3327bfd6e3f1e59f74c43dce3a722e1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2100
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
14 files changed:
include/babeltrace2/graph/component-class-filter.h
include/babeltrace2/graph/component-class-source.h
include/babeltrace2/plugin/plugin-dev.h
src/bindings/python/bt2/bt2/component.py
src/bindings/python/bt2/bt2/native_bt_component_class.i.h
src/lib/graph/component-class.c
src/lib/graph/iterator.c
src/lib/graph/message/iterator.h
src/lib/plugin/plugin-so.c
src/plugins/ctf/plugin.c
src/plugins/lttng-utils/plugin.c
src/plugins/text/plugin.c
src/plugins/utils/plugin.c
tests/bindings/python/bt2/test_message_iterator.py
This page took 0.026628 seconds and 4 git commands to generate.