storage

package
v0.0.0-...-96fe679 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2014 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// ProviderAws is a storage provider that interfaces to Amazon S3
	ProviderAws int = 0

	// ProviderDummy is a storage provider that is downright dishonest
	// and doesn't give a damn about your data. It is however extremly fast.
	ProviderDummy int = 1

	// ProviderDisk is a storage provider that interfaces to local disk
	ProviderDisk int = 2
)

Variables

This section is empty.

Functions

func Get

func Get(path string, provider StorageProvider) (io.ReadCloser, error)

Get retrieves a file from the provided storage provider

func Put

func Put(path string, r io.ReadCloser, provider StorageProvider) (string, error)

Put writes a file to the provided storage provider and returns a SHA256 checksum

Types

type AwsProvider

type AwsProvider struct {
	AccessKey string
	SecretKey string
	Bucket    string
}

AwsProvider is a storage provider that allows Docker images to be stored on Amazon S3

func (*AwsProvider) Reader

func (s *AwsProvider) Reader(path string) (io.ReadCloser, error)

Reader returns an io.ReadCloser for the specified path

func (*AwsProvider) Writer

func (s *AwsProvider) Writer(path string) (io.WriteCloser, error)

Writer returns an io.WriteCloser for the specified path

type ClosingBuffer

type ClosingBuffer struct {
	*bytes.Buffer
}

ClosingBuffer is a bytes.Buffer based buffer that implements the Closer interface

func (*ClosingBuffer) Close

func (cb *ClosingBuffer) Close() error

Close closes a buffer

type DiskProvider

type DiskProvider struct {
	Directory string
}

DiskProvider is a storage provider that stores your Docker images on local disk.

func (*DiskProvider) Reader

func (d *DiskProvider) Reader(path string) (io.ReadCloser, error)

Reader returns an io.ReadCloser for the specified path

func (*DiskProvider) Writer

func (d *DiskProvider) Writer(path string) (io.WriteCloser, error)

Writer returns an io.WriteCloser for the specified path

type DummyProvider

type DummyProvider struct {
}

DummyProvider is a storage provider that is downright dishonest and doesn't give a damn about your data. It is however, extremly fast.

func (*DummyProvider) Reader

func (d *DummyProvider) Reader(path string) (io.ReadCloser, error)

Reader returns an io.ReadCloser for the specified path

func (*DummyProvider) Writer

func (d *DummyProvider) Writer(path string) (closer io.WriteCloser, err error)

Writer returns an io.WriteCloser for the specified path

type StorageProvider

type StorageProvider interface {
	Reader(path string) (io.ReadCloser, error)
	Writer(path string) (io.WriteCloser, error)
}

StorageProvider is responsible for obtaining/managing a reader/writer to a storage type (eg disk/s3)

func NewAwsProvider

func NewAwsProvider(key, secret, bucket string) StorageProvider

NewAwsProvider creates a new instance of the AWS S3 storage provider with the authentication credentials provided, ready for upload/download operations.

func NewDiskProvider

func NewDiskProvider() StorageProvider

NewDiskProvider creates a new disk storage provider instance

func NewDummyProvider

func NewDummyProvider() StorageProvider

NewDummyProvider creates a new dummy storage provider instance

Jump to

Keyboard shortcuts

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