Skip to content

Commit cedf1bb

Browse files
fix: rename ErrSkipDesc to SkipNode
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
1 parent 9febd7b commit cedf1bb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

copy.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ import (
3737
// defaultConcurrency is the default value of CopyGraphOptions.Concurrency.
3838
const defaultConcurrency int = 3 // This value is consistent with dockerd and containerd.
3939

40-
// ErrSkipDesc signals to stop copying a descriptor. When returned from PreCopy the blob must exist in the target.
40+
// SkipNode signals to stop copying a descriptor. When returned from PreCopy the blob must exist in the target.
4141
// This can be used to signal that a blob has been made available in the target repository by "Mount()" or some other technique.
42-
var ErrSkipDesc = errors.New("skip descriptor")
42+
var SkipNode = errors.New("skip descriptor")
4343

4444
// DefaultCopyOptions provides the default CopyOptions.
4545
var DefaultCopyOptions CopyOptions = CopyOptions{
@@ -282,7 +282,7 @@ func doCopyNode(ctx context.Context, src content.ReadOnlyStorage, dst content.St
282282
func copyNode(ctx context.Context, src content.ReadOnlyStorage, dst content.Storage, desc ocispec.Descriptor, opts CopyGraphOptions) error {
283283
if opts.PreCopy != nil {
284284
if err := opts.PreCopy(ctx, desc); err != nil {
285-
if err == ErrSkipDesc {
285+
if err == SkipNode {
286286
return nil
287287
}
288288
return err
@@ -374,7 +374,7 @@ func prepareCopy(ctx context.Context, dst Target, dstRef string, proxy *cas.Prox
374374
}
375375
}
376376
// skip the regular copy workflow
377-
return ErrSkipDesc
377+
return SkipNode
378378
}
379379
} else {
380380
postCopy := opts.PostCopy

copy_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ func TestCopyGraph_WithOptions(t *testing.T) {
14331433
t.Fatalf("CopyGraph() error = %v, wantErr %v", err, errdef.ErrSizeExceedsLimit)
14341434
}
14351435

1436-
t.Run("ErrSkipDesc", func(t *testing.T) {
1436+
t.Run("SkipNode", func(t *testing.T) {
14371437
// test CopyGraph with PreCopy = 1
14381438
root = descs[6]
14391439
dst := &countingStorage{storage: cas.NewMemory()}
@@ -1450,7 +1450,7 @@ func TestCopyGraph_WithOptions(t *testing.T) {
14501450
if err != nil {
14511451
t.Fatalf("Failed to fetch: %v", err)
14521452
}
1453-
return oras.ErrSkipDesc
1453+
return oras.SkipNode
14541454
}
14551455
return nil
14561456
},
@@ -1467,7 +1467,7 @@ func TestCopyGraph_WithOptions(t *testing.T) {
14671467
}
14681468
// 7 (exists) - 1 (skipped) = 6 pushes expected
14691469
if got, expected := dst.numPush.Load(), int64(6); got != expected {
1470-
// If we get >=7 then ErrSkipDesc did not short circuit the push like it is supposed to do.
1470+
// If we get >=7 then SkipNode did not short circuit the push like it is supposed to do.
14711471
t.Errorf("count(Push()) = %d, want %d", got, expected)
14721472
}
14731473
})

0 commit comments

Comments
 (0)