@@ -25,9 +25,9 @@ import (
2525 "os/exec"
2626 "sync"
2727
28- "github.com/containerd/containerd"
29- "github.com/containerd/containerd/oci"
3028 types "github.com/containerd/nri/types/v1"
29+
30+ oci "github.com/opencontainers/runtime-spec/specs-go"
3131 "github.com/pkg/errors"
3232)
3333
@@ -74,13 +74,29 @@ type Sandbox struct {
7474 Labels map [string ]string
7575}
7676
77+ // process is a subset of containerd's Process interface.
78+ type process interface {
79+ // ID of the process
80+ ID () string
81+ // Pid is the system specific process id
82+ Pid () uint32
83+ }
84+
85+ // Task is ta subset of containerd's Task interface.
86+ type Task interface {
87+ process
88+
89+ // Spec returns the current OCI specification for the task
90+ Spec (context.Context ) (* oci.Spec , error )
91+ }
92+
7793// Invoke the ConfList of nri plugins
78- func (c * Client ) Invoke (ctx context.Context , task containerd. Task , state types.State ) ([]* types.Result , error ) {
94+ func (c * Client ) Invoke (ctx context.Context , task Task , state types.State ) ([]* types.Result , error ) {
7995 return c .InvokeWithSandbox (ctx , task , state , nil )
8096}
8197
8298// InvokeWithSandbox invokes the ConfList of nri plugins
83- func (c * Client ) InvokeWithSandbox (ctx context.Context , task containerd. Task , state types.State , sandbox * Sandbox ) ([]* types.Result , error ) {
99+ func (c * Client ) InvokeWithSandbox (ctx context.Context , task Task , state types.State , sandbox * Sandbox ) ([]* types.Result , error ) {
84100 if len (c .conf .Plugins ) == 0 {
85101 return nil , nil
86102 }
0 commit comments