|
@@ -94,7 +94,7 @@ type DownloadDescriptorWithRegistered interface {
|
|
|
// Download method is called to get the layer tar data. Layers are then
|
|
|
// registered in the appropriate order. The caller must call the returned
|
|
|
// release function once it is done with the returned RootFS object.
|
|
|
-func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS image.RootFS, layers []DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) {
|
|
|
+func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS image.RootFS, platform layer.Platform, layers []DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) {
|
|
|
var (
|
|
|
topLayer layer.Layer
|
|
|
topDownload *downloadTransfer
|
|
@@ -140,7 +140,7 @@ func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS ima
|
|
|
// the stack? If so, avoid downloading it more than once.
|
|
|
var topDownloadUncasted Transfer
|
|
|
if existingDownload, ok := downloadsByKey[key]; ok {
|
|
|
- xferFunc := ldm.makeDownloadFuncFromDownload(descriptor, existingDownload, topDownload)
|
|
|
+ xferFunc := ldm.makeDownloadFuncFromDownload(descriptor, existingDownload, topDownload, platform)
|
|
|
defer topDownload.Transfer.Release(watcher)
|
|
|
topDownloadUncasted, watcher = ldm.tm.Transfer(transferKey, xferFunc, progressOutput)
|
|
|
topDownload = topDownloadUncasted.(*downloadTransfer)
|
|
@@ -152,10 +152,10 @@ func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS ima
|
|
|
|
|
|
var xferFunc DoFunc
|
|
|
if topDownload != nil {
|
|
|
- xferFunc = ldm.makeDownloadFunc(descriptor, "", topDownload)
|
|
|
+ xferFunc = ldm.makeDownloadFunc(descriptor, "", topDownload, platform)
|
|
|
defer topDownload.Transfer.Release(watcher)
|
|
|
} else {
|
|
|
- xferFunc = ldm.makeDownloadFunc(descriptor, rootFS.ChainID(), nil)
|
|
|
+ xferFunc = ldm.makeDownloadFunc(descriptor, rootFS.ChainID(), nil, platform)
|
|
|
}
|
|
|
topDownloadUncasted, watcher = ldm.tm.Transfer(transferKey, xferFunc, progressOutput)
|
|
|
topDownload = topDownloadUncasted.(*downloadTransfer)
|
|
@@ -212,7 +212,7 @@ func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS ima
|
|
|
// complete before the registration step, and registers the downloaded data
|
|
|
// on top of parentDownload's resulting layer. Otherwise, it registers the
|
|
|
// layer on top of the ChainID given by parentLayer.
|
|
|
-func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor, parentLayer layer.ChainID, parentDownload *downloadTransfer) DoFunc {
|
|
|
+func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor, parentLayer layer.ChainID, parentDownload *downloadTransfer, platform layer.Platform) DoFunc {
|
|
|
return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) Transfer {
|
|
|
d := &downloadTransfer{
|
|
|
Transfer: NewTransfer(),
|
|
@@ -335,9 +335,9 @@ func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor,
|
|
|
src = fs.Descriptor()
|
|
|
}
|
|
|
if ds, ok := d.layerStore.(layer.DescribableStore); ok {
|
|
|
- d.layer, err = ds.RegisterWithDescriptor(inflatedLayerData, parentLayer, src)
|
|
|
+ d.layer, err = ds.RegisterWithDescriptor(inflatedLayerData, parentLayer, platform, src)
|
|
|
} else {
|
|
|
- d.layer, err = d.layerStore.Register(inflatedLayerData, parentLayer)
|
|
|
+ d.layer, err = d.layerStore.Register(inflatedLayerData, parentLayer, platform)
|
|
|
}
|
|
|
if err != nil {
|
|
|
select {
|
|
@@ -376,7 +376,7 @@ func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor,
|
|
|
// parentDownload. This function does not log progress output because it would
|
|
|
// interfere with the progress reporting for sourceDownload, which has the same
|
|
|
// Key.
|
|
|
-func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor DownloadDescriptor, sourceDownload *downloadTransfer, parentDownload *downloadTransfer) DoFunc {
|
|
|
+func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor DownloadDescriptor, sourceDownload *downloadTransfer, parentDownload *downloadTransfer, platform layer.Platform) DoFunc {
|
|
|
return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) Transfer {
|
|
|
d := &downloadTransfer{
|
|
|
Transfer: NewTransfer(),
|
|
@@ -434,9 +434,9 @@ func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor Downloa
|
|
|
src = fs.Descriptor()
|
|
|
}
|
|
|
if ds, ok := d.layerStore.(layer.DescribableStore); ok {
|
|
|
- d.layer, err = ds.RegisterWithDescriptor(layerReader, parentLayer, src)
|
|
|
+ d.layer, err = ds.RegisterWithDescriptor(layerReader, parentLayer, platform, src)
|
|
|
} else {
|
|
|
- d.layer, err = d.layerStore.Register(layerReader, parentLayer)
|
|
|
+ d.layer, err = d.layerStore.Register(layerReader, parentLayer, platform)
|
|
|
}
|
|
|
if err != nil {
|
|
|
d.err = fmt.Errorf("failed to register layer: %v", err)
|