3 unstable releases

0.2.0 Mar 10, 2022
0.1.2 Dec 30, 2021
0.1.1 Dec 28, 2021

#63 in Build Utils

Download history 497/week @ 2022-08-15 497/week @ 2022-08-22 385/week @ 2022-08-29 437/week @ 2022-09-05 286/week @ 2022-09-12 424/week @ 2022-09-19 420/week @ 2022-09-26 518/week @ 2022-10-03 679/week @ 2022-10-10 1113/week @ 2022-10-17 527/week @ 2022-10-24 948/week @ 2022-10-31 939/week @ 2022-11-07 666/week @ 2022-11-14 1664/week @ 2022-11-21 1038/week @ 2022-11-28

4,315 downloads per month
Used in 2 crates (via containerd-shim)

Apache-2.0

760KB
18K SLoC

Shim protos and client for containerd

Crates.io docs.rs Crates.io CI

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.

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.

Usage

Add containerd-shim-client as a dependency in your Cargo.toml

[dependencies]
containerd-shim-protos = "0.1"

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

Dependencies

~3–9MB
~163K SLoC