storage

package
v0.0.0-...-755fe1a Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeNoSuchKey = 1
	ErrOther         = 0
)

Functions

func ExistsObject

func ExistsObject(s Storage, key string) (bool, error)

func GetInt

func GetInt(s Storage, key string, defaultVal int) (int, error)

func PutEmptyObject

func PutEmptyObject(s Storage, key string) error

func PutInt

func PutInt(s Storage, key string, num int) error

Types

type Error

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

func (*Error) Error

func (e *Error) Error() string

func (*Error) IsErrNoSuchKey

func (e *Error) IsErrNoSuchKey() bool

type Mutex

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

func NewMutex

func NewMutex(stor Storage, procID, numProcs int) *Mutex

func (*Mutex) Lock

func (m *Mutex) Lock() error

func (*Mutex) Unlock

func (m *Mutex) Unlock() error

type S3

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

func NewS3

func NewS3(config *S3Config) *S3

func (*S3) DeleteObject

func (s *S3) DeleteObject(key string) error

func (*S3) GetObject

func (s *S3) GetObject(key string) ([]byte, error)

func (*S3) PutObject

func (s *S3) PutObject(key string, buf io.Reader) error

type S3Config

type S3Config struct {
	AccessKeyID, SecretAccessKey, Endpoint, Region, Bucket string
}

type Storage

type Storage interface {
	PutObject(key string, buf io.Reader) error
	GetObject(key string) ([]byte, error)
	DeleteObject(key string) error
}

Jump to

Keyboard shortcuts

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