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