objectstorage

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotExist added in v0.4.0

func IsNotExist(err error) bool

func NewErrNotExist added in v0.4.0

func NewErrNotExist(err error) error

Types

type ErrNotExist added in v0.4.0

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

func (*ErrNotExist) Error added in v0.4.0

func (e *ErrNotExist) Error() string

func (*ErrNotExist) Is added in v0.4.0

func (*ErrNotExist) Is(err error) bool

type EscapeError added in v0.4.0

type EscapeError string

func (EscapeError) Error added in v0.4.0

func (e EscapeError) Error() string

type ObjStorage

type ObjStorage struct {
	Storage
	// contains filtered or unexported fields
}

ObjStorage wraps a Storage providing additional helper functions

func NewObjStorage

func NewObjStorage(s Storage, delimiter string) *ObjStorage

func (*ObjStorage) Delimiter

func (s *ObjStorage) Delimiter() string

func (*ObjStorage) List

func (s *ObjStorage) List(prefix, startWith string, recursive bool, doneCh <-chan struct{}) <-chan ObjectInfo

type ObjectInfo added in v0.4.0

type ObjectInfo struct {
	Path         string
	LastModified time.Time
	Size         int64

	Err error
}

type PosixFlatStorage added in v0.4.0

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

func NewPosixFlat added in v0.4.0

func NewPosixFlat(baseDir string) (*PosixFlatStorage, error)

func (*PosixFlatStorage) DeleteObject added in v0.4.0

func (s *PosixFlatStorage) DeleteObject(p string) error

func (*PosixFlatStorage) List added in v0.4.0

func (s *PosixFlatStorage) List(prefix, startWith, delimiter string, doneCh <-chan struct{}) <-chan ObjectInfo

func (*PosixFlatStorage) ReadObject added in v0.4.0

func (s *PosixFlatStorage) ReadObject(p string) (ReadSeekCloser, error)

func (*PosixFlatStorage) Stat added in v0.4.0

func (s *PosixFlatStorage) Stat(p string) (*ObjectInfo, error)

func (*PosixFlatStorage) WriteObject added in v0.4.0

func (s *PosixFlatStorage) WriteObject(p string, data io.Reader, size int64, persist bool) error

type PosixStorage added in v0.4.0

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

func NewPosix added in v0.4.0

func NewPosix(baseDir string) (*PosixStorage, error)

func (*PosixStorage) DeleteObject added in v0.4.0

func (s *PosixStorage) DeleteObject(p string) error

func (*PosixStorage) List added in v0.4.0

func (s *PosixStorage) List(prefix, startWith, delimiter string, doneCh <-chan struct{}) <-chan ObjectInfo

func (*PosixStorage) ReadObject added in v0.4.0

func (s *PosixStorage) ReadObject(p string) (ReadSeekCloser, error)

func (*PosixStorage) Stat added in v0.4.0

func (s *PosixStorage) Stat(p string) (*ObjectInfo, error)

func (*PosixStorage) WriteObject added in v0.4.0

func (s *PosixStorage) WriteObject(p string, data io.Reader, size int64, persist bool) error

type ReadSeekCloser added in v0.4.0

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Closer
}

type S3Storage added in v0.4.0

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

func NewS3 added in v0.4.0

func NewS3(bucket, location, endpoint, accessKeyID, secretAccessKey string, secure bool) (*S3Storage, error)

func (*S3Storage) DeleteObject added in v0.4.0

func (s *S3Storage) DeleteObject(filepath string) error

func (*S3Storage) List added in v0.4.0

func (s *S3Storage) List(prefix, startWith, delimiter string, doneCh <-chan struct{}) <-chan ObjectInfo

func (*S3Storage) ReadObject added in v0.4.0

func (s *S3Storage) ReadObject(filepath string) (ReadSeekCloser, error)

func (*S3Storage) Stat added in v0.4.0

func (s *S3Storage) Stat(p string) (*ObjectInfo, error)

func (*S3Storage) WriteObject added in v0.4.0

func (s *S3Storage) WriteObject(filepath string, data io.Reader, size int64, persist bool) error

type Storage

type Storage interface {
	Stat(filepath string) (*ObjectInfo, error)
	ReadObject(filepath string) (ReadSeekCloser, error)
	// WriteObject atomically writes an object. If size is greater or equal to
	// zero then only size bytes will be read from data and wrote. If size is
	// less than zero data will be wrote until EOF. When persist is true the
	// implementation must ensure that data is persisted to the underlying
	// storage.
	WriteObject(filepath string, data io.Reader, size int64, persist bool) error
	DeleteObject(filepath string) error
	List(prefix, startWith, delimiter string, doneCh <-chan struct{}) <-chan ObjectInfo
}

Jump to

Keyboard shortcuts

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