content

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 21 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 (
	// OCIImageIndexFile is the file name of the index from the OCI Image Layout Specification
	// Reference: https://github.com/opencontainers/image-spec/blob/master/image-layout.md#indexjson-file
	OCIImageIndexFile = "index.json"
)
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")
	ErrUnsupportedVersion = errors.New("unsupported_version")
)

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

type OCIStore added in v0.8.1

type OCIStore struct {
	content.Store
	// contains filtered or unexported fields
}

OCIStore provides content from the file system with the OCI-Image layout. Reference: https://github.com/opencontainers/image-spec/blob/master/image-layout.md

func NewOCIStore added in v0.8.1

func NewOCIStore(rootPath string) (*OCIStore, error)

NewOCIStore creates a new OCI store

func (*OCIStore) AddReference added in v0.8.1

func (s *OCIStore) AddReference(name string, desc ocispec.Descriptor)

AddReference adds or updates an reference to index.

func (*OCIStore) DeleteReference added in v0.8.1

func (s *OCIStore) DeleteReference(name string)

DeleteReference deletes an reference from index.

func (*OCIStore) ListReferences added in v0.8.1

func (s *OCIStore) ListReferences() map[string]ocispec.Descriptor

ListReferences lists all references in index.

func (*OCIStore) LoadIndex added in v0.8.1

func (s *OCIStore) LoadIndex() error

LoadIndex reads the index.json from the file system

func (*OCIStore) SaveIndex added in v0.8.1

func (s *OCIStore) SaveIndex() error

SaveIndex writes the index.json to the file system

type ProvideIngester added in v0.8.1

type ProvideIngester interface {
	content.Provider
	content.Ingester
}

ProvideIngester is the interface that groups the basic Read and Write methods.

Jump to

Keyboard shortcuts

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