@@ -56,16 +56,17 @@ func newImageDestination(ctx context.Context, sys *types.SystemContext, ref daem
5656 goroutineContext , goroutineCancel := context .WithCancel (ctx )
5757 go imageLoadGoroutine (goroutineContext , c , reader , statusChannel )
5858
59- return & daemonImageDestination {
59+ d := & daemonImageDestination {
6060 ref : ref ,
6161 mustMatchRuntimeOS : mustMatchRuntimeOS ,
62- Destination : tarfile .NewDestination (sys , archive , ref .Transport ().Name (), namedTaggedRef ),
6362 archive : archive ,
6463 goroutineCancel : goroutineCancel ,
6564 statusChannel : statusChannel ,
6665 writer : writer ,
6766 committed : false ,
68- }, nil
67+ }
68+ d .Destination = tarfile .NewDestination (sys , archive , ref .Transport ().Name (), namedTaggedRef , d .CommitWithOptions )
69+ return d , nil
6970}
7071
7172// imageLoadGoroutine accepts tar stream on reader, sends it to c, and reports error or success by writing to statusChannel
@@ -146,7 +147,7 @@ func (d *daemonImageDestination) Close() error {
146147 // immediately, and hopefully, through terminating the sending which uses "Transfer-Encoding: chunked"" without sending
147148 // the terminating zero-length chunk, prevent the docker daemon from processing the tar stream at all.
148149 // Whether that works or not, closing the PipeWriter seems desirable in any case.
149- if err := d .writer .CloseWithError (errors .New ("Aborting upload, daemonImageDestination closed without a previous .Commit ()" )); err != nil {
150+ if err := d .writer .CloseWithError (errors .New ("Aborting upload, daemonImageDestination closed without a previous .CommitWithOptions ()" )); err != nil {
150151 return err
151152 }
152153 }
@@ -159,14 +160,11 @@ func (d *daemonImageDestination) Reference() types.ImageReference {
159160 return d .ref
160161}
161162
162- // Commit marks the process of storing the image as successful and asks for the image to be persisted.
163- // unparsedToplevel contains data about the top-level manifest of the source (which may be a single-arch image or a manifest list
164- // if PutManifest was only called for the single-arch image with instanceDigest == nil), primarily to allow lookups by the
165- // original manifest list digest, if desired.
163+ // CommitWithOptions marks the process of storing the image as successful and asks for the image to be persisted.
166164// WARNING: This does not have any transactional semantics:
167- // - Uploaded data MAY be visible to others before Commit () is called
168- // - Uploaded data MAY be removed or MAY remain around if Close() is called without Commit () (i.e. rollback is allowed but not guaranteed)
169- func (d * daemonImageDestination ) Commit (ctx context.Context , unparsedToplevel types. UnparsedImage ) error {
165+ // - Uploaded data MAY be visible to others before CommitWithOptions () is called
166+ // - Uploaded data MAY be removed or MAY remain around if Close() is called without CommitWithOptions () (i.e. rollback is allowed but not guaranteed)
167+ func (d * daemonImageDestination ) CommitWithOptions (ctx context.Context , options private. CommitOptions ) error {
170168 logrus .Debugf ("docker-daemon: Closing tar stream" )
171169 if err := d .archive .Close (); err != nil {
172170 return err
0 commit comments