backend.go 3.5 KB

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