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:
@@ -21,10 +21,11 @@ import (
|
||||
"io"
|
||||
|
||||
snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1"
|
||||
"github.com/containerd/errdefs/pkg/errgrpc"
|
||||
|
||||
"github.com/containerd/containerd/v2/core/mount"
|
||||
"github.com/containerd/containerd/v2/core/snapshots"
|
||||
protobuftypes "github.com/containerd/containerd/v2/pkg/protobuf/types"
|
||||
"github.com/containerd/errdefs"
|
||||
)
|
||||
|
||||
// NewSnapshotter returns a new Snapshotter which communicates over a GRPC
|
||||
@@ -48,7 +49,7 @@ func (p *proxySnapshotter) Stat(ctx context.Context, key string) (snapshots.Info
|
||||
Key: key,
|
||||
})
|
||||
if err != nil {
|
||||
return snapshots.Info{}, errdefs.FromGRPC(err)
|
||||
return snapshots.Info{}, errgrpc.ToNative(err)
|
||||
}
|
||||
return InfoFromProto(resp.Info), nil
|
||||
}
|
||||
@@ -63,7 +64,7 @@ func (p *proxySnapshotter) Update(ctx context.Context, info snapshots.Info, fiel
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return snapshots.Info{}, errdefs.FromGRPC(err)
|
||||
return snapshots.Info{}, errgrpc.ToNative(err)
|
||||
}
|
||||
return InfoFromProto(resp.Info), nil
|
||||
}
|
||||
@@ -74,7 +75,7 @@ func (p *proxySnapshotter) Usage(ctx context.Context, key string) (snapshots.Usa
|
||||
Key: key,
|
||||
})
|
||||
if err != nil {
|
||||
return snapshots.Usage{}, errdefs.FromGRPC(err)
|
||||
return snapshots.Usage{}, errgrpc.ToNative(err)
|
||||
}
|
||||
return UsageFromProto(resp), nil
|
||||
}
|
||||
@@ -85,7 +86,7 @@ func (p *proxySnapshotter) Mounts(ctx context.Context, key string) ([]mount.Moun
|
||||
Key: key,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errdefs.FromGRPC(err)
|
||||
return nil, errgrpc.ToNative(err)
|
||||
}
|
||||
return mount.FromProto(resp.Mounts), nil
|
||||
}
|
||||
@@ -104,7 +105,7 @@ func (p *proxySnapshotter) Prepare(ctx context.Context, key, parent string, opts
|
||||
Labels: local.Labels,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errdefs.FromGRPC(err)
|
||||
return nil, errgrpc.ToNative(err)
|
||||
}
|
||||
return mount.FromProto(resp.Mounts), nil
|
||||
}
|
||||
@@ -123,7 +124,7 @@ func (p *proxySnapshotter) View(ctx context.Context, key, parent string, opts ..
|
||||
Labels: local.Labels,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errdefs.FromGRPC(err)
|
||||
return nil, errgrpc.ToNative(err)
|
||||
}
|
||||
return mount.FromProto(resp.Mounts), nil
|
||||
}
|
||||
@@ -141,7 +142,7 @@ func (p *proxySnapshotter) Commit(ctx context.Context, name, key string, opts ..
|
||||
Key: key,
|
||||
Labels: local.Labels,
|
||||
})
|
||||
return errdefs.FromGRPC(err)
|
||||
return errgrpc.ToNative(err)
|
||||
}
|
||||
|
||||
func (p *proxySnapshotter) Remove(ctx context.Context, key string) error {
|
||||
@@ -149,7 +150,7 @@ func (p *proxySnapshotter) Remove(ctx context.Context, key string) error {
|
||||
Snapshotter: p.snapshotterName,
|
||||
Key: key,
|
||||
})
|
||||
return errdefs.FromGRPC(err)
|
||||
return errgrpc.ToNative(err)
|
||||
}
|
||||
|
||||
func (p *proxySnapshotter) Walk(ctx context.Context, fn snapshots.WalkFunc, fs ...string) error {
|
||||
@@ -158,7 +159,7 @@ func (p *proxySnapshotter) Walk(ctx context.Context, fn snapshots.WalkFunc, fs .
|
||||
Filters: fs,
|
||||
})
|
||||
if err != nil {
|
||||
return errdefs.FromGRPC(err)
|
||||
return errgrpc.ToNative(err)
|
||||
}
|
||||
for {
|
||||
resp, err := sc.Recv()
|
||||
@@ -166,7 +167,7 @@ func (p *proxySnapshotter) Walk(ctx context.Context, fn snapshots.WalkFunc, fs .
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
return errdefs.FromGRPC(err)
|
||||
return errgrpc.ToNative(err)
|
||||
}
|
||||
if resp == nil {
|
||||
return nil
|
||||
@@ -187,5 +188,5 @@ func (p *proxySnapshotter) Cleanup(ctx context.Context) error {
|
||||
_, err := p.client.Cleanup(ctx, &snapshotsapi.CleanupRequest{
|
||||
Snapshotter: p.snapshotterName,
|
||||
})
|
||||
return errdefs.FromGRPC(err)
|
||||
return errgrpc.ToNative(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user