Expand description
A Rust implementation of the OVSDB
schema and wire format.
ovsdb
provides a Rust interface to an OVSDB
server. It utilizes serde
for protocol processing and tokio
for asynchronous io. Its features
include:
- automated generation of Rust models via
ovsdb-build
- strongly typed interfaces to OVSDB data structures
- automatic conversion to/from OVSDB protocol types
§Overview
Interacting with a database server is a 3-step process.
- Load a copy of the Schema for the database
- Build
rust
modules represent the Table’s in the schema - Connect to the database via a Client and execute methods
Steps 1 and 2 above are handled by ovsdb-build
.
§Requirements
To use the models generated by ovsdb-build
, it is also necessary to install serde
with the derive
feature flag enabled.
$ cargo add serde --features derive
As ovsdb
also utilizes tokio
for asynchronous io and process management, an async
runtime is required. See the tokio
documentation for more details.
§Example
use std::path::Path;
use ovsdb::{Client, protocol::method::EchoResult};
#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
let client = Client::connect_unix(Path::new("/var/run/openvswitch/db.sock"))
.await
.unwrap();
let result: EchoResult = client.echo(vec!["Hello", "OVSDB"]).await.unwrap();
assert_eq!(*result, vec!["Hello".to_string(), "OVSDB".to_string()]);
client.stop().await.unwrap();
Ok(())
}
Re-exports§
pub use client::Client;
Modules§
- client
- TCP/Unix socket based OVSDB client.
- protocol
- OVSDB wire protocol implementation
- schema
- OVSDB Schema processing.
Macros§
- include_
schema - Include generated schema items.
Enums§
- Error
- This type represents all errors that can occur within OVSDB.
Traits§
- Entity
- An entity that can be retrieved from OVSDB.