github.com/tonistiigi/docker@v0.10.1-0.20240229224939-974013b0dc6a/image/tarexport/tarexport.go (about) 1 package tarexport // import "github.com/docker/docker/image/tarexport" 2 3 import ( 4 "github.com/docker/distribution" 5 "github.com/docker/docker/api/types/events" 6 "github.com/docker/docker/image" 7 "github.com/docker/docker/layer" 8 refstore "github.com/docker/docker/reference" 9 ) 10 11 const ( 12 manifestFileName = "manifest.json" 13 legacyLayerFileName = "layer.tar" 14 legacyConfigFileName = "json" 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 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 string, action events.Action) 37 } 38 39 // NewTarExporter returns new Exporter for tar packages 40 func NewTarExporter(is image.Store, lss 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 }