pack

package
v0.9.1-18-g8f81359d Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextKey

type ContextKey string

type Package

type Package interface {
	unikraft.Nameable

	// ID returns a unique identifier for the package.
	ID() string

	// Metadata returns any additional metadata associated with this package.
	Metadata() interface{}

	// Size in bytes of the package.
	Size() int64

	// Columns is a subset of Metadata that is displayed to the user and can be
	// also collated or parsed to made easier-to-read.
	Columns() []tableprinter.Column

	// Push the package to a remotely retrievable destination.
	Push(context.Context, ...PushOption) error

	// Pull retreives the package from a remotely retrievable location.
	Pull(context.Context, ...PullOption) error

	// Unpack the package into the specified directory.
	Unpack(context.Context, string) error

	// Save the state of package.
	Save(context.Context) error

	// Deletes package available locally.
	Delete(context.Context) error

	// PulledAt is an attribute of a package to indicate when (and if) it was
	// last retrieved.
	PulledAt(context.Context) (bool, time.Time, error)

	// Format returns the name of the implementation.
	Format() PackageFormat
}

type PackageFormat added in v0.5.0

type PackageFormat string

func (PackageFormat) String added in v0.5.0

func (pf PackageFormat) String() string

type PullOption added in v0.4.0

type PullOption func(opts *PullOptions) error

PullOption is an option function which is used to modify PullOptions.

func WithPullAuthConfig added in v0.6.0

func WithPullAuthConfig(auth map[string]config.AuthConfig) PullOption

WithPullAuthConfig sets the authentication config to use when pulling the package.

func WithPullCache

func WithPullCache(cache bool) PullOption

WithPullCache to set whether use cache if possible.

func WithPullChecksum

func WithPullChecksum(calc bool) PullOption

WithPullChecksum to set whether to calculate and compare the checksum of the package.

func WithPullProgressFunc

func WithPullProgressFunc(onProgress func(progress float64)) PullOption

WithPullProgressFunc set an optional progress function which is used as a callback during the transmission of the package and the host.

func WithPullWorkdir

func WithPullWorkdir(workdir string) PullOption

WithPullWorkdir set the working directory context of the pull such that the resources of the package are placed there appropriately.

type PullOptions added in v0.4.0

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

PullOptions contains the list of options which can be set for pulling a package.

func NewPullOptions added in v0.4.0

func NewPullOptions(opts ...PullOption) (*PullOptions, error)

NewPullOptions creates PullOptions

func (*PullOptions) Auths added in v0.6.0

func (ppo *PullOptions) Auths(domain string) *config.AuthConfig

Auths returns the set authentication config for a given domain or nil if the domain was not found.

func (*PullOptions) CalculateChecksum added in v0.4.0

func (ppo *PullOptions) CalculateChecksum() bool

CalculateChecksum returns whether the pull request should perform a check of the resource sum.

func (*PullOptions) OnProgress added in v0.4.0

func (ppo *PullOptions) OnProgress(progress float64)

OnProgress calls (if set) an embedded progress function which can be used to update an external progress bar, for example.

func (*PullOptions) UseCache added in v0.4.0

func (ppo *PullOptions) UseCache() bool

UseCache returns whether the pull should redirect to using a local cache if available.

func (*PullOptions) Workdir added in v0.4.0

func (ppo *PullOptions) Workdir() string

Workdir returns the set working directory as part of the pull request

type PushOption added in v0.4.0

type PushOption func(*PushOptions) error

PushOption is an option function which is used to modify PushOptions.

func WithPushProgressFunc added in v0.6.0

func WithPushProgressFunc(onProgress func(progress float64)) PushOption

WithPushProgressFunc set an optional progress function which is used as a callback during the transmission of the package and the host.

type PushOptions added in v0.4.0

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

PushOptions contains the list of options which can be set whilst pushing a package.

func NewPushOptions added in v0.6.0

func NewPushOptions(opts ...PushOption) (*PushOptions, error)

NewPushOptions creates PushOptions

Jump to

Keyboard shortcuts

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