[−][src]Crate nbdkit
Rust bindings to NBDKit.
NBDKit is a toolkit for building Network Block Device servers.
https://github.com/libguestfs/nbdkit
To use nbdkit, build your project as a cdylib. Define your plugin by
implementing Server
, and then register it with plugin!
. See
ramdisk.rs in the source code for a complete example.
#[derive(Default)] struct MyPlugin { // ... } impl Server for MyPlugin { fn get_size(&self) -> Result<i64> { // ... } fn name() -> &'static str { "my_plugin" } fn open(_readonly: bool) -> Box<dyn Server> { Box::new(MyPlugin::default()) } fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<()> { // ... } } plugin!(MyPlugin {});
Macros
plugin | Register your plugin with NBDKit. |
Structs
Error | The error type used by |
ExtentHandle | Used by |
Flags | Flags used by multiple |
Enums
CacheFlags | Return values for |
ExtentType | Used by |
FuaFlags | Return values for |
SockAddr | nix Represents a socket address |
ThreadModel | A plugin's maximum thread safety model |
Traits
Server | Define the entry point for your plugin. |
Functions
export_name | Return the optional NBD export name if one was negotiated with the current client |
is_stdio_safe | Is it safe to interact with stdin and stdout during the configuration phase? |
peername | nix Return the peer (client) address, if available. |
shutdown | Request nbdkit to asynchronously and safely shutdown the server. |
sockaddr_storage_to_addr⚠ | nix Return the appropriate |
Type Definitions
Result | The Result type returned by all |