github.com/rish1988/moby@v25.0.2+incompatible/api/server/router/system/backend.go (about)

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