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)
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>

No differences found
This page took 0.026001 seconds and 4 git commands to generate.