-
Notifications
You must be signed in to change notification settings - Fork 18
/
helperinterfaces.go
36 lines (29 loc) · 1.32 KB
/
helperinterfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Open Component Model contributors.
//
// SPDX-License-Identifier: Apache-2.0
package repocpi
import (
"fmt"
"github.com/open-component-model/ocm/pkg/contexts/ocm/cpi"
"github.com/open-component-model/ocm/pkg/refmgmt/resource"
)
var (
ErrClosed = resource.ErrClosed
ErrTempVersion = fmt.Errorf("temporary component version cannot be updated")
)
// BlobContainer is the interface for an element capable to store blobs.
type BlobContainer interface {
GetBlob(name string) (cpi.DataAccess, error)
// GetStorageContext creates a storage context for blobs
// that is used to feed blob handlers for specific blob storage methods.
// If no handler accepts the blob, the AddBlobFor method will
// be used to store the blob
GetStorageContext() cpi.StorageContext
// AddBlob stores a local blob together with the component and
// potentially provides a global reference according to the OCI distribution spec
// if the blob described an oci artifact.
// The resulting access information (global and local) is provided as
// an access method specification usable in a component descriptor.
// This is the direct technical storage, without caring about any handler.
AddBlob(blob cpi.BlobAccess, refName string, global cpi.AccessSpec) (cpi.AccessSpec, error)
}