blobaccess

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package blobaccess provides various flavors of BlobAccess implementations. It is used to access blobs in a uniform way. Additionally, it provides the basic types provided by the sub package with the same name. This package just provides the basic types for BlobAccess implementations. It is provided for generic BlobAccess users not referring to dedicated implementation. This separation is required to avoid cycles for blobaccess users which are also used again to implement some of the BlobAccess variants. Alternatively, the sub package and the various implementation packages can be used in combination.

Index

Constants

View Source
const (
	KIND_BLOB      = internal.KIND_BLOB
	KIND_MEDIATYPE = internal.KIND_MEDIATYPE

	BLOB_UNKNOWN_SIZE   = internal.BLOB_UNKNOWN_SIZE
	BLOB_UNKNOWN_DIGEST = internal.BLOB_UNKNOWN_DIGEST
)
View Source
const KIND_DATASOURCE = blobaccess.KIND_DATASOURCE

Variables

This section is empty.

Functions

func BlobData

func BlobData(blob DataGetter, err ...error) ([]byte, error)

func BlobReader

func BlobReader(blob DataReader, err ...error) (io.ReadCloser, error)

func Digest

func Digest(access DataAccess) (digest.Digest, error)

func GetData added in v0.7.0

func GetData(src GenericData) ([]byte, error)

GetData provides data as byte sequence from some generic data sources like byte arrays, strings, DataReader and DataGetters. This means we can pass all BlobAccess or DataAccess objects. If no an unknown data source is passes an ErrInvalid(KIND_DATASOURCE) is returned.

func GetGenericData added in v0.7.0

func GetGenericData(src GenericData) (interface{}, error)

GetGenericData evaluates some input provided by well-known types or interfaces and provides some data output by mapping the input to either a byte sequence or some specialized object. If the input type is not known an ErrInvalid(KIND_DATASOURCE) // is returned. In extension to GetData, it additionally evaluates the interface GenericDataGetter to map the input to some evaluated object.

Types

type AnnotatedBlobAccess

type AnnotatedBlobAccess[T bpi.DataAccess] interface {
	Source() T
	// contains filtered or unexported methods
}

AnnotatedBlobAccess provides access to the original underlying data source.

func ForDataAccess

func ForDataAccess[T bpi.DataAccess](digest digest.Digest, size int64, mimeType string, access T) AnnotatedBlobAccess[T]

type BlobAccess

type BlobAccess = internal.BlobAccess

func ForData

func ForData(mime string, data []byte) BlobAccess

ForData wraps data into a BlobAccess, which does not need a close.

func ForDirTree added in v0.12.0

func ForDirTree(path string, opts ...dirtree.Option) (BlobAccess, error)

func ForFile

func ForFile(mime string, path string, fss ...vfs.FileSystem) BlobAccess

func ForFileWithCloser

func ForFileWithCloser(closer io.Closer, mime string, path string, fss ...vfs.FileSystem) BlobAccess

func ForHelmChart added in v0.12.0

func ForHelmChart(path string, opts ...helm.Option) (blob BlobAccess, name, version string, err error)

func ForImageFromDockerDaemon added in v0.12.0

func ForImageFromDockerDaemon(name string, opts ...dockerdaemon.Option) (BlobAccess, string, error)

func ForMaven added in v0.12.0

func ForMaven(repo *maven.Repository, groupId, artifactId, version string, opts ...maven.Option) (BlobAccess, error)

func ForMavenCoords added in v0.12.0

func ForMavenCoords(repo *maven.Repository, coords *maven.Coordinates, opts ...maven.Option) (BlobAccess, error)

func ForMultiImageFromDockerDaemon added in v0.12.0

func ForMultiImageFromDockerDaemon(opts ...dockermulti.Option) (BlobAccess, error)

func ForOCIArtifact added in v0.12.0

func ForOCIArtifact(refname string, opts ...ociartifact.Option) (BlobAccess, string, error)

func ForString

func ForString(mime string, data string) BlobAccess

ForString wraps a string into a BlobAccess, which does not need a close.

func ForTemporaryFile

func ForTemporaryFile(mime string, temp vfs.File, opts ...file.Option) BlobAccess

func ForTemporaryFilePath

func ForTemporaryFilePath(mime string, temp string, opts ...file.Option) BlobAccess

