storage

package
v0.0.0-...-88ead7d Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const S3_CONTENT_TYPE = "application/binary"
View Source
const TAG_PREFIX = "tag_"

Variables

View Source
var EMPTY_HEADERS = map[string][]string{}
View Source
var S3_OPTIONS = s3.Options{}

Functions

func ImageAncestryPath

func ImageAncestryPath(id string) string

func ImageChecksumPath

func ImageChecksumPath(id string) string

func ImageDiffPath

func ImageDiffPath(id string) string

func ImageFilesPath

func ImageFilesPath(id string) string

func ImageJsonPath

func ImageJsonPath(id string) string

func ImageLayerPath

func ImageLayerPath(id string) string

func ImageMarkPath

func ImageMarkPath(id string) string

func RepoImagesListPath

func RepoImagesListPath(namespace, repo string) string

func RepoIndexImagesPath

func RepoIndexImagesPath(namespace, repo string) string

func RepoJsonPath

func RepoJsonPath(namespace, repo string) string

func RepoPath

func RepoPath(namespace, repo string) string

func RepoPrivatePath

func RepoPrivatePath(namespace, repo string) string

func RepoTagJsonPath

func RepoTagJsonPath(namespace, repo, tag string) string

func RepoTagPath

func RepoTagPath(namespace, repo, tag string) string

Types

type Buffer

type Buffer struct {
	os.File
	// contains filtered or unexported fields
}

type BufferDir

type BufferDir struct {
	sync.Mutex
	// contains filtered or unexported fields
}

This will ensure that we don't try to upload the same thing from two different requests at the same time

type Config

type Config struct {
	Type  string `json:"type"`
	Local *Local `json:"local"`
	S3    *S3    `json:"s3"`
}

type Local

type Local struct {
	Root string `json:"root"`
}

func (*Local) Exists

func (s *Local) Exists(relpath string) (bool, error)

func (*Local) Get

func (s *Local) Get(relpath string) ([]byte, error)

func (*Local) GetReader

func (s *Local) GetReader(relpath string) (io.ReadCloser, error)

func (*Local) List

func (s *Local) List(relpath string) ([]string, error)

func (*Local) Put

func (s *Local) Put(relpath string, data []byte) (err error)

func (*Local) PutReader

func (s *Local) PutReader(relpath string, r io.Reader, afterWrite func(io.ReadSeeker)) error

func (*Local) Remove

func (s *Local) Remove(relpath string) error

func (*Local) RemoveAll

func (s *Local) RemoveAll(relpath string) error

func (*Local) Size

func (s *Local) Size(relpath string) (int64, error)

type S3

type S3 struct {
	Region    string `json:"region"`
	Bucket    string `json:"bucket"`
	Root      string `json:"root"`
	BufferDir string `json:"buffer_dir"`
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	// contains filtered or unexported fields
}

func (*S3) Exists

func (s *S3) Exists(relpath string) (bool, error)

func (*S3) Get

func (s *S3) Get(relpath string) ([]byte, error)

func (*S3) GetReader

func (s *S3) GetReader(relpath string) (io.ReadCloser, error)

func (*S3) List

func (s *S3) List(relpath string) ([]string, error)

func (*S3) Put

func (s *S3) Put(relpath string, data []byte) error

func (*S3) PutReader

func (s *S3) PutReader(relpath string, r io.Reader, afterWrite func(io.ReadSeeker)) error

func (*S3) Remove

func (s *S3) Remove(relpath string) error

func (*S3) RemoveAll

func (s *S3) RemoveAll(relpath string) error

func (*S3) Size

func (s *S3) Size(relpath string) (int64, error)

type Storage

type Storage interface {
	Get(string) ([]byte, error)
	Put(string, []byte) error
	GetReader(string) (io.ReadCloser, error)
	PutReader(string, io.Reader, func(io.ReadSeeker)) error
	List(string) ([]string, error)
	Exists(string) (bool, error)
	Size(string) (int64, error)
	Remove(string) error
	RemoveAll(string) error
	// contains filtered or unexported methods
}

func New

func New(cfg *Config) (Storage, error)

Jump to

Keyboard shortcuts

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