Add support for content labels on commit

Add commit options which allow for setting labels on commit.
Prevents potential race between garbage collector reading labels
after commit and labels getting set.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2017-08-09 22:34:05 -07:00
parent c4387a159e
commit dee8dc2cda
11 changed files with 336 additions and 76 deletions

View File

@@ -215,7 +215,7 @@ func (pw *pushWriter) Digest() digest.Digest {
return pw.expected
}
func (pw *pushWriter) Commit(size int64, expected digest.Digest) error {
func (pw *pushWriter) Commit(size int64, expected digest.Digest, opts ...content.Opt) error {
// Check whether read has already thrown an error
if _, err := pw.pipe.Write([]byte{}); err != nil && err != io.ErrClosedPipe {
return errors.Wrap(err, "pipe error before commit")