backend.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package executor
  2. import (
  3. "io"
  4. "time"
  5. "github.com/docker/distribution"
  6. "github.com/docker/docker/api/types"
  7. "github.com/docker/docker/api/types/container"
  8. "github.com/docker/docker/api/types/events"
  9. "github.com/docker/docker/api/types/filters"
  10. "github.com/docker/docker/api/types/network"
  11. clustertypes "github.com/docker/docker/daemon/cluster/provider"
  12. "github.com/docker/docker/reference"
  13. "github.com/docker/libnetwork"
  14. "github.com/docker/libnetwork/cluster"
  15. networktypes "github.com/docker/libnetwork/types"
  16. "golang.org/x/net/context"
  17. )
  18. // Backend defines the executor component for a swarm agent.
  19. type Backend interface {
  20. CreateManagedNetwork(clustertypes.NetworkCreateRequest) error
  21. DeleteManagedNetwork(name string) error
  22. FindNetwork(idName string) (libnetwork.Network, error)
  23. SetupIngress(req clustertypes.NetworkCreateRequest, nodeIP string) error
  24. PullImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
  25. CreateManagedContainer(config types.ContainerCreateConfig, validateHostname bool) (container.ContainerCreateCreatedBody, error)
  26. ContainerStart(name string, hostConfig *container.HostConfig, validateHostname bool, checkpoint string, checkpointDir string) error
  27. ContainerStop(name string, seconds *int) error
  28. ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
  29. ActivateContainerServiceBinding(containerName string) error
  30. DeactivateContainerServiceBinding(containerName string) error
  31. UpdateContainerServiceConfig(containerName string, serviceConfig *clustertypes.ServiceConfig) error
  32. ContainerInspectCurrent(name string, size bool) (*types.ContainerJSON, error)
  33. ContainerWaitWithContext(ctx context.Context, name string) error
  34. ContainerRm(name string, config *types.ContainerRmConfig) error
  35. ContainerKill(name string, sig uint64) error
  36. SetContainerSecrets(name string, secrets []*container.ContainerSecret) error
  37. SystemInfo() (*types.Info, error)
  38. VolumeCreate(name, driverName string, opts, labels map[string]string) (*types.Volume, error)
  39. Containers(config *types.ContainerListOptions) ([]*types.Container, error)
  40. SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
  41. SetClusterProvider(provider cluster.Provider)
  42. IsSwarmCompatible() error
  43. SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
  44. UnsubscribeFromEvents(listener chan interface{})
  45. UpdateAttachment(string, string, string, *network.NetworkingConfig) error
  46. WaitForDetachment(context.Context, string, string, string, string) error
  47. GetRepository(context.Context, reference.NamedTagged, *types.AuthConfig) (distribution.Repository, bool, error)
  48. }