archive

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexFileName = "index.json"
	SharedBlobDir = "share"
)
View Source
const (
	IndexVersion = "v1.2.0"
)

Variables

This section is empty.

Functions

func CompareIndexVersion

func CompareIndexVersion(index *Index) error

CompareIndexVersion compares the loaded index version with current version.

Types

type Image

type Image struct {
	Source   string      `json:"source,omitempty" yaml:"source,omitempty"`
	Tag      string      `json:"tag,omitempty" yaml:"tag,omitempty"`
	ArchList []string    `json:"archList,omitempty" yaml:"archList,omitempty"`
	OsList   []string    `json:"osList,omitempty" yaml:"osList,omitempty"`
	Images   []ImageSpec `json:"images,omitempty" yaml:"images,omitempty"`
}

func (*Image) IsSigstoreSignature added in v1.8.0

func (img *Image) IsSigstoreSignature() bool

IsSigstoreSignature detects whether the image is a sigstore signature.

type ImageSpec

type ImageSpec struct {
	Arch       string          `json:"arch,omitempty" yaml:"arch,omitempty"`
	OS         string          `json:"os,omitempty" yaml:"os,omitempty"`
	OSVersion  string          `json:"osVersion,omitempty" yaml:"osVersion,omitempty"`
	OSFeatures []string        `json:"osFeatures,omitempty" yaml:"osFeatures,omitempty"`
	Variant    string          `json:"variant,omitempty" yaml:"variant,omitempty"`
	MediaType  string          `json:"mediaType,omitempty" yaml:"mime,omitempty"`
	Layers     []digest.Digest `json:"layers,omitempty" yaml:"layers,omitempty"`
	Config     digest.Digest   `json:"config,omitempty" yaml:"config,omitempty"`
	Digest     digest.Digest   `json:"digest,omitempty" yaml:"digest,omitempty"`
}

type Index

type Index struct {
	List    []*Image  `json:"list,omitempty" yaml:"list,omitempty"`
	Version string    `json:"version,omitempty" yaml:"version.omitempty"`
	Time    time.Time `json:"time,omitempty" yaml:"omitempty"`
	// contains filtered or unexported fields
}

Index defines the data structure stores in the end of hangar archive.

func NewIndex

func NewIndex() *Index

func UnmarshalIndex

func UnmarshalIndex(b []byte) (*Index, error)

func (*Index) Append

func (i *Index) Append(n *Image)

func (*Index) Has

func (i *Index) Has(n *Image) bool

func (*Index) HasReference

func (i *Index) HasReference(project, name, tag string) bool

func (*Index) Unmarshal

func (i *Index) Unmarshal(b []byte) error

type Reader

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

func NewReader

func NewReader(name string) (*Reader, error)

NewReader constructs a new Archive Reader object. Needs to call Close() method to release resource after usage.

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Decompress

func (r *Reader) Decompress(name string, destination string) error

Decompress decompresses the file/directory in archive.

func (*Reader) DecompressImageTmp

func (r *Reader) DecompressImageTmp(
	img *ImageSpec,
	set types.FilterSet,
) (string, error)

func (*Reader) DecompressTmp

func (r *Reader) DecompressTmp(name string) (string, error)

func (*Reader) Index

func (r *Reader) Index() ([]byte, error)

func (*Reader) Ls

func (r *Reader) Ls()

type Updater

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

Updater is the updater for update hangar zip archive.

func NewUpdater

func NewUpdater(name string) (*Updater, error)

NewUpdater constructs a new Updater object.

func (*Updater) Append

func (u *Updater) Append(name string) error

Append will overwrite from the existing index.json file in zip archive.

func (*Updater) Close

func (u *Updater) Close() error

func (*Updater) Index

func (u *Updater) Index() *Index

func (*Updater) SetIndex

func (u *Updater) SetIndex(i *Index)

func (*Updater) UpdateIndex

func (u *Updater) UpdateIndex() error

type Writer

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

Writer creates a new Hangar archive (zip) file and write files into it.

func NewWriter

func NewWriter(name string) (*Writer, error)

NewWriter constructs a new Writer object.

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) CopyImage added in v1.7.1

func (w *Writer) CopyImage(image *Image, ar *Reader) error

CopyImage copy image blobs data from archive reader to writer.

func (*Writer) Write

func (w *Writer) Write(name string) error

Write writes a single file or a directory (recursive) to archive file.

func (*Writer) WriteIndex

func (w *Writer) WriteIndex(index *Index) error

WriteIndex writes the index json file into the end of the zip archive.

Jump to

Keyboard shortcuts

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