Update errdefs to 0.3.0

Uses the new github.com/containerd/errdefs/pkg module which is intended
to hold less stable utility functions separately from the stable
github.com/containerd/errdefs error types.

Includes temporary update to hcsshim until a release is cut there

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2024-10-18 15:57:27 -07:00
parent b291eb802b
commit 2f24aa00a5
61 changed files with 2054 additions and 529 deletions

View File

@@ -22,10 +22,11 @@ import (
"io"
contentapi "github.com/containerd/containerd/api/services/content/v1"
"github.com/containerd/errdefs/pkg/errgrpc"
digest "github.com/opencontainers/go-digest"
"github.com/containerd/containerd/v2/core/content"
"github.com/containerd/containerd/v2/pkg/protobuf"
"github.com/containerd/errdefs"
digest "github.com/opencontainers/go-digest"
)
type remoteWriter struct {
@@ -58,7 +59,7 @@ func (rw *remoteWriter) Status() (content.Status, error) {
Action: contentapi.WriteAction_STAT,
})
if err != nil {
return content.Status{}, fmt.Errorf("error getting writer status: %w", errdefs.FromGRPC(err))
return content.Status{}, fmt.Errorf("error getting writer status: %w", errgrpc.ToNative(err))
}
return content.Status{
@@ -83,7 +84,7 @@ func (rw *remoteWriter) Write(p []byte) (n int, err error) {
Data: p,
})
if err != nil {
return 0, fmt.Errorf("failed to send write: %w", errdefs.FromGRPC(err))
return 0, fmt.Errorf("failed to send write: %w", errgrpc.ToNative(err))
}
n = int(resp.Offset - offset)
@@ -120,7 +121,7 @@ func (rw *remoteWriter) Commit(ctx context.Context, size int64, expected digest.
Labels: base.Labels,
})
if err != nil {
return fmt.Errorf("commit failed: %w", errdefs.FromGRPC(err))
return fmt.Errorf("commit failed: %w", errgrpc.ToNative(err))
}
if size != 0 && resp.Offset != size {