Crate containerd_shim_protos[][src]

Expand description

containerd-shim-protos contains TTRPC bindings and client/server code to interact with containerd’s runtime v2 shims.

Runtime

This crate is mainly expected to be useful to interact with containerd’s shim runtime. Runtime v2 introduces a first class shim API for runtime authors to integrate with containerd. The shim API is minimal and scoped to the execution lifecycle of a container.

To learn how containerd’s shim v2 runtime works in details, please refer to the documentation.

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.

Examples

Here is a quick example how to use the crate:

use containerd_shim_protos as client;

use client::api;
use client::ttrpc::context::Context;

// Create TTRPC client
let client = client::Client::connect("unix:///socket.sock").unwrap();

// Get task client
let task_client = client::TaskClient::new(client);
let context = Context::default();

// Send request and receive response
let request = api::ConnectRequest::default();
let response = task_client.connect(Context::default(), &request);

Re-exports

pub use protobuf;
pub use ttrpc;
pub use shim::shim_ttrpc::create_task;
pub use shim::shim_ttrpc::Task;
pub use shim::shim_ttrpc::TaskClient;
pub use shim::events_ttrpc::create_events;
pub use shim::events_ttrpc::Events;
pub use shim::events_ttrpc::EventsClient;

Modules

Reexport auto-generated public data structures.

Generated event structures.

Includes event names shims can publish to containerd. Task event topic typically used in shim implementations.

Structs

TTRPC client reexport for easier access.