(ctx context.Context, w io.Writer, digest string)
| 225 | } |
| 226 | |
| 227 | func (b *Backend) Download(ctx context.Context, w io.Writer, digest string) error { |
| 228 | exists, err := b.Exists(ctx, digest) |
| 229 | if err != nil { |
| 230 | return err |
| 231 | } else if !exists { |
| 232 | return backend.NewErrNotFound("artifact") |
| 233 | } |
| 234 | |
| 235 | downloader := manager.NewDownloader(b.client, func(d *manager.Downloader) { |
| 236 | // force sequential downloads so we can wrap the writer and ignore the offset |
| 237 | // Important! Do not change this value, otherwise the fakeWriterAt will not work |
| 238 | d.Concurrency = 1 |
| 239 | }) |
| 240 | output := fakeWriterAt{w} |
| 241 | |
| 242 | _, err = downloader.Download(ctx, output, &s3.GetObjectInput{ |
| 243 | Bucket: aws.String(b.bucket), |
| 244 | Key: aws.String(resourceName(digest)), |
| 245 | }) |
| 246 | |
| 247 | return err |
| 248 | } |
| 249 | |
| 250 | // CheckWritePermissions performs an actual write to the repository to check that the credentials |
| 251 | func (b *Backend) CheckWritePermissions(ctx context.Context) error { |
nothing calls this directly
no test coverage detected