@@ -11,76 +11,74 @@ import (
11
11
"github.com/pkg/errors"
12
12
)
13
13
14
- type Store = nsContent
15
-
16
14
func NewContentStore (store content.Store , ns string ) * Store {
17
- return & nsContent {ns , store }
15
+ return & Store {ns , store }
18
16
}
19
17
20
- type nsContent struct {
18
+ type Store struct {
21
19
ns string
22
20
content.Store
23
21
}
24
22
25
- func (c * nsContent ) Namespace () string {
23
+ func (c * Store ) Namespace () string {
26
24
return c .ns
27
25
}
28
26
29
- func (c * nsContent ) WithNamespace (ns string ) * Store {
27
+ func (c * Store ) WithNamespace (ns string ) * Store {
30
28
return NewContentStore (c .Store , ns )
31
29
}
32
30
33
- func (c * nsContent ) Info (ctx context.Context , dgst digest.Digest ) (content.Info , error ) {
31
+ func (c * Store ) Info (ctx context.Context , dgst digest.Digest ) (content.Info , error ) {
34
32
ctx = namespaces .WithNamespace (ctx , c .ns )
35
33
return c .Store .Info (ctx , dgst )
36
34
}
37
35
38
- func (c * nsContent ) Update (ctx context.Context , info content.Info , fieldpaths ... string ) (content.Info , error ) {
36
+ func (c * Store ) Update (ctx context.Context , info content.Info , fieldpaths ... string ) (content.Info , error ) {
39
37
ctx = namespaces .WithNamespace (ctx , c .ns )
40
38
return c .Store .Update (ctx , info , fieldpaths ... )
41
39
}
42
40
43
- func (c * nsContent ) Walk (ctx context.Context , fn content.WalkFunc , filters ... string ) error {
41
+ func (c * Store ) Walk (ctx context.Context , fn content.WalkFunc , filters ... string ) error {
44
42
ctx = namespaces .WithNamespace (ctx , c .ns )
45
43
return c .Store .Walk (ctx , fn , filters ... )
46
44
}
47
45
48
- func (c * nsContent ) Delete (ctx context.Context , dgst digest.Digest ) error {
46
+ func (c * Store ) Delete (ctx context.Context , dgst digest.Digest ) error {
49
47
return errors .Errorf ("contentstore.Delete usage is forbidden" )
50
48
}
51
49
52
- func (c * nsContent ) Status (ctx context.Context , ref string ) (content.Status , error ) {
50
+ func (c * Store ) Status (ctx context.Context , ref string ) (content.Status , error ) {
53
51
ctx = namespaces .WithNamespace (ctx , c .ns )
54
52
return c .Store .Status (ctx , ref )
55
53
}
56
54
57
- func (c * nsContent ) ListStatuses (ctx context.Context , filters ... string ) ([]content.Status , error ) {
55
+ func (c * Store ) ListStatuses (ctx context.Context , filters ... string ) ([]content.Status , error ) {
58
56
ctx = namespaces .WithNamespace (ctx , c .ns )
59
57
return c .Store .ListStatuses (ctx , filters ... )
60
58
}
61
59
62
- func (c * nsContent ) Abort (ctx context.Context , ref string ) error {
60
+ func (c * Store ) Abort (ctx context.Context , ref string ) error {
63
61
ctx = namespaces .WithNamespace (ctx , c .ns )
64
62
return c .Store .Abort (ctx , ref )
65
63
}
66
64
67
- func (c * nsContent ) ReaderAt (ctx context.Context , desc ocispecs.Descriptor ) (content.ReaderAt , error ) {
65
+ func (c * Store ) ReaderAt (ctx context.Context , desc ocispecs.Descriptor ) (content.ReaderAt , error ) {
68
66
ctx = namespaces .WithNamespace (ctx , c .ns )
69
67
return c .Store .ReaderAt (ctx , desc )
70
68
}
71
69
72
- func (c * nsContent ) Writer (ctx context.Context , opts ... content.WriterOpt ) (content.Writer , error ) {
70
+ func (c * Store ) Writer (ctx context.Context , opts ... content.WriterOpt ) (content.Writer , error ) {
73
71
return c .writer (ctx , 3 , opts ... )
74
72
}
75
73
76
- func (c * nsContent ) WithFallbackNS (ns string ) content.Store {
74
+ func (c * Store ) WithFallbackNS (ns string ) content.Store {
77
75
return & nsFallbackStore {
78
76
main : c ,
79
77
fb : c .WithNamespace (ns ),
80
78
}
81
79
}
82
80
83
- func (c * nsContent ) writer (ctx context.Context , retries int , opts ... content.WriterOpt ) (content.Writer , error ) {
81
+ func (c * Store ) writer (ctx context.Context , retries int , opts ... content.WriterOpt ) (content.Writer , error ) {
84
82
ctx = namespaces .WithNamespace (ctx , c .ns )
85
83
w , err := c .Store .Writer (ctx , opts ... )
86
84
if err != nil {
@@ -100,8 +98,8 @@ func (w *nsWriter) Commit(ctx context.Context, size int64, expected digest.Diges
100
98
}
101
99
102
100
type nsFallbackStore struct {
103
- main * nsContent
104
- fb * nsContent
101
+ main * Store
102
+ fb * Store
105
103
}
106
104
107
105
var _ content.Store = & nsFallbackStore {}
0 commit comments