internal

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChunkTypeData  = ""
	ChunkTypeZeros = "zeros"
)
View Source
const (
	TypeReg     = "reg"
	TypeChunk   = "chunk"
	TypeLink    = "hardlink"
	TypeChar    = "char"
	TypeBlock   = "block"
	TypeDir     = "dir"
	TypeFifo    = "fifo"
	TypeSymlink = "symlink"
)
View Source
const (
	ManifestChecksumKey = "io.github.containers.zstd-chunked.manifest-checksum"
	ManifestInfoKey     = "io.github.containers.zstd-chunked.manifest-position"
	TarSplitChecksumKey = "io.github.containers.zstd-chunked.tarsplit-checksum"
	TarSplitInfoKey     = "io.github.containers.zstd-chunked.tarsplit-position"

	// ManifestTypeCRFS is a manifest file compatible with the CRFS TOC file.
	ManifestTypeCRFS = 1

	// FooterSizeSupported is the footer size supported by this implementation.
	// Newer versions of the image format might increase this value, so reject
	// any version that is not supported.
	FooterSizeSupported = 64
)

Variables

View Source
var (
	ZstdChunkedFrameMagic = []byte{0x47, 0x4e, 0x55, 0x6c, 0x49, 0x6e, 0x55, 0x78}
)

Functions

func GetType

func GetType(t byte) (string, error)

func WriteZstdChunkedManifest

func WriteZstdChunkedManifest(dest io.Writer, outMetadata map[string]string, offset uint64, tarSplitData *TarSplitData, metadata []FileMetadata, level int) error

func ZstdWriterWithLevel

func ZstdWriterWithLevel(dest io.Writer, level int) (*zstd.Encoder, error)

Types

type FileMetadata

type FileMetadata struct {
	Type       string            `json:"type"`
	Name       string            `json:"name"`
	Linkname   string            `json:"linkName,omitempty"`
	Mode       int64             `json:"mode,omitempty"`
	Size       int64             `json:"size,omitempty"`
	UID        int               `json:"uid,omitempty"`
	GID        int               `json:"gid,omitempty"`
	ModTime    *time.Time        `json:"modtime,omitempty"`
	AccessTime *time.Time        `json:"accesstime,omitempty"`
	ChangeTime *time.Time        `json:"changetime,omitempty"`
	Devmajor   int64             `json:"devMajor,omitempty"`
	Devminor   int64             `json:"devMinor,omitempty"`
	Xattrs     map[string]string `json:"xattrs,omitempty"`
	Digest     string            `json:"digest,omitempty"`
	Offset     int64             `json:"offset,omitempty"`
	EndOffset  int64             `json:"endOffset,omitempty"`

	ChunkSize   int64  `json:"chunkSize,omitempty"`
	ChunkOffset int64  `json:"chunkOffset,omitempty"`
	ChunkDigest string `json:"chunkDigest,omitempty"`
	ChunkType   string `json:"chunkType,omitempty"`

	// internal: computed by mergeTOCEntries.
	Chunks []*FileMetadata `json:"-"`
}

type TOC

type TOC struct {
	Version int            `json:"version"`
	Entries []FileMetadata `json:"entries"`

	// internal: used by unmarshalToc
	StringsBuf bytes.Buffer `json:"-"`
}

type TarSplitData added in v1.47.0

type TarSplitData struct {
	Data             []byte
	Digest           digest.Digest
	UncompressedSize int64
}

type ZstdChunkedFooterData added in v1.50.0

type ZstdChunkedFooterData struct {
	ManifestType uint64

	Offset             uint64
	LengthCompressed   uint64
	LengthUncompressed uint64
	ChecksumAnnotation string // Only used when reading a layer, not when creating it

	OffsetTarSplit             uint64
	LengthCompressedTarSplit   uint64
	LengthUncompressedTarSplit uint64
	ChecksumAnnotationTarSplit string // Only used when reading a layer, not when creating it
}

ZstdChunkedFooterData contains all the data stored in the zstd:chunked footer.

func ReadFooterDataFromAnnotations added in v1.50.0

func ReadFooterDataFromAnnotations(annotations map[string]string) (ZstdChunkedFooterData, error)

ReadFooterDataFromAnnotations reads the zstd:chunked footer data from the given annotations.

func ReadFooterDataFromBlob added in v1.50.0

func ReadFooterDataFromBlob(footer []byte) (ZstdChunkedFooterData, error)

ReadFooterDataFromBlob reads the zstd:chunked footer from the binary buffer.

Jump to

Keyboard shortcuts

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