On 8/16/19 12:08 PM, Eric Blake wrote:
We do not promise API stability for non-C languages; this is an API break as follows: instead of calling plugin_init with a static model, you can now populate .thread_model in the Plugin struct, with a default to Parallel. As in C, the model is still chosen at .load time (at most, making it a function allows you to alter it based on configuration), and not something that can change per-connection.
Since all existing Rust plugins will have already thought about thread models, they can convert their existing model into the new .thread_model field (and thus, I don't feel too bad making Parallel the default, even if it is not always the safest).
+++ b/plugins/rust/nbdkit-rust-plugin.pod @@ -37,14 +37,19 @@ compatible with the C struct used by C plugins. use nbdkit::ThreadModel::*;
#[no_mangle] + extern fn myplugin_thread_model () -> ThreadModel { + Serialize_AllRequests
This is the wrong spelling. But in fixing it, it turns out we had pre-existing typos (our .pod used _, but lib.rs did not). So I squashed in that fix locally. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org