2015-11-18 17:18:07 -05:00
|
|
|
package tarexport
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/docker/docker/image"
|
|
|
|
"github.com/docker/docker/layer"
|
2015-12-04 16:55:15 -05:00
|
|
|
"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 {
|
|
|
|
Config string
|
|
|
|
RepoTags []string
|
|
|
|
Layers []string
|
2016-03-21 16:52:36 -04:00
|
|
|
Parent image.ID `json:",omitempty"`
|
2015-11-18 17:18:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type tarexporter struct {
|
2016-04-19 00:45:59 -04:00
|
|
|
is image.Store
|
|
|
|
ls layer.Store
|
|
|
|
rs reference.Store
|
|
|
|
loggerImgEvent LogImageEvent
|
|
|
|
}
|
|
|
|
|
|
|
|
// LogImageEvent defines interface for event generation related to image tar(load and save) operations
|
|
|
|
type LogImageEvent interface {
|
|
|
|
//LogImageEvent generates an event related to an image operation
|
|
|
|
LogImageEvent(imageID, refName, action string)
|
2015-11-18 17:18:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewTarExporter returns new ImageExporter for tar packages
|
2016-04-19 00:45:59 -04:00
|
|
|
func NewTarExporter(is image.Store, ls layer.Store, rs reference.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,
|
|
|
|
ls: ls,
|
|
|
|
rs: rs,
|
|
|
|
loggerImgEvent: loggerImgEvent,
|
2015-11-18 17:18:07 -05:00
|
|
|
}
|
|
|
|
}
|