rust-extensions/crates/shim-protos
Maksym Pavlenko 559bf7bc8d Bump shim-protos to 0.1.2
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-30 09:14:03 +02:00
..
examples Rename shim-client to shim-protos 2021-12-30 08:43:32 +02:00
src [shim-protos] Update README 2021-12-30 09:12:54 +02:00
tests Rename shim-client to shim-protos 2021-12-30 08:43:32 +02:00
vendor Rename shim-client to shim-protos 2021-12-30 08:43:32 +02:00
Cargo.toml Bump shim-protos to 0.1.2 2021-12-30 09:14:03 +02:00
README.md [shim-protos] Update README 2021-12-30 09:12:54 +02:00
build.rs Rename shim-client to shim-protos 2021-12-30 08:43:32 +02:00

README.md

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 TTRPC client connect example:

$ cargo build --example connect
$ sudo ./connect unix:///containerd-shim/shim_socket_path.sock