objectstorage

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 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, format string, args ...interface{}) error

Types

type ErrNotExist added in v0.4.0

type ErrNotExist struct {
	*util.WrapperError
}

type ObjStorage

type ObjStorage interface {
	Stat(ctx context.Context, filepath string) (*ObjectInfo, error)
	ReadObject(ctx context.Context, 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(ctx context.Context, filepath string, data io.Reader, size int64, persist bool) error
	DeleteObject(ctx context.Context, filepath string) error
	List(ctx context.Context, prefix, startAfter string, recursive bool) <-chan ObjectInfo
}

type ObjectInfo added in v0.4.0

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

	Err 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(ctx context.Context, p string) error

func (*PosixStorage) List added in v0.4.0

func (s *PosixStorage) List(ctx context.Context, prefix, startAfter string, recursive bool) <-chan ObjectInfo

func (*PosixStorage) ReadObject added in v0.4.0

func (s *PosixStorage) ReadObject(ctx context.Context, p string) (ReadSeekCloser, error)

func (*PosixStorage) Stat added in v0.4.0

func (s *PosixStorage) Stat(ctx context.Context, p string) (*ObjectInfo, error)

func (*PosixStorage) WriteObject added in v0.4.0

func (s *PosixStorage) WriteObject(ctx context.Context, 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(ctx context.Context, bucket, location, endpoint, accessKeyID, secretAccessKey string, secure bool) (*S3Storage, error)

func (*S3Storage) DeleteObject added in v0.4.0

func (s *S3Storage) DeleteObject(ctx context.Context, filepath string) error

func (*S3Storage) List added in v0.4.0

func (s *S3Storage) List(ctx context.Context, prefix, startAfter string, recursive bool) <-chan ObjectInfo

func (*S3Storage) ReadObject added in v0.4.0

func (s *S3Storage) ReadObject(ctx context.Context, filepath string) (ReadSeekCloser, error)

func (*S3Storage) Stat added in v0.4.0

func (s *S3Storage) Stat(ctx context.Context, p string) (*ObjectInfo, error)

func (*S3Storage) WriteObject added in v0.4.0

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

Jump to

Keyboard shortcuts

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