TTRPC bindings for containerd's shim events and interfaces.
The containerd-shim-protos
crate provides Protobuf message
and TTRPC service definitions for the
Containerd shim v2 protocol.
The message and service definitions are auto-generated from protobuf source files under vendor/
by using ttrpc-codegen. So please do not
edit those auto-generated source files. If upgrading/modification is needed, please follow the steps:
- Synchronize the latest protobuf source files from the upstream projects into directory 'vendor/'.
- Re-generate the source files by cargo build --features=generate_bindings
.
- Commit the synchronized protobuf source files and auto-generated source files, keeping them in synchronization.
Add containerd-shim-client
as a dependency in your Cargo.toml
toml
[dependencies]
containerd-shim-protos = "0.1"
Basic client code looks as follows:
```rust let client = client::Client::connect(socketpath)?; let taskclient = 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)?; ```
The way to build the example: ```bash
$ cargo build --example shim-proto-connect $ sudo ./shim-proto-connect unix:///containerd-shim/shimsocketpath.sock $ cargo build --example shim-proto-client $ cargo build --example shim-proto-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 ```