github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/daemon/cluster/executor/backend.go (about)

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