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