github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/daemon/cluster/executor/backend.go (about)

     1  package executor // import "github.com/demonoid81/moby/daemon/cluster/executor"
     2  
     3  import (
     4  	"context"
     5  	"io"
     6  	"time"
     7  
     8  	"github.com/docker/distribution"
     9  	"github.com/docker/distribution/reference"
    10  	"github.com/demonoid81/moby/api/types"
    11  	"github.com/demonoid81/moby/api/types/backend"
    12  	"github.com/demonoid81/moby/api/types/container"
    13  	"github.com/demonoid81/moby/api/types/events"
    14  	"github.com/demonoid81/moby/api/types/filters"
    15  	"github.com/demonoid81/moby/api/types/network"
    16  	swarmtypes "github.com/demonoid81/moby/api/types/swarm"
    17  	containerpkg "github.com/demonoid81/moby/container"
    18  	clustertypes "github.com/demonoid81/moby/daemon/cluster/provider"
    19  	networkSettings "github.com/demonoid81/moby/daemon/network"
    20  	"github.com/demonoid81/moby/plugin"
    21  	volumeopts "github.com/demonoid81/moby/volume/service/opts"
    22  	"github.com/demonoid81/libnetwork"
    23  	"github.com/demonoid81/libnetwork/cluster"
    24  	networktypes "github.com/demonoid81/libnetwork/types"
    25  	"github.com/docker/swarmkit/agent/exec"
    26  	specs "github.com/opencontainers/image-spec/specs-go/v1"
    27  )
    28  
    29  // Backend defines the executor component for a swarm agent.
    30  type Backend interface {
    31  	CreateManagedNetwork(clustertypes.NetworkCreateRequest) error
    32  	DeleteManagedNetwork(networkID string) error
    33  	FindNetwork(idName string) (libnetwork.Network, error)
    34  	SetupIngress(clustertypes.NetworkCreateRequest, string) (<-chan struct{}, error)
    35  	ReleaseIngress() (<-chan struct{}, error)
    36  	CreateManagedContainer(config types.ContainerCreateConfig) (container.ContainerCreateCreatedBody, error)
    37  	ContainerStart(name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error
    38  	ContainerStop(name string, seconds *int) error
    39  	ContainerLogs(context.Context, string, *types.ContainerLogsOptions) (msgs <-chan *backend.LogMessage, tty bool, err error)
    40  	ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
    41  	ActivateContainerServiceBinding(containerName string) error
    42  	DeactivateContainerServiceBinding(containerName string) error
    43  	UpdateContainerServiceConfig(containerName string, serviceConfig *clustertypes.ServiceConfig) error
    44  	ContainerInspectCurrent(name string, size bool) (*types.ContainerJSON, error)
    45  	ContainerWait(ctx context.Context, name string, condition containerpkg.WaitCondition) (<-chan containerpkg.StateStatus, error)
    46  	ContainerRm(name string, config *types.ContainerRmConfig) error
    47  	ContainerKill(name string, sig uint64) error
    48  	SetContainerDependencyStore(name string, store exec.DependencyGetter) error
    49  	SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error
    50  	SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error
    51  	SystemInfo() *types.Info
    52  	Containers(config *types.ContainerListOptions) ([]*types.Container, error)
    53  	SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
    54  	DaemonJoinsCluster(provider cluster.Provider)
    55  	DaemonLeavesCluster()
    56  	IsSwarmCompatible() error
    57  	SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
    58  	UnsubscribeFromEvents(listener chan interface{})
    59  	UpdateAttachment(string, string, string, *network.NetworkingConfig) error
    60  	WaitForDetachment(context.Context, string, string, string, string) error
    61  	PluginManager() *plugin.Manager
    62  	PluginGetter() *plugin.Store
    63  	GetAttachmentStore() *networkSettings.AttachmentStore
    64  	HasExperimental() bool
    65  }
    66  
    67  // VolumeBackend is used by an executor to perform volume operations
    68  type VolumeBackend interface {
    69  	Create(ctx context.Context, name, driverName string, opts ...volumeopts.CreateOption) (*types.Volume, error)
    70  }
    71  
    72  // ImageBackend is used by an executor to perform image operations
    73  type ImageBackend interface {
    74  	PullImage(ctx context.Context, image, tag string, platform *specs.Platform, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
    75  	GetRepository(context.Context, reference.Named, *types.AuthConfig) (distribution.Repository, bool, error)
    76  	LookupImage(name string) (*types.ImageInspect, error)
    77  }