pack

package
v1.0.0-beta.26 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package pack is the format of a remote-cache pack: one stored object that holds several small layer blobs, so that they upload, download and are addressed as one. A pack is a header listing its members, then the members' bytes in that order, unchanged. Its ID is the digest of its header, so the service names a pack from its member list alone, and an engine verifies the header against the ID and each member against its own digest, as it verifies any blob.

Index

Constants

View Source
const (

	// MaxMembers, MaxHeaderBytes and MaxBytes bound a pack an engine reads:
	// its members, its header and its whole object.
	MaxMembers     = 4096
	MaxHeaderBytes = 512 << 10
	MaxBytes       = 64 << 20
)

Variables

This section is empty.

Functions

func Header(members []Member) ([]byte, error)

Header returns the header of a pack of members:

dagger-pack v1
<n>
sha256:<hex> <size>   (one line per member, in order)

It fails on no members, a digest that is not a valid sha256, a negative size, a member listed twice, or a pack over the limits.

func ID

func ID(members []Member) (digest.Digest, error)

ID returns the ID of a pack of members: the sha256 digest of its header.

func Size

func Size(members []Member) (int64, error)

Size returns the length of a pack of members: its header and every member.

Types

type Member

type Member struct {
	Digest digest.Digest `json:"digest"`
	Size   int64         `json:"size"`
}

Member is one blob of a pack, in pack order.

func ReadHeader

func ReadHeader(r *bufio.Reader, id digest.Digest) ([]Member, error)

ReadHeader reads a pack's header from r, leaving r at the first member's bytes, and checks it against the pack's ID: the bytes read must be the header Header writes for the members they list, and hash to the ID. It returns the members.

Jump to

Keyboard shortcuts

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