-
Notifications
You must be signed in to change notification settings - Fork 22
SHA512 digest support #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -444,6 +444,9 @@ type layerStore struct { | |
// FIXME: This field is only set when constructing layerStore, but locking rules of the driver | ||
// interface itself are not documented here. | ||
driver drivers.Driver | ||
// store is a reference to the parent store for accessing digest | ||
// configuration | ||
store *store | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Trivial, but I’m not sure the back-link here is ideal, it creates a cyclical reference which GC will not clean up until In the other stores, the digest option is provided at construction time, is there a specific reason this code diverges? |
||
} | ||
|
||
func copyLayer(l *Layer) *Layer { | ||
|
@@ -1190,6 +1193,7 @@ func (s *store) newLayerStore(rundir, layerdir, imagedir string, driver drivers. | |
bymount: make(map[string]*Layer), | ||
|
||
driver: driver, | ||
store: s, | ||
} | ||
if err := rlstore.startWritingWithReload(false); err != nil { | ||
return nil, err | ||
|
@@ -1207,7 +1211,7 @@ func (s *store) newLayerStore(rundir, layerdir, imagedir string, driver drivers. | |
return &rlstore, nil | ||
} | ||
|
||
func newROLayerStore(rundir string, layerdir string, driver drivers.Driver) (roLayerStore, error) { | ||
func newROLayerStore(rundir string, layerdir string, driver drivers.Driver, store *store) (roLayerStore, error) { | ||
lockfile, err := lockfile.GetROLockFile(filepath.Join(layerdir, "layers.lock")) | ||
if err != nil { | ||
return nil, err | ||
|
@@ -1228,6 +1232,7 @@ func newROLayerStore(rundir string, layerdir string, driver drivers.Driver) (roL | |
bymount: make(map[string]*Layer), | ||
|
||
driver: driver, | ||
store: store, | ||
} | ||
if err := rlstore.startReadingWithReload(false); err != nil { | ||
return nil, err | ||
|
@@ -2420,17 +2425,18 @@ func (r *layerStore) applyDiffWithOptions(to string, layerOptions *LayerOptions, | |
// Decide if we need to compute digests | ||
var compressedDigest, uncompressedDigest digest.Digest // = "" | ||
var compressedDigester, uncompressedDigester digest.Digester // = nil | ||
digestAlgorithm := r.store.GetDigestAlgorithm() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if layerOptions != nil && layerOptions.OriginalDigest != "" && | ||
layerOptions.OriginalDigest.Algorithm() == digest.Canonical { | ||
layerOptions.OriginalDigest.Algorithm() == digestAlgorithm { | ||
compressedDigest = layerOptions.OriginalDigest | ||
} else { | ||
compressedDigester = digest.Canonical.Digester() | ||
compressedDigester = digestAlgorithm.Digester() | ||
} | ||
if layerOptions != nil && layerOptions.UncompressedDigest != "" && | ||
layerOptions.UncompressedDigest.Algorithm() == digest.Canonical { | ||
layerOptions.UncompressedDigest.Algorithm() == digestAlgorithm { | ||
uncompressedDigest = layerOptions.UncompressedDigest | ||
} else if compression != archive.Uncompressed { | ||
uncompressedDigester = digest.Canonical.Digester() | ||
uncompressedDigester = digestAlgorithm.Digester() | ||
} | ||
|
||
var compressedWriter io.Writer | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be parsed at initialization time, and unknown values should cause an error at that time. (Applies also elsewhere.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to cross-link: containers/podman#27170 (comment) , the currently-proposed uses suggest the digest setting should not be a global per-store option (or perhaps we need a set of several distinct options).