github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/api/server/router/image/backend.go (about)

     1  package image // import "github.com/Prakhar-Agarwal-byte/moby/api/server/router/image"
     2  
     3  import (
     4  	"context"
     5  	"io"
     6  
     7  	"github.com/distribution/reference"
     8  	"github.com/Prakhar-Agarwal-byte/moby/api/types"
     9  	"github.com/Prakhar-Agarwal-byte/moby/api/types/filters"
    10  	"github.com/Prakhar-Agarwal-byte/moby/api/types/image"
    11  	"github.com/Prakhar-Agarwal-byte/moby/api/types/registry"
    12  	dockerimage "github.com/Prakhar-Agarwal-byte/moby/image"
    13  	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
    14  )
    15  
    16  // Backend is all the methods that need to be implemented
    17  // to provide image specific functionality.
    18  type Backend interface {
    19  	imageBackend
    20  	importExportBackend
    21  	registryBackend
    22  }
    23  
    24  type imageBackend interface {
    25  	ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]image.DeleteResponse, error)
    26  	ImageHistory(ctx context.Context, imageName string) ([]*image.HistoryResponseItem, error)
    27  	Images(ctx context.Context, opts types.ImageListOptions) ([]*image.Summary, error)
    28  	GetImage(ctx context.Context, refOrID string, options image.GetImageOpts) (*dockerimage.Image, error)
    29  	TagImage(ctx context.Context, id dockerimage.ID, newRef reference.Named) error
    30  	ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)
    31  }
    32  
    33  type importExportBackend interface {
    34  	LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error
    35  	ImportImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (dockerimage.ID, error)
    36  	ExportImage(ctx context.Context, names []string, outStream io.Writer) error
    37  }
    38  
    39  type registryBackend interface {
    40  	PullImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
    41  	PushImage(ctx context.Context, ref reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
    42  }
    43  
    44  type Searcher interface {
    45  	Search(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *registry.AuthConfig, headers map[string][]string) ([]registry.SearchResult, error)
    46  }