backend.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package system // import "github.com/docker/docker/api/server/router/system"
  2. import (
  3. "context"
  4. "time"
  5. "github.com/docker/docker/api/types"
  6. "github.com/docker/docker/api/types/events"
  7. "github.com/docker/docker/api/types/filters"
  8. "github.com/docker/docker/api/types/registry"
  9. "github.com/docker/docker/api/types/swarm"
  10. "github.com/docker/docker/api/types/system"
  11. )
  12. // DiskUsageOptions holds parameters for system disk usage query.
  13. type DiskUsageOptions struct {
  14. // Containers controls whether container disk usage should be computed.
  15. Containers bool
  16. // Images controls whether image disk usage should be computed.
  17. Images bool
  18. // Volumes controls whether volume disk usage should be computed.
  19. Volumes bool
  20. }
  21. // Backend is the methods that need to be implemented to provide
  22. // system specific functionality.
  23. type Backend interface {
  24. SystemInfo(context.Context) (*system.Info, error)
  25. SystemVersion(context.Context) (types.Version, error)
  26. SystemDiskUsage(ctx context.Context, opts DiskUsageOptions) (*types.DiskUsage, error)
  27. SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan interface{})
  28. UnsubscribeFromEvents(chan interface{})
  29. AuthenticateToRegistry(ctx context.Context, authConfig *registry.AuthConfig) (string, string, error)
  30. }
  31. // ClusterBackend is all the methods that need to be implemented
  32. // to provide cluster system specific functionality.
  33. type ClusterBackend interface {
  34. Info(context.Context) swarm.Info
  35. }
  36. // StatusProvider provides methods to get the swarm status of the current node.
  37. type StatusProvider interface {
  38. Status() string
  39. }