2018-02-05 16:05:59 -05:00
|
|
|
package tarexport // import "github.com/docker/docker/image/tarexport"
|
2015-11-18 17:18:07 -05:00
|
|
|
|
|
|
|
import (
|
2016-05-25 22:11:51 -04:00
|
|
|
"github.com/docker/distribution"
|
2015-11-18 17:18:07 -05:00
|
|
|
"github.com/docker/docker/image"
|
|
|
|
"github.com/docker/docker/layer"
|
2017-01-25 19:54:18 -05:00
|
|
|
refstore "github.com/docker/docker/reference"
|
2015-11-18 17:18:07 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
manifestFileName = "manifest.json"
|
|
|
|
legacyLayerFileName = "layer.tar"
|
|
|
|
legacyConfigFileName = "json"
|
|
|
|
legacyVersionFileName = "VERSION"
|
|
|
|
legacyRepositoriesFileName = "repositories"
|
|
|
|
)
|
|
|
|
|
|
|
|
type manifestItem struct {
|
2016-05-25 22:11:51 -04:00
|
|
|
Config string
|
|
|
|
RepoTags []string
|
|
|
|
Layers []string
|
2016-06-06 20:49:34 -04:00
|
|
|
Parent image.ID `json:",omitempty"`
|
|
|
|
LayerSources map[layer.DiffID]distribution.Descriptor `json:",omitempty"`
|
2015-11-18 17:18:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type tarexporter struct {
|
2016-04-19 00:45:59 -04:00
|
|
|
is image.Store
|
2017-09-19 15:14:46 -04:00
|
|
|
lss map[string]layer.Store
|
2017-01-25 19:54:18 -05:00
|
|
|
rs refstore.Store
|
2016-04-19 00:45:59 -04:00
|
|
|
loggerImgEvent LogImageEvent
|
|
|
|
}
|
|
|
|
|
|
|
|
// LogImageEvent defines interface for event generation related to image tar(load and save) operations
|
|
|
|
type LogImageEvent interface {
|
2019-11-27 09:45:08 -05:00
|
|
|
// LogImageEvent generates an event related to an image operation
|
2016-04-19 00:45:59 -04:00
|
|
|
LogImageEvent(imageID, refName, action string)
|
2015-11-18 17:18:07 -05:00
|
|
|
}
|
|
|
|
|
2016-12-13 09:15:08 -05:00
|
|
|
// NewTarExporter returns new Exporter for tar packages
|
2017-09-19 15:14:46 -04:00
|
|
|
func NewTarExporter(is image.Store, lss map[string]layer.Store, rs refstore.Store, loggerImgEvent LogImageEvent) image.Exporter {
|
2015-11-18 17:18:07 -05:00
|
|
|
return &tarexporter{
|
2016-04-19 00:45:59 -04:00
|
|
|
is: is,
|
2017-09-19 15:14:46 -04:00
|
|
|
lss: lss,
|
2016-04-19 00:45:59 -04:00
|
|
|
rs: rs,
|
|
|
|
loggerImgEvent: loggerImgEvent,
|
2015-11-18 17:18:07 -05:00
|
|
|
}
|
|
|
|
}
|