compression

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 62

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Uncompressed indicates no compression.
	Uncompressed = uncompressedType{}

	// Gzip is used for blob data.
	Gzip = gzipType{}

	// EStargz is used for estargz data.
	EStargz = estargzType{}

	// Zstd is used for Zstandard data.
	Zstd = zstdType{}
)
View Source
var Default = Gzip

Functions

func ConvertAllLayerMediaTypes

func ConvertAllLayerMediaTypes(ctx context.Context, oci bool, descs ...ocispecs.Descriptor) []ocispecs.Descriptor

func DetectLayerMediaType

func DetectLayerMediaType(ctx context.Context, cs content.Store, id digest.Digest, oci bool) (string, error)

DetectLayerMediaType returns media type from existing blob data.

func IsMediaType added in v0.11.0

func IsMediaType(ct Type, mt string) bool

Types

type Compressor added in v0.11.0

type Compressor func(dest io.Writer, mediaType string) (io.WriteCloser, error)

type Config added in v0.10.0

type Config struct {
	Type  Type
	Force bool
	Level *int
}

func New added in v0.10.0

func New(t Type) Config

func ParseAttributes added in v0.12.0

func ParseAttributes(attrs map[string]string) (Config, error)

func (Config) SetForce added in v0.10.0

func (c Config) SetForce(v bool) Config

func (Config) SetLevel added in v0.10.0

func (c Config) SetLevel(l int) Config

type Decompressor added in v0.11.0

type Decompressor func(ctx context.Context, cs content.Store, desc ocispecs.Descriptor) (io.ReadCloser, error)

type Finalizer added in v0.11.0

type Finalizer func(context.Context, content.Store) (map[string]string, error)

type Type

type Type interface {
	Compress(ctx context.Context, comp Config) (compressorFunc Compressor, finalize Finalizer)
	Decompress(ctx context.Context, cs content.Store, desc ocispecs.Descriptor) (io.ReadCloser, error)
	NeedsConversion(ctx context.Context, cs content.Store, desc ocispecs.Descriptor) (bool, error)
	NeedsComputeDiffBySelf(comp Config) bool
	OnlySupportOCITypes() bool
	MediaType() string
	String() string
}

Type represents compression type for blob data, which needs to be implemented for each compression type.

func FromMediaType added in v0.10.0

func FromMediaType(mediaType string) (Type, error)

func Parse added in v0.10.0

func Parse(t string) (Type, error)

Jump to

Keyboard shortcuts

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