As mentioned in my reviews, I wonder if we should make our python
callbacks look a bit more Pythonic by having kwargs added for each
new flag that we want to expose. The idea was first floated here:
https://www.redhat.com/archives/libguestfs/2018-April/msg00108.html
Note that with my proposal, there is no need for a python script to
expose a global API_VERSION variable; new flags are added using a
Python API that is backwards-compatible. In fact, with introspection,
we can even get away with the user not having to write a
can_fast_zero; the mere presence of support for a fast=... kw
parameter is enough to let us pick the correct default.
However, there are aspects of Rich's proposal that I like better: for
example, by having an explicit API_VERSION variable, we can change the
interface of pread to read directly into a buffer, which my code can't
do. And although mine produces interfaces that feel a bit more
Pythonic, I also note that mine requires more lines of code (and
that's without even implementing the cache/can_cache callback present
in Rich's proposal). Thus, this is an RFC to see which pieces we like
best out of the various proposals, rather than something that should
be applied as-is.
Eric Blake (5):
python: Let zero's may_trim parameter be optional
python: Expose can_zero callback
python: Update internals to plugin API level 2
python: Expose FUA support
python: Add can_fast_zero support
plugins/python/nbdkit-python-plugin.pod | 122 ++++++++--
plugins/python/python.c | 286 ++++++++++++++++++++++--
plugins/python/example.py | 6 +-
tests/test.py | 6 +-
4 files changed, 375 insertions(+), 45 deletions(-)
--
2.21.0