compose

package
v0.0.0-...-593cad5 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlobStateUndefined BlobState = iota
	BlobOk
	BlobMissing
	BlobSizeInvalid
	BlobDigestInvalid

	BlobTypeUnknown          BlobType = "unknown blob type"
	BlobTypeAppManifest      BlobType = "app manifest"
	BlobTypeAppBundle        BlobType = "app bundle"
	BlobTypeAppIndex         BlobType = "app index"
	BlobTypeAppLayersMeta    BlobType = "app meta"
	BlobTypeImageIndex       BlobType = "index"
	BlobTypeSkopeoImageIndex BlobType = "skopeo index"
	BlobTypeImageManifest    BlobType = "manifest"
	BlobTypeImageConfig      BlobType = "config"
	BlobTypeImageLayer       BlobType = "layer"
)
View Source
const (
	ImageRootMaxSize = 100 * 1024
)
View Source
const (
	MaxMerkleTreeDepth = 10
)

Variables

This section is empty.

Functions

func AlignToBlockSize

func AlignToBlockSize(value int64, blockSize int64) (aligned int64)

func CopyBlob

func CopyBlob(ctx context.Context, resolver remotes.Resolver, ref string, desc ocispec.Descriptor, store content.Store, force bool) error

func CopyLocalBlob

func CopyLocalBlob(ctx context.Context, path string, ref string, desc ocispec.Descriptor, store content.Store, force bool) error

func GetDockerClient

func GetDockerClient(dockerHost string) (*dockerclient.Client, error)

func NewRegistryAuthorizer

func NewRegistryAuthorizer(cfg *configfile.ConfigFile) docker.Authorizer

func NewResolver

func NewResolver(authorizer docker.Authorizer, connectTimeout int) remotes.Resolver

func NewSecureReadCloser

func NewSecureReadCloser(srcReadCloser io.ReadCloser, opts ...SecureReadOptions) (io.ReadCloser, error)

func ParseImageRootAsManifest

func ParseImageRootAsManifest(root *ImageRoot) (*ocispec.Descriptor, []*ocispec.Descriptor, error)

func ReadBlob

func ReadBlob(ctx context.Context, provider BlobProvider, ref string, digest digest.Digest, size int64) ([]byte, error)

func ReadBlobWithReadLimit

func ReadBlobWithReadLimit(ctx context.Context, provider BlobProvider, ref string, limit int64) ([]byte, error)

func ReadBlobWithResolving

func ReadBlobWithResolving(ctx context.Context, provider BlobProvider, ref string, size int64) ([]byte, error)

func ReadImageManifest

func ReadImageManifest(ctx context.Context, provider BlobProvider, ref string, size int64) (*ocispec.Manifest, error)

func ReadImageRoot

func ReadImageRoot(ctx context.Context, provider BlobProvider, ref string) (*ImageRef, *ImageRoot, *ocispec.Descriptor, error)

func WithBlobType

func WithBlobType(ctx context.Context, blobType BlobType) context.Context

func WithExpectedDigest

func WithExpectedDigest(digest digest.Digest) func(opts *SecureReadParams)

func WithExpectedSize

func WithExpectedSize(size int64) func(opts *SecureReadParams)

func WithReadLimit

func WithReadLimit(limit int64) func(opts *SecureReadParams)

func WithRef

func WithRef(ref string) func(opts *SecureReadParams)

Types

type App

type App interface {
	Name() string
	Ref() *AppRef
	HasLayersMeta(arch string) bool
	GetBlobRuntimeSize(desc *ocispec.Descriptor, arch string, blockSize int64) int64
	GetComposeRoot() *TreeNode
	GetCompose(ctx context.Context, provider BlobProvider) (*composetypes.Project, error)
	CheckComposeInstallation(ctx context.Context, provider BlobProvider, installationRootDir string) (AppBundleErrs, error)
}

type AppBundleErrs

type AppBundleErrs map[string]string

type AppLoader

type AppLoader interface {
	LoadAppTree(context.Context, BlobProvider, platforms.MatchComparer, string) (App, *AppTree, error)
}

type AppRef

type AppRef struct {
	Spec   reference.Spec
	Repo   string
	Name   string
	Tag    string
	Digest digest.Digest
}

func ParseAppRef

func ParseAppRef(ref string) (*AppRef, error)

func (*AppRef) GetBlobRef

func (r *AppRef) GetBlobRef(digest digest.Digest) string

func (*AppRef) String

func (r *AppRef) String() string

type AppStore

type AppStore interface {
	BlobProvider
	ListApps(ctx context.Context) ([]*AppRef, error)
	RemoveApps(ctx context.Context, apps []*AppRef, prune bool) error
	Prune(ctx context.Context) ([]string, error)
}

type AppTree

type AppTree TreeNode

func (*AppTree) Print

func (t *AppTree) Print()

func (*AppTree) Walk

func (t *AppTree) Walk(fn NodeProcessor) error

type BlobInfo

