layers: add option to initialize layer Flags
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
f424bfcf9f
commit
15ac716f16
|
|
@ -76,6 +76,8 @@ type ApplyDiffOpts struct {
|
||||||
// ApplyDiffWithDifferOpts contains optional arguments for ApplyDiffWithDiffer methods.
|
// ApplyDiffWithDifferOpts contains optional arguments for ApplyDiffWithDiffer methods.
|
||||||
type ApplyDiffWithDifferOpts struct {
|
type ApplyDiffWithDifferOpts struct {
|
||||||
ApplyDiffOpts
|
ApplyDiffOpts
|
||||||
|
|
||||||
|
Flags map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitFunc initializes the storage driver.
|
// InitFunc initializes the storage driver.
|
||||||
|
|
|
||||||
11
layers.go
11
layers.go
|
|
@ -2411,10 +2411,11 @@ func (r *layerStore) ApplyDiffFromStagingDirectory(id, stagingDirectory string,
|
||||||
}
|
}
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = &drivers.ApplyDiffWithDifferOpts{
|
options = &drivers.ApplyDiffWithDifferOpts{
|
||||||
drivers.ApplyDiffOpts{
|
ApplyDiffOpts: drivers.ApplyDiffOpts{
|
||||||
Mappings: r.layerMappings(layer),
|
Mappings: r.layerMappings(layer),
|
||||||
MountLabel: layer.MountLabel,
|
MountLabel: layer.MountLabel,
|
||||||
},
|
},
|
||||||
|
Flags: nil,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2430,6 +2431,14 @@ func (r *layerStore) ApplyDiffFromStagingDirectory(id, stagingDirectory string,
|
||||||
layer.TOCDigest = diffOutput.TOCDigest
|
layer.TOCDigest = diffOutput.TOCDigest
|
||||||
layer.UncompressedSize = diffOutput.Size
|
layer.UncompressedSize = diffOutput.Size
|
||||||
layer.Metadata = diffOutput.Metadata
|
layer.Metadata = diffOutput.Metadata
|
||||||
|
if options != nil && options.Flags != nil {
|
||||||
|
if layer.Flags == nil {
|
||||||
|
layer.Flags = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
for k, v := range options.Flags {
|
||||||
|
layer.Flags[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
if len(diffOutput.TarSplit) != 0 {
|
if len(diffOutput.TarSplit) != 0 {
|
||||||
tsdata := bytes.Buffer{}
|
tsdata := bytes.Buffer{}
|
||||||
compressor, err := pgzip.NewWriterLevel(&tsdata, pgzip.BestSpeed)
|
compressor, err := pgzip.NewWriterLevel(&tsdata, pgzip.BestSpeed)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue