transferstore

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2018 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrObjectNotExists is returned when a object does not exist
	ErrObjectNotExists = errors.New("object does not exist")
)

Functions

func TempS3Bucket

func TempS3Bucket() (name string, clean func(), err error)

TempS3Bucket creates a temporary s3 bucket that can be removed again by calling clean(). This is mainly usefull for testing purposes throughout the codebase of this project. The name will be a randomly generated name prefixed with 'nerd-tests-'

Types

type S3Store

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

S3Store provides an S3 Backed store

func NewS3Store

func NewS3Store(cfg StoreOptions) (store *S3Store, err error)

NewS3Store creates an s3 implementation of the object store

func (*S3Store) Del

func (store *S3Store) Del(ctx context.Context, k string) error

Del will remove an object from the store at key 'k'

func (*S3Store) Get

func (store *S3Store) Get(ctx context.Context, k string, w io.WriterAt) (err error)

Get a object from the store with key 'k' and write it to 'w'

func (*S3Store) Head

func (store *S3Store) Head(ctx context.Context, k string) (size int64, err error)

Head returns metadata for the object

func (*S3Store) Put

func (store *S3Store) Put(ctx context.Context, k string, r io.ReadSeeker) (err error)

Put an object into the store at key 'k' by reading from 'r'

type StoreOptions

type StoreOptions struct {
	Type StoreType `json:"type"`

	S3StoreBucket    string `json:"s3StoreBucket"`
	S3StorePrefix    string `json:"s3StorePrefix"`
	S3StoreAWSRegion string `json:"s3StoreAWSRegion"`
	S3StoreAccessKey string `json:"s3StoreAccessKey"`
	S3StoreSecretKey string `json:"s3StoreSecretKey"`
	S3SessionToken   string `json:"s3SessionToken"`
}

StoreOptions contain options for all stores

type StoreType

type StoreType string

StoreType determines what type the object store will be

const (
	//StoreTypeS3 uses a AWS S3 store
	StoreTypeS3 StoreType = "s3"
)

Jump to

Keyboard shortcuts

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