pack

package
v0.2.2-2-g52bb9ff Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: BSD-3-Clause Imports: 7 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 expect 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 {
	// Options allows you to view the current options.
	Options() *PackageOptions

	// ApplyOptions allows one to update the options of a package
	ApplyOptions(opts ...PackageOption) error

	// Determine if the provided path is a compatible media type
	Compatible(string) bool

	// Name is the simple package name
	Name() string

	// CanonicalName represents the full name which can be understood by the
	// respective package manager.
	CanonicalName() string

	// Package a package
	Pack(context.Context) error

	// Pull retreives the package artifacts given the context of the
	// PackageOptions and allows for customization of the pull via the input
	// optional PullPackageOptions
	Pull(context.Context, ...PullPackageOption) error

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

type PackageOption

type PackageOption func(opts *PackageOptions) error

func WithArchitecture

func WithArchitecture(arch string) PackageOption

func WithInitrdConfig

func WithInitrdConfig(initrd *initrd.InitrdConfig) PackageOption

WithInitrdConfig sets the metadata attribute with the interface representing initrd configuration

func WithKernel

func WithKernel(kernel string) PackageOption

WithKerenl sets the metadata attribute path to the kernel image

func WithLocalLocation

func WithLocalLocation(location string, force bool) PackageOption

WithLocalLocation sets the location of the package to be stored locally.

func WithMetadata

func WithMetadata(metadata map[string]interface{}) PackageOption

func WithName

func WithName(name string) PackageOption

func WithPlatform

func WithPlatform(plat string) PackageOption

func WithRemoteLocation

func WithRemoteLocation(location string) PackageOption

WithRemoteLocation sets the location of the package at its remote registry

func WithVersion

func WithVersion(version string) PackageOption

func WithWorkdir

func WithWorkdir(dir string) PackageOption

type PackageOptions

type PackageOptions struct {
	// Name of the package
	Name string

	// Type of package
	Type unikraft.ComponentType

	// Version of the package
	Version string

	// Architecture of the package if applicable
	Architecture *string

	// Platform of the package if applicable
	Platform *string

	// Kernel is the path on disk to the kernel
	Kernel string

	// Initrd contains the configuration for the initramfs file
	Initrd *initrd.InitrdConfig

	// Metadata represents other items that did not have appropriate annotations
	Metadata map[string]interface{}

	// RemoteLocation contains the remote location of the package.
	RemoteLocation string

	// LocalLocation contains the path to save or store the package on the host.
	LocalLocation string

	// Sha256
	Sha256 string
	// contains filtered or unexported fields
}

PackageOptions contains configuration for the Package

func NewPackageOptions

func NewPackageOptions(opts ...PackageOption) (*PackageOptions, error)

NewPackageOptions creates PackageOptions

func (*PackageOptions) ArchPlatString

func (opts *PackageOptions) ArchPlatString() string

ArchPlatString returns the string representation of the architecture and platform combination for this package

func (*PackageOptions) NameVersion

func (opts *PackageOptions) NameVersion() string

NameVersion returns the string representation of name and version of this package

func (*PackageOptions) TypeNameVersion

func (opts *PackageOptions) TypeNameVersion() string

TypeNameVersion returns the string representation of the type, name and version of this package

func (*PackageOptions) Workdir

func (opts *PackageOptions) Workdir() string

type PullPackageOption

type PullPackageOption func(opts *PullPackageOptions) error

func WithPullArchitecture

func WithPullArchitecture(archs ...string) PullPackageOption

WithPullArchitecture requests a given architecture (if applicable)

func WithPullCache

func WithPullCache(cache bool) PullPackageOption

WithPullCache to set whether use cache if possible

func WithPullChecksum

func WithPullChecksum(calc bool) PullPackageOption

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

func WithPullPlatform

func WithPullPlatform(plats ...string) PullPackageOption

WithPullPlatform requests a given platform (if applicable)

func WithPullProgressFunc

func WithPullProgressFunc(onProgress func(progress float64)) PullPackageOption

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) PullPackageOption

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

type PullPackageOptions

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

func NewPullPackageOptions

func NewPullPackageOptions(opts ...PullPackageOption) (*PullPackageOptions, error)

NewPullPackageOptions creates PullPackageOptions

func (*PullPackageOptions) CalculateChecksum

func (ppo *PullPackageOptions) CalculateChecksum() bool

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

func (*PullPackageOptions) OnProgress

func (ppo *PullPackageOptions) OnProgress(progress float64)

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

func (*PullPackageOptions) UseCache

func (ppo *PullPackageOptions) UseCache() bool

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

func (*PullPackageOptions) Workdir

func (ppo *PullPackageOptions) Workdir() string

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

Jump to

Keyboard shortcuts

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