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

Method keyFor

pkg/blobmanager/s3accesspoint/backend.go:128–137  ·  view source on GitHub ↗

keyFor builds the bucket-level S3 key for a digest. Every tenant's objects live under a prefix derived from the requesting org carried in ctx, so two tenants pushing the same digest don't collide at the bucket layer. The function fails closed when the org is missing — same invariant the credentials

(ctx context.Context, digest string)

Source from the content-addressed store, hash-verified

126// invariant the credentials provider enforces, just surfaced earlier
127// with a clearer error.
128func (b *Backend) keyFor(ctx context.Context, digest string) (string, error) {
129 claims, err := robotaccount.InfoFromAuth(ctx)
130 if err != nil {
131 return "", err
132 }
133 if claims.OrgID == "" {
134 return "", ErrMissingRequestingOrg
135 }
136 return fmt.Sprintf("%s/sha256:%s", claims.OrgID, digest), nil
137}
138
139func (b *Backend) Exists(ctx context.Context, digest string) (bool, error) {
140 _, err := b.Describe(ctx, digest)

Callers 4

UploadMethod · 0.95
DescribeMethod · 0.95
DownloadMethod · 0.95

Calls

no outgoing calls

Tested by 1