func ForWget added in v0.12.0

func ForWget(url string, opts ...wget.Option) (_ BlobAccess, rerr error)

func WithCompression

func WithCompression(blob BlobAccess) (BlobAccess, error)

func WithDecompression

func WithDecompression(blob BlobAccess) (BlobAccess, error)

type BlobAccessProvider

type BlobAccessProvider = internal.BlobAccessProvider

func ProviderForBlobAccess

func ProviderForBlobAccess(blob bpi.BlobAccess) BlobAccessProvider

func ProviderForData

func ProviderForData(mime string, data []byte) BlobAccessProvider

func ProviderForDirTree added in v0.12.0

func ProviderForDirTree(path string, opts ...dirtree.Option) BlobAccessProvider

func ProviderForFile

func ProviderForFile(mime string, path string, fss ...vfs.FileSystem) BlobAccessProvider

func ProviderForHelmChart added in v0.12.0

func ProviderForHelmChart(path string, opts ...helm.Option) BlobAccessProvider

func ProviderForImageFromDockerDaemon added in v0.12.0

func ProviderForImageFromDockerDaemon(name string, opts ...dockerdaemon.Option) BlobAccessProvider

func ProviderForMaven added in v0.12.0

func ProviderForMaven(repo *maven.Repository, groupId, artifactId, version string, opts ...maven.Option) BlobAccessProvider

func ProviderForMultiImageFromDockerDaemon added in v0.12.0

func ProviderForMultiImageFromDockerDaemon(opts ...dockermulti.Option) BlobAccessProvider

func ProviderForOCIArtifact added in v0.12.0

func ProviderForOCIArtifact(name string, opts ...ociartifact.Option) BlobAccessProvider

func ProviderForString

func ProviderForString(mime, data string) BlobAccessProvider

func ProviderForWget added in v0.12.0

func ProviderForWget(url string, opts ...wget.Option) BlobAccessProvider

type DataAccess

type DataAccess = internal.DataAccess

func DataAccessForDirTree added in v0.12.0

func DataAccessForDirTree(path string, opts ...dirtree.Option) (DataAccess, error)

func DataAccessForFile

func DataAccessForFile(fs vfs.FileSystem, path string) DataAccess

func DataAccessForMaven added in v0.12.0

func DataAccessForMaven(repo *maven.Repository, groupId, artifactId, version string, opts ...maven.Option) (DataAccess, error)

func DataAccessForReaderFunction

func DataAccessForReaderFunction(reader func() (io.ReadCloser, error), origin string) DataAccess

func DataAccessForWget added in v0.12.0

func DataAccessForWget(url string, opts ...wget.Option) (DataAccess, error)

type DataGetter

type DataGetter = internal.DataGetter

type DataReader

type DataReader = internal.DataReader

type DataSource

type DataSource = internal.DataSource

func DataAccessForBytes

func DataAccessForBytes(data []byte, origin ...string) DataSource

DataAccessForBytes wraps a bytes slice into a DataAccess. Deprecated: used DataAccessForData.

func DataAccessForData added in v0.12.0

func DataAccessForData(data []byte, origin ...string) DataSource

DataAccessForData wraps a bytes slice into a DataAccess.

func DataAccessForString

func DataAccessForString(data string, origin ...string) DataSource

type DigestSource

type DigestSource = internal.DigestSource

type FileLocation

type FileLocation = internal.FileLocation

type GenericData added in v0.7.0

type GenericData = blobaccess.GenericData

type GenericDataGetter added in v0.7.0

type GenericDataGetter = blobaccess.GenericDataGetter

type MimeType

type MimeType = internal.MimeType

type TempFile

type TempFile = file.TempFile

TempFile holds a temporary file that should be kept open. Close should never be called directly. It can be passed to another responsibility realm by calling Release For example to be transformed into a TemporaryBlobAccess. Close will close and remove an unreleased file and does nothing if it has been released. If it has been releases the new realm is responsible. to close and remove it.

func NewTempFile

func NewTempFile(dir string, pattern string, fss ...vfs.FileSystem) (*TempFile, error)

Directories

Path Synopsis
Package blobaccess provides the basic set of types and supporting functions for using BlobAccess implementations.
Package blobaccess provides the basic set of types and supporting functions for using BlobAccess implementations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL