pub trait Shim {
    type T: Task + Send + Sync;

    // Required methods
    fn new(runtime_id: &str, args: &Flags, config: &mut Config) -> Self;
    fn start_shim(&mut self, opts: StartOpts) -> Result<String>;
    fn delete_shim(&mut self) -> Result<DeleteResponse>;
    fn wait(&mut self);
    fn create_task_service(&self, publisher: RemotePublisher) -> Self::T;
}
Expand description

Main shim interface that must be implemented by all shims.

Start and delete routines will be called to handle containerd’s shim lifecycle requests.

Required Associated Types§

source

type T: Task + Send + Sync

Type to provide task service for the shim.

Required Methods§

source

fn new(runtime_id: &str, args: &Flags, config: &mut Config) -> Self

Create a new instance of Shim.

Arguments
  • runtime_id: identifier of the container runtime.
  • args: command line arguments passed to the shim which includes namespace and id
  • config: for the shim to pass back configuration information
source

fn start_shim(&mut self, opts: StartOpts) -> Result<String>

Start shim will be called by containerd when launching new shim instance.

It expected to return TTRPC address containerd daemon can use to communicate with the given shim instance.

See https://github.com/containerd/containerd/tree/master/runtime/v2#start

source

fn delete_shim(&mut self) -> Result<DeleteResponse>

Delete shim will be called by containerd after shim shutdown to cleanup any leftovers.

source

fn wait(&mut self)

Wait for the shim to exit.

source

fn create_task_service(&self, publisher: RemotePublisher) -> Self::T

Create the task service object.

Object Safety§

This trait is not object safe.

Implementors§