type BlobInfo struct {
	Descriptor  *ocispec.Descriptor `json:"descriptor"`
	State       BlobState           `json:"state"`
	Type        BlobType            `json:"type"`
	StoreSize   int64               `json:"store_size"`
	RuntimeSize int64               `json:"runtime_size"`
}

type BlobProvider

type BlobProvider interface {
	content.InfoProvider
	GetReadCloser(ctx context.Context, opts ...SecureReadOptions) (io.ReadCloser, error)
}

func NewLocalBlobProvider

func NewLocalBlobProvider(fileProvider content.Store) BlobProvider

func NewMemoryBlobProvider

func NewMemoryBlobProvider(blobs map[digest.Digest][]byte) BlobProvider

func NewRemoteBlobProvider

func NewRemoteBlobProvider(resolver remotes.Resolver) BlobProvider

func NewStoreBlobProvider

func NewStoreBlobProvider(blobRoot string) BlobProvider

type BlobState

type BlobState int

func CheckBlob

func CheckBlob(ctx context.Context, provider BlobProvider, dgst digest.Digest, opts ...SecureReadOptions) (BlobState, error)

func ErrToBlobState

func ErrToBlobState(err error) BlobState

func (BlobState) String

func (s BlobState) String() string

type BlobType

type BlobType string

func GetBlobType

func GetBlobType(ctx context.Context) BlobType

type BlobsStatus

type BlobsStatus map[digest.Digest]BlobInfo

type ErrBlobDigestMismatch

type ErrBlobDigestMismatch struct {
	Expected   digest.Digest
	Calculated digest.Digest
}

func (*ErrBlobDigestMismatch) Error

func (e *ErrBlobDigestMismatch) Error() string

type ErrBlobSizeLimitExceed

type ErrBlobSizeLimitExceed struct {
	Limit int64
}

func (*ErrBlobSizeLimitExceed) Error

func (e *ErrBlobSizeLimitExceed) Error() string

type ErrBlobSizeMismatch

type ErrBlobSizeMismatch struct {
	Expected int64
	Read     int64
}

func (*ErrBlobSizeMismatch) Error

func (e *ErrBlobSizeMismatch) Error() string

type ImageRef

type ImageRef struct {
	reference.Spec
	Digest digest.Digest
}

func ParseImageRef

func ParseImageRef(ref string) (*ImageRef, error)

func (ImageRef) GetBlobRef

func (r ImageRef) GetBlobRef(digest digest.Digest) string

type ImageRoot

type ImageRoot struct {
	specs.Versioned
	MediaType string          `json:"mediaType,omitempty"`
	Config    json.RawMessage `json:"config,omitempty"`
	Layers    json.RawMessage `json:"layers,omitempty"`
	Manifests json.RawMessage `json:"manifests,omitempty"`
	FSLayers  json.RawMessage `json:"fsLayers,omitempty"` // schema 1

	Type     BlobType
	Children []TreeNode
}

type ImageTree

type ImageTree TreeNode

func (ImageTree) Print

func (t ImageTree) Print(initDepth ...int)

type NodeProcessor

type NodeProcessor func(node *TreeNode, depth int) error

type SecureReadOptions

type SecureReadOptions func(opts *SecureReadParams)

type SecureReadParams

type SecureReadParams struct {
	Ref            string
	ExpectedDigest digest.Digest
	ExpectedSize   int64
	ReadLimit      int64
}

func GetSecureReadParams

func GetSecureReadParams(opts ...SecureReadOptions) (p SecureReadParams)

type StatFS

type StatFS struct {
	BlockSize int64
	Blocks    uint64
	Bfree     uint64
}

func GetFsStat

func GetFsStat(path string) (StatFS, error)

type TreeNode

type TreeNode struct {
	Descriptor *ocispec.Descriptor
	Type       BlobType
	Children   []*TreeNode
}

func LoadImageTree

func LoadImageTree(ctx context.Context, provider BlobProvider, platform platforms.MatchComparer, ref string) (*TreeNode, error)

func (*TreeNode) GetImageConfigAndLayers

func (t *TreeNode) GetImageConfigAndLayers() (*ocispec.Descriptor, []*ocispec.Descriptor, error)

func (TreeNode) Walk

func (t TreeNode) Walk(fn NodeProcessor) error

type UsageInfo

type UsageInfo struct {
	Path       string  `json:"path"`
	SizeB      uint64  `json:"size_b"`
	Free       uint64  `json:"free"`
	FreeP      float32 `json:"free_p"`
	Reserved   uint64  `json:"reserved"`
	ReservedP  float32 `json:"reserved_p"`
	Available  uint64  `json:"available"`
	AvailableP float32 `json:"available_p"`
	Required   uint64  `json:"required"`
	RequiredP  float32 `json:"required_p"`
}

func GetUsageInfo

func GetUsageInfo(path string, required int64, watermark uint) (*UsageInfo, error)

func (*UsageInfo) Print

func (u *UsageInfo) Print()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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