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

Method Upload

pkg/blobmanager/s3/backend.go:155–177  ·  view source on GitHub ↗
(ctx context.Context, r io.Reader, resource *pb.CASResource)

Source from the content-addressed store, hash-verified

153}
154
155func (b *Backend) Upload(ctx context.Context, r io.Reader, resource *pb.CASResource) error {
156 uploader := manager.NewUploader(b.client)
157 input := &s3.PutObjectInput{
158 Bucket: aws.String(b.bucket),
159 Key: aws.String(resourceName(resource.Digest)),
160 Body: r,
161 Metadata: map[string]string{
162 annotationNameAuthor: backend.AuthorAnnotation,
163 annotationNameFilename: resource.FileName,
164 },
165 }
166
167 // if b.checksumVerificationEnabled() {
168 // // Check that the object is uploaded correctly
169 // input.ChecksumSHA256 = aws.String(hexSha256ToBinaryB64(resource.Digest))
170 // }
171
172 if _, err := uploader.Upload(ctx, input); err != nil {
173 return fmt.Errorf("failed to upload to bucket: %w", err)
174 }
175
176 return nil
177}
178
179func (b *Backend) Describe(ctx context.Context, digest string) (*pb.CASResource, error) {
180 input := &s3.HeadObjectInput{

Callers

nothing calls this directly

Calls 3

UploadMethod · 0.95
resourceNameFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected