utils

package
v0.0.0-...-cfcd82a Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManifestOSFeatureNydus   = "nydus.remoteimage.v1"
	MediaTypeNydusBlob       = "application/vnd.oci.image.layer.nydus.blob.v1"
	BootstrapFileNameInLayer = "image/image.boot"

	ManifestNydusCache        = "containerd.io/snapshot/nydus-cache"
	ManifestNydusCacheVersion = "v1"

	LayerAnnotationNydusBlob          = "containerd.io/snapshot/nydus-blob"
	LayerAnnotationNydusBlobDigest    = "containerd.io/snapshot/nydus-blob-digest"
	LayerAnnotationNydusBlobSize      = "containerd.io/snapshot/nydus-blob-size"
	LayerAnnotationNydusBlobIDs       = "containerd.io/snapshot/nydus-blob-ids"
	LayerAnnotationNydusBootstrap     = "containerd.io/snapshot/nydus-bootstrap"
	LayerAnnotationNydusSourceChainID = "containerd.io/snapshot/nydus-source-chainid"

	LayerAnnotationUncompressed = "containerd.io/uncompressed"
)

Variables

This section is empty.

Functions

func MarshalToDesc

func MarshalToDesc(data interface{}, mediaType string) (*ocispec.Descriptor, []byte, error)

func PackTargz

func PackTargz(src string, name string, compress bool) (io.ReadCloser, error)

PackTargz makes .tar(.gz) stream of file named `name` and return reader

func PackTargzInfo

func PackTargzInfo(src, name string, compress bool) (digest.Digest, int64, error)

PackTargzInfo makes .tar(.gz) stream of file named `name` and return digest and size

func UnpackFile

func UnpackFile(reader io.Reader, source, target string) error

func UnpackTargz

func UnpackTargz(ctx context.Context, dst string, r io.Reader) error

UnpackTargz unpacks .tar(.gz) stream, and write to dst path

Types

type Job

type Job = func() error

type QueueWorkerPool

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

QueueWorkerPool creates a worker pool with fixed count, caller puts some jobs to the pool by a fixed order and then wait all jobs finish by the previous order

func NewQueueWorkerPool

func NewQueueWorkerPool(worker, total uint) *QueueWorkerPool

NewQueueWorkerPool creates a queued worker pool, `worker` is worker count, `total` is expected job count

func (*QueueWorkerPool) Put

func (pool *QueueWorkerPool) Put(_job RJob) error

func (*QueueWorkerPool) Waiter

func (pool *QueueWorkerPool) Waiter() []chan RJob

type RJob

type RJob interface {
	Do() error
	Err() error
}

type WorkerPool

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

WorkerPool creates a worker pool with fixed count, caller puts some jobs to the pool and then wait all jobs finish

func NewWorkerPool

func NewWorkerPool(worker, total uint) *WorkerPool

NewWorkerPool creates a worker pool, `worker` is worker count, `total` is expected job count

func (*WorkerPool) Put

func (pool *WorkerPool) Put(job Job) error

func (*WorkerPool) Wait

func (pool *WorkerPool) Wait() error

Jump to

Keyboard shortcuts

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