diff --git a/pkg/blobaccess/blobaccess/other.go b/pkg/blobaccess/blobaccess/other.go index 32e09b5661..d751891c91 100644 --- a/pkg/blobaccess/blobaccess/other.go +++ b/pkg/blobaccess/blobaccess/other.go @@ -81,6 +81,9 @@ func (a *annotatedBlobAccessView[T]) Source() T { // It closes the wrapped access, if closed. // If the wrapped data access does not need a close, the BlobAccess // does not need a close, also. +// It adds the additional blob access metadata (mime, digest, and size). +// Digest and size can be set to unknown using the constants (BLOB_UNKNOWN_DIGEST +// and BLOB_UNKNOWN_SIZE). func ForDataAccess[T bpi.DataAccess](digest digest.Digest, size int64, mimeType string, access T) AnnotatedBlobAccess[T] { a := bpi.BaseAccessForDataAccessAndMeta(mimeType, access, digest, size) diff --git a/pkg/blobaccess/bpi/utils.go b/pkg/blobaccess/bpi/utils.go index 8a3f0c1a40..50be302ead 100644 --- a/pkg/blobaccess/bpi/utils.go +++ b/pkg/blobaccess/bpi/utils.go @@ -167,6 +167,10 @@ func BaseAccessForDataAccess(mime string, acc DataAccess) BlobAccessBase { } } +// BaseAccessForDataAccessAndMeta provides a BlobAccessBase for a DataAccess +// adding the additional blob access metadata (mime, digest, and size). +// Digest and size can be set to unknown using the constants (BLOB_UNKNOWN_DIGEST +// and BLOB_UNKNOWN_SIZE). func BaseAccessForDataAccessAndMeta(mime string, acc DataAccess, dig digest.Digest, size int64) BlobAccessBase { return &closableBlobAccess{ blobAccess: blobAccess{mimeType: mime, _dataAccess: acc, digest: dig, size: size}, @@ -209,6 +213,10 @@ func ForStaticDataAccess(mime string, acc DataAccess) StaticBlobAccess { } } +// ForStaticDataAccessAndMeta provides a StaticBlobAccess for a DataAccess +// adding the additional blob access metadata (mime, digest, and size). +// Digest and size can be set to unknown using the constants (BLOB_UNKNOWN_DIGEST +// and BLOB_UNKNOWN_SIZE). func ForStaticDataAccessAndMeta(mime string, acc DataAccess, dig digest.Digest, size int64) StaticBlobAccess { return &staticBlobAccess{ blobAccess: blobAccess{mimeType: mime, _dataAccess: acc, digest: dig, size: size}, diff --git a/pkg/blobaccess/file/access.go b/pkg/blobaccess/file/access.go index 1a8f80f546..7a198da28b 100644 --- a/pkg/blobaccess/file/access.go +++ b/pkg/blobaccess/file/access.go @@ -187,6 +187,9 @@ var ( _ bpi.FileLocation = (*temporaryFileBlob)(nil) ) +// Validate checks if the access is valid, meaning +// it can provide data. Here, this means +// that the file exists. func (b *temporaryFileBlob) Validate() error { b.lock.Lock() defer b.lock.Unlock()