backend.go 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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(clustertypes.NetworkCreateRequest, string) (<-chan struct{}, error)
  28. ReleaseIngress() (<-chan struct{}, error)
  29. PullImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
  30. CreateManagedContainer(config types.ContainerCreateConfig) (container.ContainerCreateCreatedBody, error)
  31. ContainerStart(name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error
  32. ContainerStop(name string, seconds *int) error
  33. ContainerLogs(context.Context, string, *backend.ContainerLogsConfig, chan struct{}) error
  34. ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
  35. ActivateContainerServiceBinding(containerName string) error
  36. DeactivateContainerServiceBinding(containerName string) error
  37. UpdateContainerServiceConfig(containerName string, serviceConfig *clustertypes.ServiceConfig) error
  38. ContainerInspectCurrent(name string, size bool) (*types.ContainerJSON, error)
  39. ContainerWaitWithContext(ctx context.Context, name string) error
  40. ContainerRm(name string, config *types.ContainerRmConfig) error
  41. ContainerKill(name string, sig uint64) error
  42. SetContainerSecretStore(name string, store exec.SecretGetter) error
  43. SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error
  44. SystemInfo() (*types.Info, error)
  45. VolumeCreate(name, driverName string, opts, labels map[string]string) (*types.Volume, error)
  46. Containers(config *types.ContainerListOptions) ([]*types.Container, error)
  47. SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
  48. DaemonJoinsCluster(provider cluster.Provider)
  49. DaemonLeavesCluster()
  50. IsSwarmCompatible() error
  51. SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
  52. UnsubscribeFromEvents(listener chan interface{})
  53. UpdateAttachment(string, string, string, *network.NetworkingConfig) error
  54. WaitForDetachment(context.Context, string, string, string, string) error
  55. GetRepository(context.Context, reference.NamedTagged, *types.AuthConfig) (distribution.Repository, bool, error)
  56. LookupImage(name string) (*types.ImageInspect, error)
  57. PluginManager() *plugin.Manager
  58. PluginGetter() *plugin.Store
  59. }