@@ -11,76 +11,74 @@ import (
1111 "github.com/pkg/errors"
1212)
1313
14- type Store = nsContent
15-
1614func NewContentStore (store content.Store , ns string ) * Store {
17- return & nsContent {ns , store }
15+ return & Store {ns , store }
1816}
1917
20- type nsContent struct {
18+ type Store struct {
2119 ns string
2220 content.Store
2321}
2422
25- func (c * nsContent ) Namespace () string {
23+ func (c * Store ) Namespace () string {
2624 return c .ns
2725}
2826
29- func (c * nsContent ) WithNamespace (ns string ) * Store {
27+ func (c * Store ) WithNamespace (ns string ) * Store {
3028 return NewContentStore (c .Store , ns )
3129}
3230
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 ) {
3432 ctx = namespaces .WithNamespace (ctx , c .ns )
3533 return c .Store .Info (ctx , dgst )
3634}
3735
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 ) {
3937 ctx = namespaces .WithNamespace (ctx , c .ns )
4038 return c .Store .Update (ctx , info , fieldpaths ... )
4139}
4240
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 {
4442 ctx = namespaces .WithNamespace (ctx , c .ns )
4543 return c .Store .Walk (ctx , fn , filters ... )
4644}
4745
48- func (c * nsContent ) Delete (ctx context.Context , dgst digest.Digest ) error {
46+ func (c * Store ) Delete (ctx context.Context , dgst digest.Digest ) error {
4947 return errors .Errorf ("contentstore.Delete usage is forbidden" )
5048}
5149
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 ) {
5351 ctx = namespaces .WithNamespace (ctx , c .ns )
5452 return c .Store .Status (ctx , ref )
5553}
5654
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 ) {
5856 ctx = namespaces .WithNamespace (ctx , c .ns )
5957 return c .Store .ListStatuses (ctx , filters ... )
6058}
6159
62- func (c * nsContent ) Abort (ctx context.Context , ref string ) error {
60+ func (c * Store ) Abort (ctx context.Context , ref string ) error {
6361 ctx = namespaces .WithNamespace (ctx , c .ns )
6462 return c .Store .Abort (ctx , ref )
6563}
6664
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 ) {
6866 ctx = namespaces .WithNamespace (ctx , c .ns )
6967 return c .Store .ReaderAt (ctx , desc )
7068}
7169
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 ) {
7371 return c .writer (ctx , 3 , opts ... )
7472}
7573
76- func (c * nsContent ) WithFallbackNS (ns string ) content.Store {
74+ func (c * Store ) WithFallbackNS (ns string ) content.Store {
7775 return & nsFallbackStore {
7876 main : c ,
7977 fb : c .WithNamespace (ns ),
8078 }
8179}
8280
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 ) {
8482 ctx = namespaces .WithNamespace (ctx , c .ns )
8583 w , err := c .Store .Writer (ctx , opts ... )
8684 if err != nil {
@@ -100,8 +98,8 @@ func (w *nsWriter) Commit(ctx context.Context, size int64, expected digest.Diges
10098}
10199
102100type nsFallbackStore struct {
103- main * nsContent
104- fb * nsContent
101+ main * Store
102+ fb * Store
105103}
106104
107105var _ content.Store = & nsFallbackStore {}
0 commit comments