package stream

import "github.com/google/go-containerregistry/pkg/v1/stream"

Package stream implements a single-pass streaming v1.Layer.

Index

Variables

var (
	// ErrNotComputed is returned when the requested value is not yet
	// computed because the stream has not been consumed yet.
	ErrNotComputed = errors.New("value not computed until stream is consumed")

	// ErrConsumed is returned by Compressed when the underlying stream has
	// already been consumed and closed.
	ErrConsumed = errors.New("stream was already consumed")
)

Types

type Layer

type Layer struct {
	// contains filtered or unexported fields
}

Layer is a streaming implementation of v1.Layer.

func NewLayer

func NewLayer(rc io.ReadCloser, opts ...LayerOption) *Layer

NewLayer creates a Layer from an io.ReadCloser.

func (*Layer) Compressed

func (l *Layer) Compressed() (io.ReadCloser, error)

Compressed implements v1.Layer.

func (*Layer) DiffID

func (l *Layer) DiffID() (v1.Hash, error)

DiffID implements v1.Layer.

func (*Layer) Digest

func (l *Layer) Digest() (v1.Hash, error)

Digest implements v1.Layer.

func (*Layer) MediaType

func (l *Layer) MediaType() (types.MediaType, error)

MediaType implements v1.Layer

func (*Layer) Size

func (l *Layer) Size() (int64, error)

Size implements v1.Layer.

func (*Layer) Uncompressed

func (l *Layer) Uncompressed() (io.ReadCloser, error)

Uncompressed implements v1.Layer.

type LayerOption

type LayerOption func(*Layer)

LayerOption applies options to layer

func WithCompressionLevel

func WithCompressionLevel(level int) LayerOption

WithCompressionLevel sets the gzip compression. See `gzip.NewWriterLevel` for possible values.

func WithMediaType

func WithMediaType(mt types.MediaType) LayerOption

WithMediaType is a functional option for overriding the layer's media type.

Source Files

layer.go

Version
v0.20.3 (latest)
Published
Jan 15, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
16 hours ago

Tools for package owners.