backend.go 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. clustertypes "github.com/docker/docker/daemon/cluster/provider"
  15. "github.com/docker/docker/plugin"
  16. "github.com/docker/libnetwork"
  17. "github.com/docker/libnetwork/cluster"
  18. networktypes "github.com/docker/libnetwork/types"
  19. "github.com/docker/swarmkit/agent/exec"
  20. "golang.org/x/net/context"
  21. )
  22. // Backend defines the executor component for a swarm agent.
  23. type Backend interface {
  24. CreateManagedNetwork(clustertypes.NetworkCreateRequest) error
  25. DeleteManagedNetwork(name string) error
  26. FindNetwork(idName string) (libnetwork.Network, error)
  27. SetupIngress(req clustertypes.NetworkCreateRequest, nodeIP string) error
  28. PullImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
  29. CreateManagedContainer(config types.ContainerCreateConfig) (container.ContainerCreateCreatedBody, error)
  30. ContainerStart(name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error
  31. ContainerStop(name string, seconds *int) error
  32. ContainerLogs(context.Context, string, *backend.ContainerLogsConfig, chan struct{}) error
  33. ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
  34. ActivateContainerServiceBinding(containerName string) error
  35. DeactivateContainerServiceBinding(containerName string) error
  36. UpdateContainerServiceConfig(containerName string, serviceConfig *clustertypes.ServiceConfig) error
  37. ContainerInspectCurrent(name string, size bool) (*types.ContainerJSON, error)
  38. ContainerWaitWithContext(ctx context.Context, name string) error
  39. ContainerRm(name string, config *types.ContainerRmConfig) error
  40. ContainerKill(name string, sig uint64) error
  41. SetContainerSecretStore(name string, store exec.SecretGetter) error
  42. SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error
  43. SystemInfo() (*types.Info, error)
  44. VolumeCreate(name, driverName string, opts, labels map[string]string) (*types.Volume, error)
  45. Containers(config *types.ContainerListOptions) ([]*types.Container, error)
  46. SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
  47. DaemonJoinsCluster(provider cluster.Provider)
  48. DaemonLeavesCluster()
  49. IsSwarmCompatible() error
  50. SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
  51. UnsubscribeFromEvents(listener chan interface{})
  52. UpdateAttachment(string, string, string, *network.NetworkingConfig) error
  53. WaitForDetachment(context.Context, string, string, string, string) error
  54. GetRepository(context.Context, reference.NamedTagged, *types.AuthConfig) (distribution.Repository, bool, error)
  55. LookupImage(name string) (*types.ImageInspect, error)
  56. PluginManager() *plugin.Manager
  57. PluginGetter() *plugin.Store
  58. }