github.com/resin-io/docker@v1.13.1/image/tarexport/tarexport.go (about)

     1  package tarexport
     2  
     3  import (
     4  	"github.com/docker/distribution"
     5  	"github.com/docker/docker/image"
     6  	"github.com/docker/docker/layer"
     7  	"github.com/docker/docker/reference"
     8  )
     9  
    10  const (
    11  	manifestFileName           = "manifest.json"
    12  	legacyLayerFileName        = "layer.tar"
    13  	legacyConfigFileName       = "json"
    14  	legacyVersionFileName      = "VERSION"
    15  	legacyRepositoriesFileName = "repositories"
    16  )
    17  
    18  type manifestItem struct {
    19  	Config       string
    20  	RepoTags     []string
    21  	Layers       []string
    22  	Parent       image.ID                                 `json:",omitempty"`
    23  	LayerSources map[layer.DiffID]distribution.Descriptor `json:",omitempty"`
    24  }
    25  
    26  type tarexporter struct {
    27  	is             image.Store
    28  	ls             layer.Store
    29  	rs             reference.Store
    30  	loggerImgEvent LogImageEvent
    31  }
    32  
    33  // LogImageEvent defines interface for event generation related to image tar(load and save) operations
    34  type LogImageEvent interface {
    35  	//LogImageEvent generates an event related to an image operation
    36  	LogImageEvent(imageID, refName, action string)
    37  }
    38  
    39  // NewTarExporter returns new ImageExporter for tar packages
    40  func NewTarExporter(is image.Store, ls layer.Store, rs reference.Store, loggerImgEvent LogImageEvent) image.Exporter {
    41  	return &tarexporter{
    42  		is:             is,
    43  		ls:             ls,
    44  		rs:             rs,
    45  		loggerImgEvent: loggerImgEvent,
    46  	}
    47  }