compression

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

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

func IsMediaType(ct Type, mt string) bool

Types

type Compressor

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

type Config

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

func New

func New(t Type) Config

func ParseAttributes

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

func (Config) SetForce

func (c Config) SetForce(v bool) Config

func (Config) SetLevel

func (c Config) SetLevel(l int) Config

type Decompressor

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

type Finalizer

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

func FromMediaType(mediaType string) (Type, error)

func Parse

func Parse(t string) (Type, error)

Jump to

Keyboard shortcuts

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