backend.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package image
  2. import (
  3. "io"
  4. "github.com/docker/docker/api/types"
  5. "github.com/docker/docker/api/types/backend"
  6. "github.com/docker/docker/api/types/registry"
  7. "golang.org/x/net/context"
  8. )
  9. // Backend is all the methods that need to be implemented
  10. // to provide image specific functionality.
  11. type Backend interface {
  12. containerBackend
  13. imageBackend
  14. importExportBackend
  15. registryBackend
  16. }
  17. type containerBackend interface {
  18. Commit(name string, config *backend.ContainerCommitConfig) (imageID string, err error)
  19. }
  20. type imageBackend interface {
  21. ImageDelete(imageRef string, force, prune bool) ([]types.ImageDelete, error)
  22. ImageHistory(imageName string) ([]*types.ImageHistory, error)
  23. Images(filterArgs string, filter string, all bool, withExtraAttrs bool) ([]*types.ImageSummary, error)
  24. LookupImage(name string) (*types.ImageInspect, error)
  25. TagImage(imageName, repository, tag string) error
  26. ImagesPrune(config *types.ImagesPruneConfig) (*types.ImagesPruneReport, error)
  27. }
  28. type importExportBackend interface {
  29. LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error
  30. ImportImage(src string, repository, tag string, msg string, inConfig io.ReadCloser, outStream io.Writer, changes []string) error
  31. ExportImage(names []string, outStream io.Writer) error
  32. }
  33. type registryBackend interface {
  34. PullImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
  35. PushImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
  36. SearchRegistryForImages(ctx context.Context, filtersArgs string, term string, limit int, authConfig *types.AuthConfig, metaHeaders map[string][]string) (*registry.SearchResults, error)
  37. }