github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/image/tarexport/tarexport.go (about) 1 package tarexport // import "github.com/demonoid81/moby/image/tarexport" 2 3 import ( 4 "github.com/docker/distribution" 5 "github.com/demonoid81/moby/image" 6 "github.com/demonoid81/moby/layer" 7 refstore "github.com/demonoid81/moby/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 lss map[string]layer.Store 29 rs refstore.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 Exporter for tar packages 40 func NewTarExporter(is image.Store, lss map[string]layer.Store, rs refstore.Store, loggerImgEvent LogImageEvent) image.Exporter { 41 return &tarexporter{ 42 is: is, 43 lss: lss, 44 rs: rs, 45 loggerImgEvent: loggerImgEvent, 46 } 47 }