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

@@ -21,15 +21,16 @@ import (
"io"
api "github.com/containerd/containerd/api/services/streaming/v1"
"github.com/containerd/containerd/v2/core/streaming"
ptypes "github.com/containerd/containerd/v2/pkg/protobuf/types"
"github.com/containerd/containerd/v2/plugins"
"github.com/containerd/errdefs"
"github.com/containerd/errdefs/pkg/errgrpc"
"github.com/containerd/log"
"github.com/containerd/plugin"
"github.com/containerd/plugin/registry"
"github.com/containerd/typeurl/v2"
"google.golang.org/grpc"
"github.com/containerd/containerd/v2/core/streaming"
ptypes "github.com/containerd/containerd/v2/pkg/protobuf/types"
"github.com/containerd/containerd/v2/plugins"
)
var emptyResponse typeurl.Any
@@ -110,9 +111,9 @@ type serviceStream struct {
}
func (ss *serviceStream) Send(a typeurl.Any) (err error) {
err = errdefs.FromGRPC(ss.s.Send(typeurl.MarshalProto(a)))
err = errgrpc.ToNative(ss.s.Send(typeurl.MarshalProto(a)))
if !errors.Is(err, io.EOF) {
err = errdefs.FromGRPC(err)
err = errgrpc.ToNative(err)
}
return
}
@@ -120,7 +121,7 @@ func (ss *serviceStream) Send(a typeurl.Any) (err error) {
func (ss *serviceStream) Recv() (a typeurl.Any, err error) {
a, err = ss.s.Recv()
if !errors.Is(err, io.EOF) {
err = errdefs.FromGRPC(err)
err = errgrpc.ToNative(err)
}
return
}