github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/internal/containerizedengine/types.go (about)

     1  package containerizedengine
     2  
     3  import (
     4  	"context"
     5  	"errors"
     6  
     7  	"github.com/containerd/containerd"
     8  	"github.com/containerd/containerd/containers"
     9  	"github.com/containerd/containerd/content"
    10  )
    11  
    12  const (
    13  	containerdSockPath = "/run/containerd/containerd.sock"
    14  	engineNamespace    = "com.docker"
    15  )
    16  
    17  var (
    18  	// ErrEngineAlreadyPresent returned when engine already present and should not be
    19  	ErrEngineAlreadyPresent = errors.New("engine already present, use the update command to change versions")
    20  
    21  	// ErrEngineNotPresent returned when the engine is not present and should be
    22  	ErrEngineNotPresent = errors.New("engine not present")
    23  
    24  	// ErrMalformedConfigFileParam returned if the engine config file parameter is malformed
    25  	ErrMalformedConfigFileParam = errors.New("malformed --config-file param on engine")
    26  
    27  	// ErrEngineConfigLookupFailure returned if unable to lookup existing engine configuration
    28  	ErrEngineConfigLookupFailure = errors.New("unable to lookup existing engine configuration")
    29  
    30  	// ErrEngineShutdownTimeout returned if the engine failed to shutdown in time
    31  	ErrEngineShutdownTimeout = errors.New("timeout waiting for engine to exit")
    32  )
    33  
    34  type baseClient struct {
    35  	cclient containerdClient
    36  }
    37  
    38  // containerdClient abstracts the containerd client to aid in testability
    39  type containerdClient interface {
    40  	Containers(ctx context.Context, filters ...string) ([]containerd.Container, error)
    41  	NewContainer(ctx context.Context, id string, opts ...containerd.NewContainerOpts) (containerd.Container, error)
    42  	Pull(ctx context.Context, ref string, opts ...containerd.RemoteOpt) (containerd.Image, error)
    43  	GetImage(ctx context.Context, ref string) (containerd.Image, error)
    44  	Close() error
    45  	ContentStore() content.Store
    46  	ContainerService() containers.Store
    47  	Install(context.Context, containerd.Image, ...containerd.InstallOpts) error
    48  	Version(ctx context.Context) (containerd.Version, error)
    49  }