backend.go 3.4 KB

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