backend.go 1.5 KB

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