objectstorage

package
v0.0.0-...-3943c12 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERROR_DATA_NOT_FOUND              = errors.New("ERROR_DATA_NOT_FOUND")
	ERROR_STORE_DATA_FAILED           = errors.New("ERROR_STORE_DATA_FAILED")
	ERROR_FAIL_TO_CONNECT_SPACE_STORE = errors.New("ERROR_STORE_DATA_FAILED")
)

Functions

This section is empty.

Types

type BucketProperties

type BucketProperties struct {
	Name     string
	Location string
}

type DigitalOceanSpaceConfig

type DigitalOceanSpaceConfig struct {
	AccessKey string `yaml:"access_key"`
	SecretKey string `yaml:"secret_key"`
	Endpoint  string `yaml:"endpoint"`
}

type Metadata

type Metadata struct {
	Url string
}

type SpaceStore

type SpaceStore struct {
	*s3.S3
	BucketProperties
}

func NewSpaceStore

func NewSpaceStore(ctx context.Context, endpoint string, key string, secret string, bucket BucketProperties) (*SpaceStore, error)

func (*SpaceStore) Delete

func (s *SpaceStore) Delete(ctx context.Context, id string) error

func (*SpaceStore) Retrieve

func (s *SpaceStore) Retrieve(ctx context.Context, id string) ([]byte, error)

func (*SpaceStore) RetrieveObjectMetadata

func (s *SpaceStore) RetrieveObjectMetadata(context context.Context, id string) (*Metadata, error)

func (*SpaceStore) Store

func (s *SpaceStore) Store(ctx context.Context, id string, data []byte) error

type Storage

type Storage interface {
	Store(ctx context.Context, id string, data []byte) error
	Retrieve(context context.Context, id string) (data []byte, err error)
	RetrieveObjectMetadata(context context.Context, id string) (metadata *Metadata, err error)
	Delete(context context.Context, id string) error
}

func NewInmemoryStore

func NewInmemoryStore() Storage

Jump to

Keyboard shortcuts

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