storage

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Adding these to make code more readable when looking at Put Call
	NoOverWrite = true
	OverWrite   = false
)
View Source
const (
	ErrNotFound     errString = "not found"
	ErrForbidden    errString = "forbidden"
	ErrNotSupported errString = "not supported"
	ErrExists       errString = "exists already"
	ErrObjectTooBig errString = "object too big to be read into memory"
)
View Source
const MaxObjectSizeInMemory = 2 * 1024 * 1024 * 1024 // 2 gigs

Variables

This section is empty.

Functions

func MultiPut

func MultiPut(ctx context.Context, stores []MultiStoreUnit, name string, buffer []byte, doesNotExist NewKey) error

func PipeIO

func PipeIO(writer io.Writer, reader io.Reader) (n int64, err error)

func ReadTee

func ReadTee(ctx context.Context, sStore Store, source string, dStore Store, destination string) ([]byte, error)

Types

type Attributes

type Attributes struct {
	Created time.Time
	Updated time.Time
	Owner   string
}

type MultiStoreUnit

type MultiStoreUnit struct {
	Store           Store
	TolerateFailure bool
}

type NewKey

type NewKey = bool

type Store

type Store interface {
	String() string
	Has(context.Context, string) (bool, error)
	Get(context.Context, string) (io.ReadCloser, error)
	GetAttr(context.Context, string) (Attributes, error)
	GetAt(context.Context, string) (io.ReaderAt, error)
	Touch(context.Context, string) error
	Put(context.Context, string, io.Reader, NewKey) error
	Delete(context.Context, string) error
	Keys(context.Context) ([]string, error)
	Clear(context.Context) error
	KeysPrefix(ctx context.Context, pageToken string, prefix string, delimiter string, count int) ([]string, string, error)
}

Store implementations know how to write entries to a K/V model.Store.

Typically this is something file system-like. Examples are S3, local FS, NFS, ... Implementations of this interface are assumed to be fairly simple.

func Instrument

func Instrument(tr opentracing.Tracer, logs zap.Logger, store Store) Store

type StoreCRC

type StoreCRC interface {
	PutCRC(context.Context, string, io.Reader, bool, uint32) error
}

Directories

Path Synopsis
Package status declares error constants returned by the various implementations of the Store interface.
Package status declares error constants returned by the various implementations of the Store interface.

Jump to

Keyboard shortcuts

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