bt2: let Python message iterators implement seek beginning
This patch adds the possibility for message iterators implemented in
Python to implement the "can seek beginning" and "seek beginning"
operations.
A message iterator can support "seek beginning" by defining a
_seek_beginning method:
class MyIter(bt2._UserMessageIterator):
def _seek_beginning(self):
# Do the needful.
It can support the "can seek beginning" operation by defining a
_can_seek_beginning property, which must evaluate to a bool:
class MyIter(bt2._UserMessageIterator):
@property
def _can_seek_beginning(self):
# Do the needful, including returning a bool.
The behavior of the "can seek beginning" operation is made to mimic
the C API:
- If the iterator has a _can_seek_beginning attribute, it is used to
determine whether the iterator can seek beginning.
- Otherwise, the presence or absence of a _seek_beginning method
indicates whether it can.
Change-Id: I68c48b5cd30090bff833529cda9fa918c7e72b0b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1555
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.026323 seconds and 4 git commands to generate.