I've created a workable async framework with the latest nbdkit code and a
sample file plugin using aio to service requests. This allows for a single
worker thread to issue multiple requests in parallel via a callback
mechanism. Existing locking mechanisms are preserved and if an async thread
model sets THREAD_MODEL < PARALLEL then nbdkit continues to properly
serialize.
The changes are split into 3 commits:
1) backend plumbing changes required to keep the memory for requests around
until completed
2) the async plugin backend
3) a sample plugin that uses aio and the async plugin backend
The patches would be large so rather than post them all here I've included
a link to the github diff
https://github.com/libguestfs/nbdkit/compare/master...dev-cloudbd:async