Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com> |
||
|---|---|---|
| .. | ||
| examples | ||
| src | ||
| tests | ||
| vendor | ||
| Cargo.toml | ||
| README.md | ||
| build.rs | ||
README.md
Shim protos and client for containerd
TTRPC bindings for containerd's shim events and interfaces.
Design
The containerd-shim-protos crate provides Protobuf message
and TTRPC service definitions for the
Containerd shim v2 protocol.
Usage
Add containerd-shim-client as a dependency in your Cargo.toml
[dependencies]
containerd-shim-protos = "0.4"
Basic client code looks as follows:
let client = client::Client::connect(socket_path)?;
let task_client = client::TaskClient::new(client);
let context = client::ttrpc::context::with_timeout(0);
let req = client::api::ConnectRequest {
id: pid,
..Default::default()
};
let resp = task_client.connect(context, &req)?;
Example
The way to build the example:
# build sync connect, client and server
$ cargo build --example shim-proto-connect
$ sudo ./shim-proto-connect unix:///containerd-shim/shim_socket_path.sock
$ cargo build --example shim-proto-client
$ cargo build --example shim-proto-server
# build async connect, client and server
$ cargo build --example shim-proto-connect-async --features async
$ cargo build --example shim-proto-client-async --features async
$ cargo build --example shim-proto-server-async --features async