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

@@ -19,12 +19,16 @@ package images
import (
"context"
"github.com/containerd/errdefs/pkg/errgrpc"
"github.com/containerd/log"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
imagesapi "github.com/containerd/containerd/api/services/images/v1"
"github.com/containerd/plugin"
"github.com/containerd/plugin/registry"
"github.com/containerd/containerd/v2/core/images"
"github.com/containerd/containerd/v2/core/metadata"
"github.com/containerd/containerd/v2/pkg/deprecation"
@@ -35,9 +39,6 @@ import (
"github.com/containerd/containerd/v2/plugins"
"github.com/containerd/containerd/v2/plugins/services"
"github.com/containerd/containerd/v2/plugins/services/warning"
"github.com/containerd/errdefs"
"github.com/containerd/plugin"
"github.com/containerd/plugin/registry"
)
var empty = &ptypes.Empty{}
@@ -89,7 +90,7 @@ var _ imagesapi.ImagesClient = &local{}
func (l *local) Get(ctx context.Context, req *imagesapi.GetImageRequest, _ ...grpc.CallOption) (*imagesapi.GetImageResponse, error) {
image, err := l.store.Get(ctx, req.Name)
if err != nil {
return nil, errdefs.ToGRPC(err)
return nil, errgrpc.ToGRPC(err)
}
imagepb := imageToProto(&image)
@@ -101,7 +102,7 @@ func (l *local) Get(ctx context.Context, req *imagesapi.GetImageRequest, _ ...gr
func (l *local) List(ctx context.Context, req *imagesapi.ListImagesRequest, _ ...grpc.CallOption) (*imagesapi.ListImagesResponse, error) {
images, err := l.store.List(ctx, req.Filters...)
if err != nil {
return nil, errdefs.ToGRPC(err)
return nil, errgrpc.ToGRPC(err)
}
return &imagesapi.ListImagesResponse{
@@ -125,7 +126,7 @@ func (l *local) Create(ctx context.Context, req *imagesapi.CreateImageRequest, _
}
created, err := l.store.Create(ctx, image)
if err != nil {
return nil, errdefs.ToGRPC(err)
return nil, errgrpc.ToGRPC(err)
}
resp.Image = imageToProto(&created)
@@ -157,7 +158,7 @@ func (l *local) Update(ctx context.Context, req *imagesapi.UpdateImageRequest, _
updated, err := l.store.Update(ctx, image, fieldpaths...)
if err != nil {
return nil, errdefs.ToGRPC(err)
return nil, errgrpc.ToGRPC(err)
}
resp.Image = imageToProto(&updated)
@@ -177,7 +178,7 @@ func (l *local) Delete(ctx context.Context, req *imagesapi.DeleteImageRequest, _
// Sync option handled here after event is published
if err := l.store.Delete(ctx, req.Name, opts...); err != nil {
return nil, errdefs.ToGRPC(err)
return nil, errgrpc.ToGRPC(err)
}
if req.Sync {