|
...
|
...
|
@@ -137,7 +137,7 @@ func (lbs *linkedBlobStore) Create(ctx context.Context, options ...distribution.
|
|
137
|
137
|
}
|
|
138
|
138
|
|
|
139
|
139
|
if opts.Mount.ShouldMount {
|
|
140
|
|
- desc, err := lbs.mount(ctx, opts.Mount.From, opts.Mount.From.Digest())
|
|
|
140
|
+ desc, err := lbs.mount(ctx, opts.Mount.From, opts.Mount.From.Digest(), opts.Mount.Stat)
|
|
141
|
141
|
if err == nil {
|
|
142
|
142
|
// Mount successful, no need to initiate an upload session
|
|
143
|
143
|
return nil, distribution.ErrBlobMounted{From: opts.Mount.From, Descriptor: desc}
|
|
...
|
...
|
@@ -280,14 +280,21 @@ func (lbs *linkedBlobStore) Enumerate(ctx context.Context, ingestor func(digest.
|
|
280
|
280
|
return nil
|
|
281
|
281
|
}
|
|
282
|
282
|
|
|
283
|
|
-func (lbs *linkedBlobStore) mount(ctx context.Context, sourceRepo reference.Named, dgst digest.Digest) (distribution.Descriptor, error) {
|
|
284
|
|
- repo, err := lbs.registry.Repository(ctx, sourceRepo)
|
|
285
|
|
- if err != nil {
|
|
286
|
|
- return distribution.Descriptor{}, err
|
|
287
|
|
- }
|
|
288
|
|
- stat, err := repo.Blobs(ctx).Stat(ctx, dgst)
|
|
289
|
|
- if err != nil {
|
|
290
|
|
- return distribution.Descriptor{}, err
|
|
|
283
|
+func (lbs *linkedBlobStore) mount(ctx context.Context, sourceRepo reference.Named, dgst digest.Digest, sourceStat *distribution.Descriptor) (distribution.Descriptor, error) {
|
|
|
284
|
+ var stat distribution.Descriptor
|
|
|
285
|
+ if sourceStat == nil {
|
|
|
286
|
+ // look up the blob info from the sourceRepo if not already provided
|
|
|
287
|
+ repo, err := lbs.registry.Repository(ctx, sourceRepo)
|
|
|
288
|
+ if err != nil {
|
|
|
289
|
+ return distribution.Descriptor{}, err
|
|
|
290
|
+ }
|
|
|
291
|
+ stat, err = repo.Blobs(ctx).Stat(ctx, dgst)
|
|
|
292
|
+ if err != nil {
|
|
|
293
|
+ return distribution.Descriptor{}, err
|
|
|
294
|
+ }
|
|
|
295
|
+ } else {
|
|
|
296
|
+ // use the provided blob info
|
|
|
297
|
+ stat = *sourceStat
|
|
291
|
298
|
}
|
|
292
|
299
|
|
|
293
|
300
|
desc := distribution.Descriptor{
|