content

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBlobMediaType specifies the default blob media type
	DefaultBlobMediaType = ocispec.MediaTypeImageLayer
	// DefaultBlobDirMediaType specifies the default blob directory media type
	DefaultBlobDirMediaType = ocispec.MediaTypeImageLayerGzip
)
View Source
const (
	// AnnotationDigest is the annotation key for the digest of the uncompressed content
	AnnotationDigest = "io.deis.oras.content.digest"
	// AnnotationUnpack is the annotation key for indication of unpacking
	AnnotationUnpack = "io.deis.oras.content.unpack"
)
View Source
const (
	// TempFilePattern specifies the pattern to create temporary files
	TempFilePattern = "oras"
)

Variables

View Source
var (
	ErrNotFound        = errors.New("not_found")
	ErrNoName          = errors.New("no_name")
	ErrUnsupportedSize = errors.New("unsupported_size")
)

Common errors

View Source
var (
	ErrPathTraversalDisallowed = errors.New("path_traversal_disallowed")
	ErrOverwriteDisallowed     = errors.New("overwrite_disallowed")
)

FileStore errors

Functions

func ResolveName

func ResolveName(desc ocispec.Descriptor) (string, bool)

ResolveName resolves name from descriptor

Types

type FileStore

type FileStore struct {
	DisableOverwrite          bool
	AllowPathTraversalOnWrite bool
	// contains filtered or unexported fields
}

FileStore provides content from the file system

func NewFileStore

func NewFileStore(rootPath string) *FileStore

NewFileStore creats a new file store

func (*FileStore) Add

func (s *FileStore) Add(name, mediaType, path string) (ocispec.Descriptor, error)

Add adds a file reference

func (*FileStore) Close added in v0.4.0

func (s *FileStore) Close() error

Close frees up resources used by the file store

func (*FileStore) MapPath

func (s *FileStore) MapPath(name, path string) string

MapPath maps name to path

func (*FileStore) ReaderAt

func (s *FileStore) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error)

ReaderAt provides contents

func (*FileStore) ResolvePath

func (s *FileStore) ResolvePath(name string) string

ResolvePath returns the path by name

func (*FileStore) Writer

func (s *FileStore) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error)

Writer begins or resumes the active writer identified by desc

type Memorystore

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

Memorystore provides content from the memory

func NewMemoryStore

func NewMemoryStore() *Memorystore

NewMemoryStore creats a new memory store

func (*Memorystore) Add

func (s *Memorystore) Add(name, mediaType string, content []byte) ocispec.Descriptor

Add adds content

func (*Memorystore) Get

Get finds the content from the store

func (*Memorystore) GetByName

func (s *Memorystore) GetByName(name string) (ocispec.Descriptor, []byte, bool)

GetByName finds the content from the store by name (i.e. AnnotationTitle)

func (*Memorystore) ReaderAt

func (s *Memorystore) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error)

ReaderAt provides contents

func (*Memorystore) Set

func (s *Memorystore) Set(desc ocispec.Descriptor, content []byte)

Set adds the content to the store

func (*Memorystore) Writer

func (s *Memorystore) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error)

Writer begins or resumes the active writer identified by desc

Jump to

Keyboard shortcuts

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