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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 9 Oct 2019 18:14:29 +0000 (14:14 -0400)
commit7f8e969d87698ed7aacc36722565f23cd160fd80
tree99025f1119344da98ed22b33768741cb4243d699
parentc49bf79b7d7e87cc21d065a7d208bcc238fb0800
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.02536 seconds and 4 git commands to generate.