Merge pull request #1475 from dmcgowan/content-commit-context
Add context to content commit
This commit is contained in:
@@ -424,7 +424,7 @@ func (s *Service) Write(session api.Content_WriteServer) (err error) {
|
||||
if req.Labels != nil {
|
||||
opts = append(opts, content.WithLabels(req.Labels))
|
||||
}
|
||||
if err := wr.Commit(total, expected, opts...); err != nil {
|
||||
if err := wr.Commit(ctx, total, expected, opts...); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package content
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
contentapi "github.com/containerd/containerd/api/services/content/v1"
|
||||
@@ -80,7 +81,7 @@ func (rw *remoteWriter) Write(p []byte) (n int, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (rw *remoteWriter) Commit(size int64, expected digest.Digest, opts ...content.Opt) error {
|
||||
func (rw *remoteWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error {
|
||||
var base content.Info
|
||||
for _, opt := range opts {
|
||||
if err := opt(&base); err != nil {
|
||||
|
||||
@@ -464,7 +464,7 @@ func (s *Service) writeContent(ctx context.Context, mediaType, ref string, r io.
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := writer.Commit(0, ""); err != nil {
|
||||
if err := writer.Commit(ctx, 0, ""); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &types.Descriptor{
|
||||
|
||||
Reference in New Issue
Block a user