diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/inputtype.go b/cmds/ocm/commands/ocmcmds/common/inputs/inputtype.go index de73f81337..6a4d309926 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/inputtype.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/inputtype.go @@ -15,7 +15,7 @@ import ( "github.com/open-component-model/ocm/pkg/cobrautils/flagsets" "github.com/open-component-model/ocm/pkg/common" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/clictx" "github.com/open-component-model/ocm/pkg/contexts/datacontext" "github.com/open-component-model/ocm/pkg/errors" @@ -87,7 +87,7 @@ type InputResourceInfo struct { type InputSpec interface { runtime.VersionedTypedObject Validate(fldPath *field.Path, ctx Context, inputFilePath string) field.ErrorList - GetBlob(ctx Context, info InputResourceInfo) (accessio.BlobAccess, string, error) + GetBlob(ctx Context, info InputResourceInfo) (blobaccess.BlobAccess, string, error) GetInputVersion(ctx Context) string } @@ -272,7 +272,7 @@ func (r *UnknownInputSpec) Validate(fldPath *field.Path, ctx Context, inputFileP return field.ErrorList{field.Invalid(fldPath.Child("type"), r.GetType(), "unknown type")} } -func (r *UnknownInputSpec) GetBlob(ctx Context, info InputResourceInfo) (accessio.BlobAccess, string, error) { +func (r *UnknownInputSpec) GetBlob(ctx Context, info InputResourceInfo) (blobaccess.BlobAccess, string, error) { return nil, "", errors.ErrUnknown("input type", r.GetType()) } @@ -329,7 +329,7 @@ func (s *GenericInputSpec) Validate(fldPath *field.Path, ctx Context, inputFileP return s.effective.Validate(fldPath, ctx, inputFilePath) } -func (s *GenericInputSpec) GetBlob(ctx Context, info InputResourceInfo) (accessio.BlobAccess, string, error) { +func (s *GenericInputSpec) GetBlob(ctx Context, info InputResourceInfo) (blobaccess.BlobAccess, string, error) { if s.effective == nil { var err error s.effective, err = s.Evaluate(For(ctx)) diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/binary/spec.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/binary/spec.go index 9e2b3e6cbc..d7c344b0e2 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/binary/spec.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/binary/spec.go @@ -9,7 +9,7 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/runtime" ) @@ -39,6 +39,6 @@ func (s *Spec) Validate(fldPath *field.Path, ctx inputs.Context, inputFilePath s return nil } -func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (accessio.BlobAccess, string, error) { - return s.ProcessBlob(ctx, accessio.DataAccessForBytes([]byte(s.Data)), ctx.FileSystem()) +func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blobaccess.BlobAccess, string, error) { + return s.ProcessBlob(ctx, blobaccess.DataAccessForBytes([]byte(s.Data)), ctx.FileSystem()) } diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/directory/spec.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/directory/spec.go index 608c06becb..a9d131799c 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/directory/spec.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/directory/spec.go @@ -11,7 +11,7 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess/dirtree" "github.com/open-component-model/ocm/pkg/utils" ) @@ -58,7 +58,7 @@ func (s *Spec) Validate(fldPath *field.Path, ctx inputs.Context, inputFilePath s return allErrs } -func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (accessio.BlobAccess, string, error) { +func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blobaccess.BlobAccess, string, error) { fs := ctx.FileSystem() inputInfo, inputPath, err := inputs.FileInfo(ctx, s.Path, info.InputFilePath) if err != nil { diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/docker/spec.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/docker/spec.go index 021b41f275..e7a5a6f29c 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/docker/spec.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/docker/spec.go @@ -12,7 +12,7 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/ociimage" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/artifactset" "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/docker" "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/ociartifact" @@ -47,7 +47,7 @@ func (s *Spec) Validate(fldPath *field.Path, ctx inputs.Context, inputFilePath s return allErrs } -func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (accessio.BlobAccess, string, error) { +func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blobaccess.BlobAccess, string, error) { ctx.Printf("image %s\n", s.Path) locator, version, err := docker.ParseGenericRef(s.Path) if err != nil { diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/dockermulti/spec.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/dockermulti/spec.go index 88aa305fa2..5b82a26608 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/dockermulti/spec.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/dockermulti/spec.go @@ -7,7 +7,6 @@ package dockermulti import ( "fmt" - "github.com/open-component-model/ocm/pkg/contexts/oci/annotations" . "github.com/open-component-model/ocm/pkg/finalizer" "github.com/opencontainers/go-digest" @@ -15,9 +14,10 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/ociimage" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/clictx" "github.com/open-component-model/ocm/pkg/contexts/oci" + "github.com/open-component-model/ocm/pkg/contexts/oci/annotations" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" "github.com/open-component-model/ocm/pkg/contexts/oci/cpi" "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/artifactset" @@ -99,13 +99,13 @@ func (s *Spec) getVariant(ctx clictx.Context, finalize *Finalizer, variant strin return art, nil } -func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (accessio.BlobAccess, string, error) { +func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blobaccess.BlobAccess, string, error) { index := artdesc.NewIndexArtifact() i := 0 index.SetAnnotation(annotations.COMPVERS_ANNOTATION, info.ComponentVersion.String()) - feedback := func(blob accessio.BlobAccess, art cpi.ArtifactAccess) error { + feedback := func(blob blobaccess.BlobAccess, art cpi.ArtifactAccess) error { desc := artdesc.DefaultBlobDescriptor(blob) if art.IsManifest() { cfgBlob, err := art.ManifestAccess().GetConfigBlob() @@ -130,7 +130,7 @@ func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (acces blob, err := artifactset.SynthesizeArtifactBlobFor(info.ComponentVersion.GetVersion(), func() (fac artifactset.ArtifactFactory, main bool, err error) { var art cpi.ArtifactAccess - var blob accessio.BlobAccess + var blob blobaccess.BlobAccess switch { case i > len(s.Variants): diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/file/spec.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/file/spec.go index d23d9dc140..c6491cd40e 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/file/spec.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/file/spec.go @@ -9,7 +9,7 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" ) type Spec struct { @@ -28,6 +28,6 @@ func (s *Spec) Validate(fldPath *field.Path, ctx inputs.Context, inputFilePath s return (&FileProcessSpec{s.MediaFileSpec, nil}).Validate(fldPath, ctx, inputFilePath) } -func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (accessio.BlobAccess, string, error) { +func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blobaccess.BlobAccess, string, error) { return (&FileProcessSpec{s.MediaFileSpec, nil}).GetBlob(ctx, info) } diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/file/support.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/file/support.go index 6fd8abce72..9eea0655f5 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/file/support.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/file/support.go @@ -14,7 +14,6 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi" - "github.com/open-component-model/ocm/pkg/common/accessio" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/errors" "github.com/open-component-model/ocm/pkg/mime" @@ -36,7 +35,7 @@ func (s *FileProcessSpec) Validate(fldPath *field.Path, ctx inputs.Context, inpu return allErrs } -func (s *FileProcessSpec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (accessio.BlobAccess, string, error) { +func (s *FileProcessSpec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blobaccess.BlobAccess, string, error) { fs := ctx.FileSystem() inputInfo, inputPath, err := inputs.FileInfo(ctx, s.Path, info.InputFilePath) if err != nil { diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/helm/spec.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/helm/spec.go index 486b2ca1dd..d1cd8b67d7 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/helm/spec.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/helm/spec.go @@ -11,7 +11,7 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi" "github.com/open-component-model/ocm/pkg/common" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" ocihelm "github.com/open-component-model/ocm/pkg/contexts/oci/ociutils/helm" "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/ociartifact" "github.com/open-component-model/ocm/pkg/errors" @@ -92,7 +92,7 @@ func (s *Spec) Validate(fldPath *field.Path, ctx inputs.Context, inputFilePath s return allErrs } -func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blob accessio.BlobAccess, hint string, err error) { +func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blob blobaccess.BlobAccess, hint string, err error) { var chartLoader loader.Loader if s.HelmRepository == "" { _, inputPath, err := inputs.FileInfo(ctx, s.Path, info.InputFilePath) diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/ociimage/spec.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/ociimage/spec.go index e0d8ad72b4..714026c6df 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/ociimage/spec.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/ociimage/spec.go @@ -11,7 +11,7 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci" "github.com/open-component-model/ocm/pkg/contexts/oci/grammar" "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/artifactset" @@ -47,7 +47,7 @@ func (s *Spec) Validate(fldPath *field.Path, ctx inputs.Context, inputFilePath s return allErrs } -func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (accessio.BlobAccess, string, error) { +func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blobaccess.BlobAccess, string, error) { ctx.Printf("image %s\n", s.Path) ref, err := oci.ParseRef(s.Path) if err != nil { diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/spiff/spec.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/spiff/spec.go index a4303a34d4..6bf996289e 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/spiff/spec.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/spiff/spec.go @@ -15,7 +15,7 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/file" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/errors" "github.com/open-component-model/ocm/pkg/runtime" ) @@ -62,7 +62,7 @@ func (s *Spec) Validate(fldPath *field.Path, ctx inputs.Context, inputFilePath s return allErrs } -func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (accessio.BlobAccess, string, error) { +func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blobaccess.BlobAccess, string, error) { return (&file.FileProcessSpec{s.MediaFileSpec, s.process}).GetBlob(ctx, info) } diff --git a/cmds/ocm/commands/ocmcmds/common/inputs/types/utf8/spec.go b/cmds/ocm/commands/ocmcmds/common/inputs/types/utf8/spec.go index 8db35cc935..4c19e5b1a4 100644 --- a/cmds/ocm/commands/ocmcmds/common/inputs/types/utf8/spec.go +++ b/cmds/ocm/commands/ocmcmds/common/inputs/types/utf8/spec.go @@ -11,7 +11,7 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs" "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/runtime" ) @@ -110,7 +110,7 @@ func (s *Spec) Validate(fldPath *field.Path, ctx inputs.Context, inputFilePath s return nil } -func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (accessio.BlobAccess, string, error) { +func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (blobaccess.BlobAccess, string, error) { data, err := Plain([]byte(s.Text)) if s.Json != nil { @@ -125,7 +125,7 @@ func (s *Spec) GetBlob(ctx inputs.Context, info inputs.InputResourceInfo) (acces if err != nil { return nil, "", err } - return s.ProcessBlob(ctx, accessio.DataAccessForBytes(data), ctx.FileSystem()) + return s.ProcessBlob(ctx, blobaccess.DataAccessForBytes(data), ctx.FileSystem()) } func Prepare(raw []byte) (interface{}, error) { diff --git a/cmds/ocm/commands/toicmds/package/bootstrap/cmd.go b/cmds/ocm/commands/toicmds/package/bootstrap/cmd.go index 458acddd45..b074444b06 100644 --- a/cmds/ocm/commands/toicmds/package/bootstrap/cmd.go +++ b/cmds/ocm/commands/toicmds/package/bootstrap/cmd.go @@ -21,7 +21,6 @@ import ( "github.com/open-component-model/ocm/cmds/ocm/pkg/utils" topicbootstrap "github.com/open-component-model/ocm/cmds/ocm/topics/toi/bootstrapping" "github.com/open-component-model/ocm/pkg/common" - "github.com/open-component-model/ocm/pkg/common/accessio" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/clictx" "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/ocireg" @@ -200,7 +199,7 @@ func (o *Command) Complete(args []string) error { if err != nil { return errors.Wrapf(err, "failed reading credentials file %q", o.CredentialsFile) } - o.Credentials = accessio.DataAccessForBytes(data, o.CredentialsFile) + o.Credentials = blobaccess.DataAccessForBytes(data, o.CredentialsFile) } if len(o.ParameterFile) == 0 { if ok, _ := vfs.FileExists(o.FileSystem(), DEFAULT_PARAMETER_FILE); ok { @@ -212,7 +211,7 @@ func (o *Command) Complete(args []string) error { if err != nil { return errors.Wrapf(err, "failed reading parameter file %q", o.ParameterFile) } - o.Parameters = accessio.DataAccessForBytes(data, o.ParameterFile) + o.Parameters = blobaccess.DataAccessForBytes(data, o.ParameterFile) } return nil } diff --git a/pkg/common/accessio/access.go b/pkg/common/accessio/access.go index df83758612..88f0e87d1b 100644 --- a/pkg/common/accessio/access.go +++ b/pkg/common/accessio/access.go @@ -63,14 +63,14 @@ type NopCloser = iotools.NopCloser //////////////////////////////////////////////////////////////////////////////// // Deprecated: use blobaccess.DataAccessForReaderFunction. -func DataAccessForReaderFunction(reader func() (io.ReadCloser, error), origin string) DataAccess { +func DataAccessForReaderFunction(reader func() (io.ReadCloser, error), origin string) blobaccess.DataAccess { return blobaccess.DataAccessForReaderFunction(reader, origin) } //////////////////////////////////////////////////////////////////////////////// // Deprecated: use blobaccess.DataAccessForFile. -func DataAccessForFile(fs vfs.FileSystem, path string) DataAccess { +func DataAccessForFile(fs vfs.FileSystem, path string) blobaccess.DataAccess { return blobaccess.DataAccessForFile(fs, path) } @@ -131,19 +131,19 @@ func BlobAccessForFile(mimeType string, path string, fss ...vfs.FileSystem) blob } // Deprecated: use blobaccess.ForFileWithCloser. -func BlobAccessForFileWithCloser(closer io.Closer, mimeType string, path string, fss ...vfs.FileSystem) BlobAccess { +func BlobAccessForFileWithCloser(closer io.Closer, mimeType string, path string, fss ...vfs.FileSystem) blobaccess.BlobAccess { return blobaccess.ForFileWithCloser(closer, mimeType, path, fss...) } //////////////////////////////////////////////////////////////////////////////// // Deprecated: use blobaccess.ForTemporaryFile. -func BlobAccessForTemporaryFile(mime string, temp vfs.File, fss ...vfs.FileSystem) BlobAccess { +func BlobAccessForTemporaryFile(mime string, temp vfs.File, fss ...vfs.FileSystem) blobaccess.BlobAccess { return blobaccess.ForTemporaryFile(mime, temp, fss...) } // Deprecated: use blobaccess.ForTemporaryFilePath. -func BlobAccessForTemporaryFilePath(mime string, temp string, fss ...vfs.FileSystem) BlobAccess { +func BlobAccessForTemporaryFilePath(mime string, temp string, fss ...vfs.FileSystem) blobaccess.BlobAccess { return blobaccess.ForTemporaryFilePath(mime, temp, fss...) } diff --git a/pkg/common/accessio/cache.go b/pkg/common/accessio/cache.go index 62d20099a0..449e875eb3 100644 --- a/pkg/common/accessio/cache.go +++ b/pkg/common/accessio/cache.go @@ -36,12 +36,12 @@ func (_ StaticAllocatable) Unref() error { return nil } type BlobSource interface { refmgmt.Allocatable - GetBlobData(digest digest.Digest) (int64, DataAccess, error) + GetBlobData(digest digest.Digest) (int64, blobaccess.DataAccess, error) } type BlobSink interface { refmgmt.Allocatable - AddBlob(blob BlobAccess) (int64, digest.Digest, error) + AddBlob(blob blobaccess.BlobAccess) (int64, digest.Digest, error) } type RootedCache interface { @@ -60,7 +60,7 @@ type CleanupCache interface { type BlobCache interface { BlobSource BlobSink - AddData(data DataAccess) (int64, digest.Digest, error) + AddData(data blobaccess.DataAccess) (int64, digest.Digest, error) } type blobCache struct { @@ -180,7 +180,7 @@ func (c *blobCache) cleanup() error { return vfs.Cleanup(c.cache) } -func (c *blobCache) GetBlobData(digest digest.Digest) (int64, DataAccess, error) { +func (c *blobCache) GetBlobData(digest digest.Digest) (int64, blobaccess.DataAccess, error) { err := c.Ref() if err == nil { defer c.Unref() @@ -193,7 +193,7 @@ func (c *blobCache) GetBlobData(digest digest.Digest) (int64, DataAccess, error) vfs.WriteFile(c.cache, path+ACCESS_SUFFIX, []byte{}, 0o600) // now := time.Now() // c.cache.Chtimes(path+ACCESS_SUFFIX, now, now) - return fi.Size(), DataAccessForFile(c.cache, path), nil + return fi.Size(), blobaccess.DataAccessForFile(c.cache, path), nil } if os.IsNotExist(err) { return -1, nil, blobaccess.ErrBlobNotFound(digest) @@ -202,7 +202,7 @@ func (c *blobCache) GetBlobData(digest digest.Digest) (int64, DataAccess, error) return BLOB_UNKNOWN_SIZE, nil, err } -func (c *blobCache) AddBlob(blob BlobAccess) (int64, digest.Digest, error) { +func (c *blobCache) AddBlob(blob blobaccess.BlobAccess) (int64, digest.Digest, error) { err := c.Ref() if err != nil { return BLOB_UNKNOWN_SIZE, BLOB_UNKNOWN_DIGEST, err @@ -349,7 +349,7 @@ func (c *cascadedCache) cleanup() error { return list.Result() } -func (c *cascadedCache) GetBlobData(digest digest.Digest) (int64, DataAccess, error) { +func (c *cascadedCache) GetBlobData(digest digest.Digest) (int64, blobaccess.DataAccess, error) { err := c.Ref() if err != nil { return BLOB_UNKNOWN_SIZE, nil, err @@ -449,7 +449,7 @@ func (a *cached) GetBlobData(digest digest.Digest) (int64, blobaccess.DataAccess return size, acc, err } -func (a *cached) AddBlob(blob BlobAccess) (int64, digest.Digest, error) { +func (a *cached) AddBlob(blob blobaccess.BlobAccess) (int64, digest.Digest, error) { err := a.Ref() if err != nil { return BLOB_UNKNOWN_SIZE, BLOB_UNKNOWN_DIGEST, err @@ -483,13 +483,13 @@ func (c *cached) AddData(data blobaccess.DataAccess) (int64, digest.Digest, erro type cachedAccess struct { lock sync.Mutex cache *cached - access DataAccess + access blobaccess.DataAccess digest digest.Digest size int64 - orig DataAccess + orig blobaccess.DataAccess } -var _ DataAccess = (*cachedAccess)(nil) +var _ blobaccess.DataAccess = (*cachedAccess)(nil) func CachedAccess(src BlobSource, dst BlobSink, cache BlobCache) (BlobCache, error) { var err error @@ -521,7 +521,7 @@ func CachedAccess(src BlobSource, dst BlobSink, cache BlobCache) (BlobCache, err return c, nil } -func newCachedAccess(cache *cached, blob DataAccess, size int64, digest digest.Digest) DataAccess { +func newCachedAccess(cache *cached, blob blobaccess.DataAccess, size int64, digest digest.Digest) blobaccess.DataAccess { return &cachedAccess{ cache: cache, size: size, @@ -553,7 +553,7 @@ func (c *cachedAccess) Get() ([]byte, error) { if err != nil { return nil, err } - c.size, c.digest, err = c.cache.cache.AddData(DataAccessForBytes(data)) + c.size, c.digest, err = c.cache.cache.AddData(blobaccess.DataAccessForBytes(data)) if err == nil { c.orig.Close() c.orig = nil diff --git a/pkg/common/accessio/cache_test.go b/pkg/common/accessio/cache_test.go index 4ca6235c3a..b54f0df386 100644 --- a/pkg/common/accessio/cache_test.go +++ b/pkg/common/accessio/cache_test.go @@ -14,6 +14,7 @@ import ( "github.com/open-component-model/ocm/pkg/common" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" ) var _ = Describe("cache management", func() { @@ -34,7 +35,7 @@ var _ = Describe("cache management", func() { source, err = accessio.NewDefaultBlobCache() Expect(err).To(Succeed()) - td1_size, td1_digest, err = source.AddData(accessio.DataAccessForBytes([]byte("testdata"))) + td1_size, td1_digest, err = source.AddData(blobaccess.DataAccessForBytes([]byte("testdata"))) Expect(err).To(Succeed()) cache, err = accessio.CachedAccess(source, nil, local) diff --git a/pkg/common/accessio/digestreader.go b/pkg/common/accessio/digestreader.go index 5f8b2c09d4..a01b84bd63 100644 --- a/pkg/common/accessio/digestreader.go +++ b/pkg/common/accessio/digestreader.go @@ -11,6 +11,7 @@ import ( "github.com/opencontainers/go-digest" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/errors" ) @@ -66,7 +67,7 @@ func NewDigestReaderWithHash(hash crypto.Hash, r io.Reader) *DigestReader { } } -func Digest(access DataAccess) (digest.Digest, error) { +func Digest(access blobaccess.DataAccess) (digest.Digest, error) { reader, err := access.Reader() if err != nil { return "", err diff --git a/pkg/common/accessio/wrapper.go b/pkg/common/accessio/wrapper.go index 90f5dc714d..04a508c8ad 100644 --- a/pkg/common/accessio/wrapper.go +++ b/pkg/common/accessio/wrapper.go @@ -9,6 +9,7 @@ import ( "github.com/opencontainers/go-digest" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/errors" ) @@ -42,10 +43,10 @@ func (d *readerWriter) WriteTo(w Writer) (size int64, dig digest.Digest, err err } type dataAccessWriter struct { - access DataAccess + access blobaccess.DataAccess } -func NewDataAccessWriter(acc DataAccess) DataWriter { +func NewDataAccessWriter(acc blobaccess.DataAccess) DataWriter { return &dataAccessWriter{acc} } diff --git a/pkg/common/accessobj/cachedblob_test.go b/pkg/common/accessobj/cachedblob_test.go index 90a13b2079..fd0e44c6a7 100644 --- a/pkg/common/accessobj/cachedblob_test.go +++ b/pkg/common/accessobj/cachedblob_test.go @@ -28,7 +28,7 @@ type Source struct { } func NewData(data string) *Source { - return &Source{accessio.DataAccessForString(data), 0} + return &Source{blobaccess.DataAccessForString(data), 0} } func (s *Source) Reader() (io.ReadCloser, error) { diff --git a/pkg/common/accessobj/filesystemaccess.go b/pkg/common/accessobj/filesystemaccess.go index c61bcd1142..d2f18a152c 100644 --- a/pkg/common/accessobj/filesystemaccess.go +++ b/pkg/common/accessobj/filesystemaccess.go @@ -84,7 +84,7 @@ func (a *FileSystemBlobAccess) GetBlobData(digest digest.Digest) (int64, blobacc } } -func (a *FileSystemBlobAccess) GetBlobDataByName(name string) (accessio.DataAccess, error) { +func (a *FileSystemBlobAccess) GetBlobDataByName(name string) (blobaccess.DataAccess, error) { if a.IsClosed() { return nil, accessio.ErrClosed } diff --git a/pkg/contexts/oci/artdesc/artifact.go b/pkg/contexts/oci/artdesc/artifact.go index 35280dcd62..71a0f8f1ba 100644 --- a/pkg/contexts/oci/artdesc/artifact.go +++ b/pkg/contexts/oci/artdesc/artifact.go @@ -11,7 +11,7 @@ import ( "github.com/opencontainers/go-digest" ociv1 "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc/helper" "github.com/open-component-model/ocm/pkg/errors" ) @@ -160,7 +160,7 @@ func (d *Artifact) modifyAnnotation(mod func(annos *map[string]string)) error { return nil } -func (d *Artifact) ToBlobAccess() (accessio.BlobAccess, error) { +func (d *Artifact) ToBlobAccess() (blobaccess.BlobAccess, error) { if d.IsManifest() { return d.manifest.ToBlobAccess() } diff --git a/pkg/contexts/oci/artdesc/config.go b/pkg/contexts/oci/artdesc/config.go index b8672fe8d9..bce0dcf1d2 100644 --- a/pkg/contexts/oci/artdesc/config.go +++ b/pkg/contexts/oci/artdesc/config.go @@ -9,12 +9,12 @@ import ( ociv1 "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" ) type ImageConfig = ociv1.Image -func ParseImageConfig(blob accessio.BlobAccess) (*ImageConfig, error) { +func ParseImageConfig(blob blobaccess.BlobAccess) (*ImageConfig, error) { var cfg ImageConfig data, err := blob.Get() diff --git a/pkg/contexts/oci/cpi/support/namespace.go b/pkg/contexts/oci/cpi/support/namespace.go index 2a628e1377..b2258a6ab6 100644 --- a/pkg/contexts/oci/cpi/support/namespace.go +++ b/pkg/contexts/oci/cpi/support/namespace.go @@ -8,6 +8,7 @@ import ( "github.com/opencontainers/go-digest" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessio/refmgmt" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" "github.com/open-component-model/ocm/pkg/contexts/oci/cpi" @@ -39,7 +40,7 @@ type NamespaceContainer interface { GetArtifact(i NamespaceAccessImpl, vers string) (cpi.ArtifactAccess, error) NewArtifact(i NamespaceAccessImpl, arts ...*artdesc.Artifact) (cpi.ArtifactAccess, error) - AddArtifact(artifact cpi.Artifact, tags ...string) (access accessio.BlobAccess, err error) + AddArtifact(artifact cpi.Artifact, tags ...string) (access blobaccess.BlobAccess, err error) AddTags(digest digest.Digest, tags ...string) error ListTags() ([]string, error) @@ -108,7 +109,7 @@ func (i *namespaceAccessImpl) GetArtifact(vers string) (cpi.ArtifactAccess, erro return i.NamespaceContainer.GetArtifact(i, vers) } -func (i *namespaceAccessImpl) AddArtifact(artifact cpi.Artifact, tags ...string) (access accessio.BlobAccess, err error) { +func (i *namespaceAccessImpl) AddArtifact(artifact cpi.Artifact, tags ...string) (access blobaccess.BlobAccess, err error) { return i.NamespaceContainer.AddArtifact(artifact, tags...) } diff --git a/pkg/contexts/oci/internal/repository.go b/pkg/contexts/oci/internal/repository.go index 83ebf964fe..28bc73ab68 100644 --- a/pkg/contexts/oci/internal/repository.go +++ b/pkg/contexts/oci/internal/repository.go @@ -9,7 +9,7 @@ import ( "github.com/opencontainers/go-digest" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessio/resource" "github.com/open-component-model/ocm/pkg/contexts/credentials" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" @@ -42,8 +42,8 @@ type RepositorySource interface { } type ( - BlobAccess = accessio.BlobAccess - DataAccess = accessio.DataAccess + BlobAccess = blobaccess.BlobAccess + DataAccess = blobaccess.DataAccess ) type BlobSource interface { diff --git a/pkg/contexts/oci/ociutils/helm/art_test.go b/pkg/contexts/oci/ociutils/helm/art_test.go index 960ce945f9..756ea2f299 100644 --- a/pkg/contexts/oci/ociutils/helm/art_test.go +++ b/pkg/contexts/oci/ociutils/helm/art_test.go @@ -19,7 +19,7 @@ import ( "helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chartutil" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/contexts/oci/ociutils/helm" "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/artifactset" @@ -59,7 +59,7 @@ func norm(chart *chart.Chart) *chart.Chart { return chart } -func get(blob accessio.DataAccess, expected []byte) []byte { +func get(blob blobaccess.DataAccess, expected []byte) []byte { data, err := blob.Get() ExpectWithOffset(1, err).To(Succeed()) if expected != nil { diff --git a/pkg/contexts/oci/ociutils/info.go b/pkg/contexts/oci/ociutils/info.go index 3ca519e985..637ccd1301 100644 --- a/pkg/contexts/oci/ociutils/info.go +++ b/pkg/contexts/oci/ociutils/info.go @@ -15,7 +15,6 @@ import ( "sigs.k8s.io/yaml" "github.com/open-component-model/ocm/pkg/common" - "github.com/open-component-model/ocm/pkg/common/accessio" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/compression" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" @@ -106,7 +105,7 @@ type LayerInfo struct { Content interface{} `json:"content,omitempty"` } -func GetLayerInfo(blob accessio.BlobAccess, layerFiles bool) *LayerInfo { +func GetLayerInfo(blob blobaccess.BlobAccess, layerFiles bool) *LayerInfo { info := &LayerInfo{} if mime.IsJSON(blob.MimeType()) { diff --git a/pkg/contexts/oci/ociutils/print.go b/pkg/contexts/oci/ociutils/print.go index cafa240ca3..f0ad1c29fd 100644 --- a/pkg/contexts/oci/ociutils/print.go +++ b/pkg/contexts/oci/ociutils/print.go @@ -12,7 +12,6 @@ import ( "strings" "github.com/open-component-model/ocm/pkg/common" - "github.com/open-component-model/ocm/pkg/common/accessio" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/compression" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" @@ -72,7 +71,7 @@ func PrintManifest(pr common.Printer, m cpi.ManifestAccess, listFiles bool) { } } -func PrintLayer(pr common.Printer, blob accessio.BlobAccess, listFiles bool) { +func PrintLayer(pr common.Printer, blob blobaccess.BlobAccess, listFiles bool) { reader, err := blob.Reader() if err != nil { pr.Printf("cannot read blob: %s\n", err.Error()) diff --git a/pkg/contexts/oci/repositories/artifactset/artifactset.go b/pkg/contexts/oci/repositories/artifactset/artifactset.go index 4fc353aeb2..d01fefd0d2 100644 --- a/pkg/contexts/oci/repositories/artifactset/artifactset.go +++ b/pkg/contexts/oci/repositories/artifactset/artifactset.go @@ -11,6 +11,7 @@ import ( "github.com/opencontainers/go-digest" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" "github.com/open-component-model/ocm/pkg/contexts/oci/cpi" @@ -59,7 +60,7 @@ func (a *ArtifactSet) Close() error { // why??? return a.NamespaceAccess.Close() } -func (a *ArtifactSet) GetBlobData(digest digest.Digest) (int64, accessio.DataAccess, error) { +func (a *ArtifactSet) GetBlobData(digest digest.Digest) (int64, blobaccess.DataAccess, error) { return a.container.GetBlobData(digest) } @@ -396,7 +397,7 @@ func (a *namespaceContainer) AnnotateArtifact(digest digest.Digest, name, value return errors.ErrUnknown(cpi.KIND_OCIARTIFACT, digest.String()) } -func (a *namespaceContainer) AddArtifact(artifact cpi.Artifact, tags ...string) (access accessio.BlobAccess, err error) { +func (a *namespaceContainer) AddArtifact(artifact cpi.Artifact, tags ...string) (access blobaccess.BlobAccess, err error) { blob, err := a.AddPlatformArtifact(artifact, nil) if err != nil { return nil, err @@ -404,9 +405,9 @@ func (a *namespaceContainer) AddArtifact(artifact cpi.Artifact, tags ...string) return blob, a.AddTags(blob.Digest(), tags...) } -func (a *namespaceContainer) AddPlatformArtifact(artifact cpi.Artifact, platform *artdesc.Platform) (access accessio.BlobAccess, err error) { +func (a *namespaceContainer) AddPlatformArtifact(artifact cpi.Artifact, platform *artdesc.Platform) (access blobaccess.BlobAccess, err error) { if a.IsClosed() { - return nil, accessio.ErrClosed + return nil, blobaccess.ErrClosed } if a.IsReadOnly() { return nil, accessio.ErrReadOnly diff --git a/pkg/contexts/oci/repositories/artifactset/format.go b/pkg/contexts/oci/repositories/artifactset/format.go index 6aa844a7f2..4ce19339b2 100644 --- a/pkg/contexts/oci/repositories/artifactset/format.go +++ b/pkg/contexts/oci/repositories/artifactset/format.go @@ -10,6 +10,7 @@ import ( "github.com/mandelsoft/vfs/pkg/vfs" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/errors" mime2 "github.com/open-component-model/ocm/pkg/mime" @@ -201,11 +202,11 @@ func SupportedFormats() []accessio.FileFormat { //////////////////////////////////////////////////////////////////////////////// -func OpenFromBlob(acc accessobj.AccessMode, blob accessio.BlobAccess, opts ...accessio.Option) (*Object, error) { +func OpenFromBlob(acc accessobj.AccessMode, blob blobaccess.BlobAccess, opts ...accessio.Option) (*Object, error) { return OpenFromDataAccess(acc, blob.MimeType(), blob, opts...) } -func OpenFromDataAccess(acc accessobj.AccessMode, mime string, data accessio.DataAccess, opts ...accessio.Option) (*Object, error) { +func OpenFromDataAccess(acc accessobj.AccessMode, mime string, data blobaccess.DataAccess, opts ...accessio.Option) (*Object, error) { o, err := accessio.AccessOptions(nil, opts...) if err != nil { return nil, err diff --git a/pkg/contexts/oci/repositories/artifactset/utils_synthesis.go b/pkg/contexts/oci/repositories/artifactset/utils_synthesis.go index 777354987e..6ba5aa8ad1 100644 --- a/pkg/contexts/oci/repositories/artifactset/utils_synthesis.go +++ b/pkg/contexts/oci/repositories/artifactset/utils_synthesis.go @@ -24,7 +24,7 @@ import ( const SynthesizedBlobFormat = "+tar+gzip" type ArtifactBlob interface { - accessio.BlobAccess + blobaccess.BlobAccess } type Producer func(set *ArtifactSet) (string, error) @@ -115,7 +115,7 @@ type ArtifactFactory func(set *ArtifactSet) (digest.Digest, string, error) type ArtifactIterator func() (ArtifactFactory, bool, error) // ArtifactFeedback is called after an artifact has successfully be added. -type ArtifactFeedback func(blob accessio.BlobAccess, art cpi.ArtifactAccess) error +type ArtifactFeedback func(blob blobaccess.BlobAccess, art cpi.ArtifactAccess) error // ArtifactTransferCreator provides an ArtifactFactory transferring the given artifact. func ArtifactTransferCreator(art cpi.ArtifactAccess, finalizer *Finalizer, feedback ...ArtifactFeedback) ArtifactFactory { diff --git a/pkg/contexts/oci/repositories/ctf/format.go b/pkg/contexts/oci/repositories/ctf/format.go index f0a08d9747..2648bc6f1a 100644 --- a/pkg/contexts/oci/repositories/ctf/format.go +++ b/pkg/contexts/oci/repositories/ctf/format.go @@ -12,6 +12,7 @@ import ( "github.com/mandelsoft/vfs/pkg/vfs" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/contexts/oci/cpi" "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/ctf/format" @@ -93,7 +94,7 @@ func SupportedFormats() []accessio.FileFormat { //////////////////////////////////////////////////////////////////////////////// -func OpenFromBlob(ctx cpi.ContextProvider, acc accessobj.AccessMode, blob accessio.BlobAccess, opts ...accessio.Option) (*Object, error) { +func OpenFromBlob(ctx cpi.ContextProvider, acc accessobj.AccessMode, blob blobaccess.BlobAccess, opts ...accessio.Option) (*Object, error) { o, err := accessio.AccessOptions(nil, opts...) if err != nil { return nil, err diff --git a/pkg/contexts/oci/repositories/ctf/namespace.go b/pkg/contexts/oci/repositories/ctf/namespace.go index ea8b04573c..b7a0efe158 100644 --- a/pkg/contexts/oci/repositories/ctf/namespace.go +++ b/pkg/contexts/oci/repositories/ctf/namespace.go @@ -8,6 +8,7 @@ import ( "github.com/opencontainers/go-digest" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" "github.com/open-component-model/ocm/pkg/contexts/oci/cpi" "github.com/open-component-model/ocm/pkg/contexts/oci/cpi/support" @@ -76,7 +77,7 @@ func (n *namespaceContainer) HasArtifact(vers string) (bool, error) { return meta != nil, nil } -func (n *namespaceContainer) AddArtifact(artifact cpi.Artifact, tags ...string) (access accessio.BlobAccess, err error) { +func (n *namespaceContainer) AddArtifact(artifact cpi.Artifact, tags ...string) (access blobaccess.BlobAccess, err error) { n.repo.base.Lock() defer n.repo.base.Unlock() diff --git a/pkg/contexts/oci/repositories/ctf/synthesis_test.go b/pkg/contexts/oci/repositories/ctf/synthesis_test.go index d76209c00b..e32a79296f 100644 --- a/pkg/contexts/oci/repositories/ctf/synthesis_test.go +++ b/pkg/contexts/oci/repositories/ctf/synthesis_test.go @@ -32,7 +32,7 @@ import ( ) type DummyMethod struct { - accessio.BlobAccess + blobaccess.BlobAccess } var _ ocm.AccessMethod = (*DummyMethod)(nil) @@ -46,7 +46,7 @@ func (d *DummyMethod) AccessSpec() cpi.AccessSpec { return nil } -func CheckBlob(blob accessio.BlobAccess) oci.NamespaceAccess { +func CheckBlob(blob blobaccess.BlobAccess) oci.NamespaceAccess { set := Must(artifactset.OpenFromBlob(accessobj.ACC_READONLY, blob)) defer func() { if set != nil { diff --git a/pkg/contexts/oci/repositories/docker/convert.go b/pkg/contexts/oci/repositories/docker/convert.go index af1075401a..553f871319 100644 --- a/pkg/contexts/oci/repositories/docker/convert.go +++ b/pkg/contexts/oci/repositories/docker/convert.go @@ -74,7 +74,7 @@ func (a *artBlobCache) Unref() error { return nil } -func (a *artBlobCache) GetBlobData(digest digest.Digest) (int64, accessio.DataAccess, error) { +func (a *artBlobCache) GetBlobData(digest digest.Digest) (int64, blobaccess.DataAccess, error) { blob, err := a.access.GetBlob(digest) if err != nil { return -1, nil, err @@ -82,7 +82,7 @@ func (a *artBlobCache) GetBlobData(digest digest.Digest) (int64, accessio.DataAc return blob.Size(), blob, err } -func (a *artBlobCache) AddBlob(blob accessio.BlobAccess) (int64, digest.Digest, error) { +func (a *artBlobCache) AddBlob(blob blobaccess.BlobAccess) (int64, digest.Digest, error) { err := a.access.AddBlob(blob) if err != nil { return -1, "", err diff --git a/pkg/contexts/oci/repositories/docker/namespace.go b/pkg/contexts/oci/repositories/docker/namespace.go index df493f1c26..1aaedb40e3 100644 --- a/pkg/contexts/oci/repositories/docker/namespace.go +++ b/pkg/contexts/oci/repositories/docker/namespace.go @@ -216,7 +216,7 @@ func (n *namespaceHandler) HasArtifact(vers string) (bool, error) { return false, nil } -func (n *namespaceContainer) AddArtifact(artifact cpi.Artifact, tags ...string) (access accessio.BlobAccess, err error) { +func (n *namespaceContainer) AddArtifact(artifact cpi.Artifact, tags ...string) (access blobaccess.BlobAccess, err error) { tag := "latest" if len(tags) > 0 { tag = tags[0] diff --git a/pkg/contexts/oci/repositories/ocireg/utils.go b/pkg/contexts/oci/repositories/ocireg/utils.go index 01538c6b02..0a00b9460c 100644 --- a/pkg/contexts/oci/repositories/ocireg/utils.go +++ b/pkg/contexts/oci/repositories/ocireg/utils.go @@ -17,6 +17,7 @@ import ( "github.com/sirupsen/logrus" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" "github.com/open-component-model/ocm/pkg/contexts/oci/cpi" "github.com/open-component-model/ocm/pkg/docker/resolve" @@ -84,12 +85,12 @@ func readAll(reader io.ReadCloser, err error) ([]byte, error) { return data, nil } -func push(ctx context.Context, p resolve.Pusher, blob accessio.BlobAccess) error { +func push(ctx context.Context, p resolve.Pusher, blob blobaccess.BlobAccess) error { desc := *artdesc.DefaultBlobDescriptor(blob) return pushData(ctx, p, desc, blob) } -func pushData(ctx context.Context, p resolve.Pusher, desc artdesc.Descriptor, data accessio.DataAccess) error { +func pushData(ctx context.Context, p resolve.Pusher, desc artdesc.Descriptor, data blobaccess.DataAccess) error { key := remotes.MakeRefKey(ctx, desc) if desc.Size == 0 { desc.Size = -1 diff --git a/pkg/contexts/ocm/accessmethods/github/method.go b/pkg/contexts/ocm/accessmethods/github/method.go index 88766fa4b4..0bda080218 100644 --- a/pkg/contexts/ocm/accessmethods/github/method.go +++ b/pkg/contexts/ocm/accessmethods/github/method.go @@ -18,6 +18,7 @@ import ( "golang.org/x/oauth2" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessio/downloader" hd "github.com/open-component-model/ocm/pkg/common/accessio/downloader/http" "github.com/open-component-model/ocm/pkg/common/accessobj" @@ -150,7 +151,7 @@ type RepositoryService interface { type accessMethod struct { lock sync.Mutex - access accessio.BlobAccess + access blobaccess.BlobAccess compvers cpi.ComponentVersionAccess spec *AccessSpec diff --git a/pkg/contexts/ocm/accessmethods/helm/method.go b/pkg/contexts/ocm/accessmethods/helm/method.go index 8cfe696e3c..b2caad6f59 100644 --- a/pkg/contexts/ocm/accessmethods/helm/method.go +++ b/pkg/contexts/ocm/accessmethods/helm/method.go @@ -12,7 +12,6 @@ import ( "sync" "github.com/open-component-model/ocm/pkg/common" - "github.com/open-component-model/ocm/pkg/common/accessio" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/ocm/cpi" "github.com/open-component-model/ocm/pkg/errors" @@ -107,7 +106,7 @@ func (s *AccessSpec) GetChartName() string { type accessMethod struct { lock sync.Mutex - blob accessio.BlobAccess + blob blobaccess.BlobAccess comp cpi.ComponentVersionAccess spec *AccessSpec diff --git a/pkg/contexts/ocm/accessmethods/npm/method.go b/pkg/contexts/ocm/accessmethods/npm/method.go index 80ab7ae1dd..0643c7f0f6 100644 --- a/pkg/contexts/ocm/accessmethods/npm/method.go +++ b/pkg/contexts/ocm/accessmethods/npm/method.go @@ -122,7 +122,7 @@ func (a *AccessSpec) getPackageMeta(ctx cpi.Context) (*meta, error) { //////////////////////////////////////////////////////////////////////////////// func newMethod(c cpi.ComponentVersionAccess, a *AccessSpec) (cpi.AccessMethod, error) { - factory := func() (accessio.BlobAccess, error) { + factory := func() (blobaccess.BlobAccess, error) { meta, err := a.getPackageMeta(c.GetContext()) if err != nil { return nil, err diff --git a/pkg/contexts/ocm/accessmethods/plugin/method.go b/pkg/contexts/ocm/accessmethods/plugin/method.go index b6f1e4071f..c89e3b6166 100644 --- a/pkg/contexts/ocm/accessmethods/plugin/method.go +++ b/pkg/contexts/ocm/accessmethods/plugin/method.go @@ -9,7 +9,6 @@ import ( "io" "sync" - "github.com/open-component-model/ocm/pkg/common/accessio" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/contexts/ocm" @@ -66,7 +65,7 @@ func (s *AccessSpec) Handler() *PluginHandler { type accessMethod struct { lock sync.Mutex - blob accessio.BlobAccess + blob blobaccess.BlobAccess ctx ocm.Context handler *PluginHandler diff --git a/pkg/contexts/ocm/accessmethods/s3/method.go b/pkg/contexts/ocm/accessmethods/s3/method.go index 67a640a9ef..089f732287 100644 --- a/pkg/contexts/ocm/accessmethods/s3/method.go +++ b/pkg/contexts/ocm/accessmethods/s3/method.go @@ -10,6 +10,7 @@ import ( . "github.com/open-component-model/ocm/pkg/exception" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessio/downloader" "github.com/open-component-model/ocm/pkg/common/accessio/downloader/s3" "github.com/open-component-model/ocm/pkg/common/accessobj" @@ -109,7 +110,7 @@ func (a *AccessSpec) GetInexpensiveContentVersionIdentity(c cpi.ComponentVersion //////////////////////////////////////////////////////////////////////////////// type accessMethod struct { - accessio.BlobAccess + blobaccess.BlobAccess comp cpi.ComponentVersionAccess spec *AccessSpec diff --git a/pkg/contexts/ocm/blobhandler/handlers/generic/ocirepo/blobhandler.go b/pkg/contexts/ocm/blobhandler/handlers/generic/ocirepo/blobhandler.go index 91d871f176..8a33597c07 100644 --- a/pkg/contexts/ocm/blobhandler/handlers/generic/ocirepo/blobhandler.go +++ b/pkg/contexts/ocm/blobhandler/handlers/generic/ocirepo/blobhandler.go @@ -9,7 +9,7 @@ import ( "path" "strings" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/contexts/oci" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" @@ -71,7 +71,7 @@ func (b *artifactHandler) StoreBlob(blob cpi.BlobAccess, artType, hint string, g "hint", hint, "target", string(target), } - if m, ok := blob.(accessio.AnnotatedBlobAccess[cpi.AccessMethod]); ok { + if m, ok := blob.(blobaccess.AnnotatedBlobAccess[cpi.AccessMethod]); ok { // prepare for optimized point to point implementation cpi.BlobHandlerLogger(ctx.GetContext()).Debug("oci generic artifact handler with ocm access source", generics.AppendedSlice[any](values, "sourcetype", m.Source().AccessSpec().GetType())..., diff --git a/pkg/contexts/ocm/blobhandler/handlers/oci/ocirepo/blobhandler.go b/pkg/contexts/ocm/blobhandler/handlers/oci/ocirepo/blobhandler.go index 4061d9f930..4a18cf643b 100644 --- a/pkg/contexts/ocm/blobhandler/handlers/oci/ocirepo/blobhandler.go +++ b/pkg/contexts/ocm/blobhandler/handlers/oci/ocirepo/blobhandler.go @@ -13,7 +13,7 @@ import ( "github.com/opencontainers/go-digest" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/contexts/oci" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" @@ -87,7 +87,7 @@ func (b *blobHandler) StoreBlob(blob cpi.BlobAccess, artType, hint string, globa "mediatype", blob.MimeType(), "hint", hint, } - if m, ok := blob.(accessio.AnnotatedBlobAccess[cpi.AccessMethodView]); ok { + if m, ok := blob.(blobaccess.AnnotatedBlobAccess[cpi.AccessMethodView]); ok { cpi.BlobHandlerLogger(ctx.GetContext()).Debug("oci blob handler with ocm access source", generics.AppendedSlice[any](values, "sourcetype", m.Source().AccessSpec().GetType())..., ) @@ -150,7 +150,7 @@ func (b *artifactHandler) StoreBlob(blob cpi.BlobAccess, artType, hint string, g keep := keepblobattr.Get(ctx.GetContext()) - if m, ok := blob.(accessio.AnnotatedBlobAccess[cpi.AccessMethodView]); ok { + if m, ok := blob.(blobaccess.AnnotatedBlobAccess[cpi.AccessMethodView]); ok { // prepare for optimized point to point implementation log.Debug("oci artifact handler with ocm access source", generics.AppendedSlice[any](values, "sourcetype", m.Source().AccessSpec().GetType())..., diff --git a/pkg/contexts/ocm/blobhandler/handlers/ocm/ctx.go b/pkg/contexts/ocm/blobhandler/handlers/ocm/ctx.go index 201478d1d9..a2fd058892 100644 --- a/pkg/contexts/ocm/blobhandler/handlers/ocm/ctx.go +++ b/pkg/contexts/ocm/blobhandler/handlers/ocm/ctx.go @@ -5,13 +5,13 @@ package ocm import ( - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/ocm/cpi" "github.com/open-component-model/ocm/pkg/utils" ) type BlobSink interface { - AddBlob(blob accessio.BlobAccess) (string, error) + AddBlob(blob blobaccess.BlobAccess) (string, error) } // StorageContext is the context information passed for Blobhandler @@ -35,6 +35,6 @@ func New(repo cpi.Repository, vers cpi.ComponentVersionAccess, access BlobSink, } } -func (c *DefaultStorageContext) AddBlob(blob accessio.BlobAccess) (string, error) { +func (c *DefaultStorageContext) AddBlob(blob blobaccess.BlobAccess) (string, error) { return c.Sink.AddBlob(blob) } diff --git a/pkg/contexts/ocm/cpi/method.go b/pkg/contexts/ocm/cpi/method.go index 1a809f21a4..6c6874dc66 100644 --- a/pkg/contexts/ocm/cpi/method.go +++ b/pkg/contexts/ocm/cpi/method.go @@ -8,14 +8,14 @@ import ( "io" "sync" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" ) //////////////////////////////////////////////////////////////////////////////// type DefaultAccessMethod struct { lock sync.Mutex - access accessio.BlobAccess + access blobaccess.BlobAccess factory BlobAccessFactory comp ComponentVersionAccess @@ -36,7 +36,7 @@ func NewDefaultMethod(c ComponentVersionAccess, a AccessSpec, mime string, fac B } } -func (m *DefaultAccessMethod) getAccess() (accessio.BlobAccess, error) { +func (m *DefaultAccessMethod) getAccess() (blobaccess.BlobAccess, error) { m.lock.Lock() defer m.lock.Unlock() if m.access == nil { diff --git a/pkg/contexts/ocm/cpi/view.go b/pkg/contexts/ocm/cpi/view.go index 1b90e47522..933f79fc7a 100644 --- a/pkg/contexts/ocm/cpi/view.go +++ b/pkg/contexts/ocm/cpi/view.go @@ -12,6 +12,7 @@ import ( "github.com/open-component-model/ocm/pkg/common" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessio/resource" "github.com/open-component-model/ocm/pkg/contexts/credentials" "github.com/open-component-model/ocm/pkg/contexts/oci/cpi" @@ -243,10 +244,14 @@ func (c *componentAccessView) AddVersion(acc ComponentVersionAccess) error { return errors.ErrInvalid("component name", acc.GetName()) } return c.Execute(func() error { - return c.impl.AddVersion(acc) + return c.addVersion(acc) }) } +func (c *componentAccessView) addVersion(acc ComponentVersionAccess) error { + return c.impl.AddVersion(acc) +} + func (c *componentAccessView) NewVersion(version string, overrides ...bool) (acc ComponentVersionAccess, err error) { err = c.Execute(func() error { if c.impl.IsReadOnly() { @@ -304,7 +309,7 @@ type ComponentVersionAccessImpl interface { GetBlobCache() BlobCache } -type BlobCacheEntry = accessio.BlobAccess +type BlobCacheEntry = blobaccess.BlobAccess type BlobCache interface { // AddBlobFor stores blobs for added blobs not yet accessible @@ -602,7 +607,7 @@ func (c *componentVersionAccessView) SetSourceBlob(meta *SourceMeta, blob BlobAc type fakeMethod struct { AccessMethod - blob accessio.BlobAccess + blob blobaccess.BlobAccess } func (f *fakeMethod) Reader() (io.ReadCloser, error) { diff --git a/pkg/contexts/ocm/download/handlers/blueprint/extractor.go b/pkg/contexts/ocm/download/handlers/blueprint/extractor.go index ce47066a9e..a27b9e45f2 100644 --- a/pkg/contexts/ocm/download/handlers/blueprint/extractor.go +++ b/pkg/contexts/ocm/download/handlers/blueprint/extractor.go @@ -10,6 +10,7 @@ import ( "github.com/open-component-model/ocm/pkg/common" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/common/compression" "github.com/open-component-model/ocm/pkg/contexts/oci/repositories/artifactset" @@ -24,7 +25,7 @@ const ( BLUEPRINT_MIMETYPE_COMPRESSED = "application/vnd.gardener.landscaper.blueprint.v1+tar+gzip" ) -func ExtractArchive(pr common.Printer, _ *Handler, access accessio.DataAccess, path string, fs vfs.FileSystem) (_ bool, rerr error) { +func ExtractArchive(pr common.Printer, _ *Handler, access blobaccess.DataAccess, path string, fs vfs.FileSystem) (_ bool, rerr error) { var finalize finalizer.Finalizer defer finalize.FinalizeWithErrorPropagationf(&rerr, "extracting archived (and compressed) blueprint") @@ -57,7 +58,7 @@ func ExtractArchive(pr common.Printer, _ *Handler, access accessio.DataAccess, p return true, nil } -func ExtractArtifact(pr common.Printer, handler *Handler, access accessio.DataAccess, path string, fs vfs.FileSystem) (_ bool, rerr error) { +func ExtractArtifact(pr common.Printer, handler *Handler, access blobaccess.DataAccess, path string, fs vfs.FileSystem) (_ bool, rerr error) { var finalize finalizer.Finalizer defer finalize.FinalizeWithErrorPropagationf(&rerr, "extracting oci artifact containing a blueprint") diff --git a/pkg/contexts/ocm/download/handlers/blueprint/handler.go b/pkg/contexts/ocm/download/handlers/blueprint/handler.go index 70190322f6..18cd11a51a 100644 --- a/pkg/contexts/ocm/download/handlers/blueprint/handler.go +++ b/pkg/contexts/ocm/download/handlers/blueprint/handler.go @@ -8,7 +8,7 @@ import ( "github.com/mandelsoft/vfs/pkg/vfs" "github.com/open-component-model/ocm/pkg/common" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" "github.com/open-component-model/ocm/pkg/contexts/ocm/cpi" registry "github.com/open-component-model/ocm/pkg/contexts/ocm/download" @@ -25,7 +25,7 @@ const ( CONFIG_MIME_TYPE = "application/vnd.gardener.landscaper.blueprint.config.v1" ) -type Extractor func(pr common.Printer, handler *Handler, access accessio.DataAccess, path string, fs vfs.FileSystem) (bool, error) +type Extractor func(pr common.Printer, handler *Handler, access blobaccess.DataAccess, path string, fs vfs.FileSystem) (bool, error) var ( supportedArtifactTypes []string diff --git a/pkg/contexts/ocm/download/handlers/helm/handler.go b/pkg/contexts/ocm/download/handlers/helm/handler.go index dc985bd2c4..fb56b0ed8a 100644 --- a/pkg/contexts/ocm/download/handlers/helm/handler.go +++ b/pkg/contexts/ocm/download/handlers/helm/handler.go @@ -12,6 +12,7 @@ import ( "github.com/open-component-model/ocm/pkg/common" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" "github.com/open-component-model/ocm/pkg/contexts/oci" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" @@ -107,7 +108,7 @@ func download(p common.Printer, art oci.ArtifactAccess, path string, fs vfs.File return chart, prov, err } -func write(p common.Printer, blob accessio.BlobAccess, path string, fs vfs.FileSystem) (err error) { +func write(p common.Printer, blob blobaccess.BlobAccess, path string, fs vfs.FileSystem) (err error) { var finalize finalizer.Finalizer defer finalize.FinalizeWithErrorPropagation(&err) diff --git a/pkg/contexts/ocm/interface.go b/pkg/contexts/ocm/interface.go index 1251daf6e7..98f5bb340f 100644 --- a/pkg/contexts/ocm/interface.go +++ b/pkg/contexts/ocm/interface.go @@ -8,7 +8,7 @@ import ( "context" "io" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc" metav1 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1" ocm "github.com/open-component-model/ocm/pkg/contexts/ocm/context" @@ -189,7 +189,7 @@ func SkipDigest(flag ...bool) ModificationOption { type AccessMethodView = cpi.AccessMethodView -func BlobAccessForAccessMethod(m AccessMethodView) (accessio.AnnotatedBlobAccess[AccessMethodView], error) { +func BlobAccessForAccessMethod(m AccessMethodView) (blobaccess.AnnotatedBlobAccess[AccessMethodView], error) { return cpi.BlobAccessForAccessMethod(m) } diff --git a/pkg/contexts/ocm/repositories/comparch/accessmethod_localfs.go b/pkg/contexts/ocm/repositories/comparch/accessmethod_localfs.go index 2115116631..007c2796cc 100644 --- a/pkg/contexts/ocm/repositories/comparch/accessmethod_localfs.go +++ b/pkg/contexts/ocm/repositories/comparch/accessmethod_localfs.go @@ -22,7 +22,7 @@ type localFilesystemBlobAccessMethod struct { closed bool spec *localblob.AccessSpec base support.ComponentVersionContainer - blobAccess accessio.DataAccess + blobAccess blobaccess.DataAccess } var _ cpi.AccessMethod = (*localFilesystemBlobAccessMethod)(nil) diff --git a/pkg/contexts/ocm/repositories/comparch/componentarchive.go b/pkg/contexts/ocm/repositories/comparch/componentarchive.go index 52b33157ad..5d6abba150 100644 --- a/pkg/contexts/ocm/repositories/comparch/componentarchive.go +++ b/pkg/contexts/ocm/repositories/comparch/componentarchive.go @@ -9,6 +9,7 @@ import ( "github.com/open-component-model/ocm/pkg/common" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/common/accessobj" ocicpi "github.com/open-component-model/ocm/pkg/contexts/oci/cpi" "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/localblob" @@ -155,7 +156,7 @@ type BlobSink struct { Sink ocicpi.BlobSink } -func (s *BlobSink) AddBlob(blob accessio.BlobAccess) (string, error) { +func (s *BlobSink) AddBlob(blob blobaccess.BlobAccess) (string, error) { err := s.Sink.AddBlob(blob) if err != nil { return "", err diff --git a/pkg/contexts/ocm/repositories/genericocireg/accessmethod_localblob.go b/pkg/contexts/ocm/repositories/genericocireg/accessmethod_localblob.go index 5cd638c088..63c4210ede 100644 --- a/pkg/contexts/ocm/repositories/genericocireg/accessmethod_localblob.go +++ b/pkg/contexts/ocm/repositories/genericocireg/accessmethod_localblob.go @@ -10,7 +10,6 @@ import ( "github.com/opencontainers/go-digest" - "github.com/open-component-model/ocm/pkg/common/accessio" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" @@ -21,7 +20,7 @@ import ( type localBlobAccessMethod struct { lock sync.Mutex - data accessio.DataAccess + data blobaccess.DataAccess spec *localblob.AccessSpec namespace oci.NamespaceAccess artifact oci.ArtifactAccess diff --git a/pkg/contexts/ocm/repositories/virtual/accessmethod_localblob.go b/pkg/contexts/ocm/repositories/virtual/accessmethod_localblob.go index bcbac118ad..8f10b676fb 100644 --- a/pkg/contexts/ocm/repositories/virtual/accessmethod_localblob.go +++ b/pkg/contexts/ocm/repositories/virtual/accessmethod_localblob.go @@ -8,7 +8,6 @@ import ( "io" "sync" - "github.com/open-component-model/ocm/pkg/common/accessio" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/localblob" "github.com/open-component-model/ocm/pkg/contexts/ocm/cpi" @@ -16,7 +15,7 @@ import ( type localBlobAccessMethod struct { lock sync.Mutex - data accessio.DataAccess + data blobaccess.DataAccess spec *localblob.AccessSpec access VersionAccess } diff --git a/pkg/env/builder/builder.go b/pkg/env/builder/builder.go index 1bca3bbec1..12ef167a1f 100644 --- a/pkg/env/builder/builder.go +++ b/pkg/env/builder/builder.go @@ -10,6 +10,7 @@ import ( "github.com/onsi/ginkgo/v2" "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci" "github.com/open-component-model/ocm/pkg/contexts/ocm" "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc" @@ -59,7 +60,7 @@ type state struct { ocm_acc *compdesc.AccessSpec ocm_modopts *ocm.ModificationOptions - blob *accessio.BlobAccess + blob *blobaccess.BlobAccess hint *string oci_repo oci.Repository diff --git a/pkg/env/builder/oci_config.go b/pkg/env/builder/oci_config.go index 3adee2abbb..714bb210bf 100644 --- a/pkg/env/builder/oci_config.go +++ b/pkg/env/builder/oci_config.go @@ -5,7 +5,7 @@ package builder import ( - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" "github.com/open-component-model/ocm/pkg/errors" ) @@ -14,7 +14,7 @@ const T_OCICONFIG = "oci config" type ociConfig struct { base - blob accessio.BlobAccess + blob blobaccess.BlobAccess } func (r *ociConfig) Type() string { diff --git a/pkg/env/builder/oci_layer.go b/pkg/env/builder/oci_layer.go index db2d45b7e8..7e9bc452cd 100644 --- a/pkg/env/builder/oci_layer.go +++ b/pkg/env/builder/oci_layer.go @@ -5,7 +5,7 @@ package builder import ( - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/oci/artdesc" "github.com/open-component-model/ocm/pkg/errors" ) @@ -14,7 +14,7 @@ const T_OCILAYER = "oci layer" type ociLayer struct { base - blob accessio.BlobAccess + blob blobaccess.BlobAccess } func (r *ociLayer) Type() string { diff --git a/pkg/env/builder/ocm_resource.go b/pkg/env/builder/ocm_resource.go index b073c94532..1bf84acd16 100644 --- a/pkg/env/builder/ocm_resource.go +++ b/pkg/env/builder/ocm_resource.go @@ -5,7 +5,7 @@ package builder import ( - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/ocm" "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc" metav1 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1" @@ -18,7 +18,7 @@ type ocmResource struct { orig ocm.AccessSpec meta compdesc.ResourceMeta access compdesc.AccessSpec - blob accessio.BlobAccess + blob blobaccess.BlobAccess opts ocm.ModificationOptions hint string } diff --git a/pkg/env/builder/ocm_source.go b/pkg/env/builder/ocm_source.go index 4e15aec3c8..e949d96aeb 100644 --- a/pkg/env/builder/ocm_source.go +++ b/pkg/env/builder/ocm_source.go @@ -5,7 +5,7 @@ package builder import ( - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc" "github.com/open-component-model/ocm/pkg/errors" ) @@ -15,7 +15,7 @@ type ocmSource struct { meta compdesc.SourceMeta access compdesc.AccessSpec - blob accessio.BlobAccess + blob blobaccess.BlobAccess } const T_OCMSOURCE = "source" diff --git a/pkg/helm/loader/access.go b/pkg/helm/loader/access.go index 73920e26ea..c5f2939183 100644 --- a/pkg/helm/loader/access.go +++ b/pkg/helm/loader/access.go @@ -8,7 +8,7 @@ import ( "helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart/loader" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/helm" ) @@ -24,11 +24,11 @@ func (l *accessLoader) Close() error { return l.access.Close() } -func (l *accessLoader) ChartArchive() (accessio.BlobAccess, error) { +func (l *accessLoader) ChartArchive() (blobaccess.BlobAccess, error) { return l.access.Chart() } -func (l *accessLoader) ChartArtefactSet() (accessio.BlobAccess, error) { +func (l *accessLoader) ChartArtefactSet() (blobaccess.BlobAccess, error) { return l.access.ArtefactSet() } diff --git a/pkg/helm/loader/loader.go b/pkg/helm/loader/loader.go index 729a99e6e7..6da25f6d82 100644 --- a/pkg/helm/loader/loader.go +++ b/pkg/helm/loader/loader.go @@ -9,23 +9,23 @@ import ( "helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart/loader" - "github.com/open-component-model/ocm/pkg/common/accessio" "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" + "github.com/open-component-model/ocm/pkg/common/iotools" "github.com/open-component-model/ocm/pkg/errors" "github.com/open-component-model/ocm/pkg/helm" "github.com/open-component-model/ocm/pkg/utils" ) type Loader interface { - ChartArchive() (accessio.BlobAccess, error) - ChartArtefactSet() (accessio.BlobAccess, error) + ChartArchive() (blobaccess.BlobAccess, error) + ChartArtefactSet() (blobaccess.BlobAccess, error) Chart() (*chart.Chart, error) Provenance() ([]byte, error) Close() error } -type nopCloser = accessio.NopCloser +type nopCloser = iotools.NopCloser type vfsLoader struct { nopCloser @@ -47,7 +47,7 @@ func (l *vfsLoader) ChartArchive() (blobaccess.BlobAccess, error) { return blobaccess.ForFile(helm.ChartMediaType, l.path, l.fs), nil } -func (l *vfsLoader) ChartArtefactSet() (accessio.BlobAccess, error) { +func (l *vfsLoader) ChartArtefactSet() (blobaccess.BlobAccess, error) { return nil, nil } diff --git a/pkg/toi/drivers/docker/driver.go b/pkg/toi/drivers/docker/driver.go index 712aabc587..3dad635baa 100644 --- a/pkg/toi/drivers/docker/driver.go +++ b/pkg/toi/drivers/docker/driver.go @@ -25,7 +25,7 @@ import ( "github.com/docker/docker/registry" "github.com/mitchellh/copystructure" - "github.com/open-component-model/ocm/pkg/common/accessio" + "github.com/open-component-model/ocm/pkg/common/accessio/blobaccess" "github.com/open-component-model/ocm/pkg/errors" "github.com/open-component-model/ocm/pkg/generics" "github.com/open-component-model/ocm/pkg/toi" @@ -444,7 +444,7 @@ func (d *Driver) fetchOutputs(ctx context.Context, container string, op *install // generateTar creates a tarfile containing the specified files, with the owner // set to the uid that the container runs as so that it is guaranteed to have // read access to the files we copy into the container. -func generateTar(files map[string]accessio.BlobAccess, uid int) (io.ReadCloser, func() error, error) { +func generateTar(files map[string]blobaccess.BlobAccess, uid int) (io.ReadCloser, func() error, error) { r, w := io.Pipe() tw := tar.NewWriter(w) for path := range files {