store

package module
v0.0.0-...-747f32b Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: NCSA Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteOption

type DeleteOption func(*ListOptions)

type DeleteOptions

type DeleteOptions struct {
	Context context.Context
}

type DownloadOption

type DownloadOption func(*DownloadOptions)

type DownloadOptions

type DownloadOptions struct {
	Context context.Context
}

type GetOption

type GetOption func(*GetOptions)

type GetOptions

type GetOptions struct {
	Context context.Context
}

type ListOption

type ListOption func(*ListOptions)

func Max

func Max(m int64) ListOption

type ListOptions

type ListOptions struct {
	Max     int64
	Context context.Context
}

type Option

type Option func(*Options)

func BaseURL

func BaseURL(s string) Option

func Bucket

func Bucket(s string) Option

type Options

type Options struct {
	BaseURL string
	Bucket  string
	Context context.Context
}

type Store

type Store interface {
	Options() Options
	Upload(path string, key string, opts ...UploadOption) (string, error)
	UploadFrom(reader io.Reader, key string, opts ...UploadOption) (string, error)
	Download(target string, key string, opts ...DownloadOption) error
	DownloadTo(writer io.WriterAt, key string, opts ...DownloadOption) error
	Get(key string, opts ...GetOption) ([]byte, error)
	GetReader(key0 string, opts ...GetOption) (io.ReadCloser, error)
	List(opts ...ListOption) ([]string, error)
	Delete(key string, opts ...DeleteOption) error
	Name() string
	Close() error
}

type StoreWithFallback

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

StoreWithFallback implements Store interface wrapped with Prometheus metrics

func NewStoreWithFallback

func NewStoreWithFallback(interval time.Duration, impls ...Store) StoreWithFallback

NewStoreWithFallback takes several implementations of the Store and returns an instance of Store which calls all implementations concurrently with given interval and returns first non-error response.

func (StoreWithFallback) Close

func (_d StoreWithFallback) Close() (err error)

Close implements Store

func (StoreWithFallback) Delete

func (_d StoreWithFallback) Delete(key string, opts ...DeleteOption) (err error)

Delete implements Store

func (StoreWithFallback) Download

func (_d StoreWithFallback) Download(target string, key string, opts ...DownloadOption) (err error)

Download implements Store

func (StoreWithFallback) DownloadTo

func (_d StoreWithFallback) DownloadTo(writer io.WriterAt, key string, opts ...DownloadOption) (err error)

DownloadTo implements Store

func (StoreWithFallback) Get

func (_d StoreWithFallback) Get(key string, opts ...GetOption) (ba1 []byte, err error)

Get implements Store

func (StoreWithFallback) GetReader

func (_d StoreWithFallback) GetReader(key0 string, opts ...GetOption) (r1 io.ReadCloser, err error)

GetReader implements Store

func (StoreWithFallback) List

func (_d StoreWithFallback) List(opts ...ListOption) (sa1 []string, err error)

List implements Store

func (StoreWithFallback) Name

func (_d StoreWithFallback) Name() (s1 string)

Name implements Store

func (StoreWithFallback) Options

func (_d StoreWithFallback) Options() (o1 Options)

Options implements Store

func (StoreWithFallback) Upload

func (_d StoreWithFallback) Upload(path string, key string, opts ...UploadOption) (s1 string, err error)

Upload implements Store

func (StoreWithFallback) UploadFrom

func (_d StoreWithFallback) UploadFrom(reader io.Reader, key string, opts ...UploadOption) (s1 string, err error)

UploadFrom implements Store

type StoreWithRetry

type StoreWithRetry struct {
	Store
	// contains filtered or unexported fields
}

StoreWithRetry implements Store interface instrumented with retries

func NewStoreWithRetry

func NewStoreWithRetry(base Store, retryCount int, retryInterval time.Duration) StoreWithRetry

NewStoreWithRetry returns StoreWithRetry

func (StoreWithRetry) Close

func (_d StoreWithRetry) Close() (err error)

Close implements Store

func (StoreWithRetry) Delete

func (_d StoreWithRetry) Delete(key string, opts ...DeleteOption) (err error)

Delete implements Store

func (StoreWithRetry) Download

func (_d StoreWithRetry) Download(target string, key string, opts ...DownloadOption) (err error)

Download implements Store

func (StoreWithRetry) DownloadTo

func (_d StoreWithRetry) DownloadTo(writer io.WriterAt, key string, opts ...DownloadOption) (err error)

DownloadTo implements Store

func (StoreWithRetry) Get

func (_d StoreWithRetry) Get(key string, opts ...GetOption) (ba1 []byte, err error)

Get implements Store

func (StoreWithRetry) GetReader

func (_d StoreWithRetry) GetReader(key0 string, opts ...GetOption) (r1 io.ReadCloser, err error)

GetReader implements Store

func (StoreWithRetry) List

func (_d StoreWithRetry) List(opts ...ListOption) (sa1 []string, err error)

List implements Store

func (StoreWithRetry) Upload

func (_d StoreWithRetry) Upload(path string, key string, opts ...UploadOption) (s1 string, err error)

Upload implements Store

func (StoreWithRetry) UploadFrom

func (_d StoreWithRetry) UploadFrom(reader io.Reader, key string, opts ...UploadOption) (s1 string, err error)

UploadFrom implements Store

type StoreWithTracing

type StoreWithTracing struct {
	Store
	// contains filtered or unexported fields
}

StoreWithTracing implements Store interface instrumented with opentracing spans

func NewStoreWithTracing

func NewStoreWithTracing(base Store, instance string) StoreWithTracing

NewStoreWithTracing returns StoreWithTracing

type UploadOption

type UploadOption func(*UploadOptions)

func UploadMetadata

func UploadMetadata(mp map[string]interface{}) UploadOption

func UploadProgress

func UploadProgress(p *pb.ProgressBar) UploadOption

func UploadProgressFinishMessage

func UploadProgressFinishMessage(s string) UploadOption

func UploadProgressOutput

func UploadProgressOutput(out io.Writer) UploadOption

type UploadOptions

type UploadOptions struct {
	Progress              *pb.ProgressBar
	ProgressOutput        io.Writer
	ProgressFinishMessage string
	Metadata              map[string]string
	Context               context.Context
}

Directories

Path Synopsis
tus
localstore
Package localstore provide a storage backend based on the local file system.
Package localstore provide a storage backend based on the local file system.
s3store
Package s3store provides a storage backend using AWS S3 or compatible servers.
Package s3store provides a storage backend using AWS S3 or compatible servers.

Jump to

Keyboard shortcuts

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