Skip to content

Commit 64ee796

Browse files
committed
chore: registry/repository wiring
1 parent 02f05a1 commit 64ee796

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

internal/storage/containerd/registry.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (n *registry) Scope() distribution.Scope {
2424

2525
// Repository returns an instance of repository for the given name.
2626
func (n *registry) Repository(_ context.Context, name reference.Named) (distribution.Repository, error) {
27-
return newRepository(n.client, name), nil
27+
return newRepository(n.client.client, name), nil
2828
}
2929

3030
// Repositories returns a list of repositories.
@@ -35,13 +35,15 @@ func (n *registry) Repositories(ctx context.Context, repos []string, last string
3535
}
3636

3737
// Blobs returns a blob enumerator.
38+
// TODO: return blobStore
3839
func (n *registry) Blobs() distribution.BlobEnumerator {
3940
return &blobEnumerator{
4041
client: n.client,
4142
}
4243
}
4344

4445
// BlobStatter returns a blob statter.
46+
// TODO: return blobStore
4547
func (n *registry) BlobStatter() distribution.BlobStatter {
4648
return &blobStatter{
4749
client: n.client,
@@ -69,7 +71,8 @@ func (s *blobStatter) Stat(ctx context.Context, dgst digest.Digest) (distributio
6971
ctx = s.client.Context(ctx)
7072
info, err := s.client.ContentStore().Info(ctx, dgst)
7173
if err != nil {
72-
return distribution.Descriptor{}, convertError(err)
74+
// TODO: use blob store Stat
75+
return distribution.Descriptor{}, err
7376
}
7477

7578
return distribution.Descriptor{

internal/storage/containerd/repository.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ package containerd
22

33
import (
44
"context"
5+
"github.com/containerd/containerd/v2/client"
56
"github.com/distribution/distribution/v3"
67
"github.com/distribution/reference"
78
)
89

9-
// repository implements distribution.Repository backed by containerd image store.
10+
// repository implements distribution.Repository backed by the containerd content and image stores.
1011
type repository struct {
11-
client *Client
12+
client *client.Client
1213
name reference.Named
13-
blobStore distribution.BlobStore
14+
blobStore *blobStore
1415
}
1516

16-
func newRepository(client *Client, name reference.Named) *repository {
17+
var _ distribution.Repository = &repository{}
18+
19+
func newRepository(client *client.Client, name reference.Named) *repository {
1720
return &repository{
1821
client: client,
1922
name: name,
@@ -29,23 +32,22 @@ func (r *repository) Named() reference.Named {
2932
return r.name
3033
}
3134

32-
// Manifests returns the manifest service for the repository.
35+
// Manifests returns the manifest service for the repository backed by the containerd content store.
3336
func (r *repository) Manifests(
3437
_ context.Context, _ ...distribution.ManifestServiceOption,
3538
) (distribution.ManifestService, error) {
3639
return &manifestService{
37-
client: r.client,
3840
repo: r.name,
3941
blobStore: r.blobStore,
4042
}, nil
4143
}
4244

43-
// Blobs returns the blob store for the repository.
45+
// Blobs returns the blob store for the repository backed by the containerd content store.
4446
func (r *repository) Blobs(_ context.Context) distribution.BlobStore {
4547
return r.blobStore
4648
}
4749

48-
// Tags returns the tag service for the repository.
50+
// Tags returns the tag service for the repository backed by the containerd image store.
4951
func (r *repository) Tags(_ context.Context) distribution.TagService {
5052
return &tagService{
5153
client: r.client,

0 commit comments

Comments
 (0)