MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Download

Method Download

pkg/blobmanager/s3/backend.go:227–248  ·  view source on GitHub ↗
(ctx context.Context, w io.Writer, digest string)

Source from the content-addressed store, hash-verified

225}
226
227func (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
251func (b *Backend) CheckWritePermissions(ctx context.Context) error {

Callers

nothing calls this directly

Calls 4

ExistsMethod · 0.95
DownloadMethod · 0.95
resourceNameFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected