dir

package
v0.0.0-...-3ed0888 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package dir implements a directory-based CAS engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDigestListerEngine

func NewDigestListerEngine(ctx context.Context, path string, uri string, getDigest GetDigest) (engine casengine.DigestListerEngine, err error)

NewDigestListerEngine creates a new CAS-engine instance that can list the digests it contains. Arguments are the same as for NewEngine, with an additional getDigest used to translate paths to digests.

func NewEngine

func NewEngine(ctx context.Context, path string, uri string) (engine casengine.Engine, err error)

NewEngine creates a new CAS-engine instance. The path argument is used as a base for expanding relative URIs and as a base for creating a temporary directory for storing partially-Put blobs. Moving the completed blob to its final location is more likely to be atomic if that temporary directory is on the same filesystem as the final location.

Types

type DigestListerEngine

type DigestListerEngine struct {
	*Engine
	// contains filtered or unexported fields
}

DigestListerEngine is a CAS engine based on the local filesystem.

func (*DigestListerEngine) Digests

func (engine *DigestListerEngine) Digests(ctx context.Context, algorithm digest.Algorithm, prefix string, size int, from int, callback casengine.DigestCallback) (err error)

Digests implements DigestLister.Digests.

type Engine

type Engine struct {

	// Algorithm selects the Algorithm used for Put.
	Algorithm digest.Algorithm
	// contains filtered or unexported fields
}

Engine is a CAS engine based on the local filesystem.

func (*Engine) Algorithms

func (engine *Engine) Algorithms(ctx context.Context, prefix string, size int, from int, callback casengine.AlgorithmCallback) (err error)

Algorithms implements AlgorithmLister.Algorithms.

func (*Engine) Close

func (engine *Engine) Close(ctx context.Context) (err error)

Close implements Closer.Close.

func (*Engine) Delete

func (engine *Engine) Delete(ctx context.Context, digest digest.Digest) (err error)

Delete implements Deleter.Delete.

func (*Engine) Get

func (engine *Engine) Get(ctx context.Context, digest digest.Digest) (reader io.ReadCloser, err error)

Get implements Reader.Get.

func (*Engine) Put

func (engine *Engine) Put(ctx context.Context, algorithm digest.Algorithm, reader io.Reader) (dig digest.Digest, err error)

Put implements Writer.Put.

type GetDigest

type GetDigest func(path string) (digest digest.Digest, err error)

GetDigest calculates the digest corresponding to a given relative path. This is effectively the inverse of URI Template expansion, and is required to support Digests.

type RegexpGetDigest

type RegexpGetDigest struct {
	Regexp *regexp.Regexp
}

RegexpGetDigest is a helper structure for regular-expression based GetDigest implementations.

func (*RegexpGetDigest) GetDigest

func (r *RegexpGetDigest) GetDigest(path string) (dig digest.Digest, err error)

GetDigest implements GetDigest for RegexpGetDigest.

Jump to

Keyboard shortcuts

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