storage

package
v1.0.1-0...-32d7d0a Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultMinioConfig = MinioConfig{
		Host:       "localhost",
		Port:       "9000",
		AccessKey:  "12345678",
		SecretKey:  "qwertyui",
		Token:      "",
		Secure:     false,
		RetryTimes: 4,
		RetryPause: 5 * time.Second,
		Timeout:    30 * time.Second,
		Location:   "eu-central-1",
		Prefix:     "",
	}
)

Functions

func New

Types

type Minio

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

func NewMinio

func NewMinio(ctx context.Context, conf MinioConfig) (*Minio, error)

func (*Minio) Get

func (m *Minio) Get(ctx context.Context, album uint64, image uint64) (model.File, error)

func (*Minio) Health

func (m *Minio) Health(ctx context.Context) (bool, error)

func (*Minio) Put

func (m *Minio) Put(ctx context.Context, album uint64, image uint64, f model.File) (string, error)

func (*Minio) Remove

func (m *Minio) Remove(ctx context.Context, album uint64, image uint64) error

func (*Minio) Reset

func (m *Minio) Reset() error

type MinioConfig

type MinioConfig struct {
	Host       string        `mapstructure:"STORAGE_MINIO_HOST"        validate:"required"`
	Port       string        `mapstructure:"STORAGE_MINIO_PORT"        validate:"required"`
	AccessKey  string        `mapstructure:"STORAGE_MINIO_ACCESS_KEY"  validate:"required"`
	SecretKey  string        `mapstructure:"STORAGE_MINIO_SECRET_KEY"  validate:"required"`
	Token      string        `mapstructure:"STORAGE_MINIO_TOKEN"`
	Secure     bool          `mapstructure:"STORAGE_MINIO_SECURE"`
	RetryTimes int           `mapstructure:"STORAGE_MINIO_RETRY_TIMES" validate:"required"`
	RetryPause time.Duration `mapstructure:"STORAGE_MINIO_RETRY_PAUSE" validate:"required"`
	Timeout    time.Duration `mapstructure:"STORAGE_MINIO_TIMEOUT"     validate:"required"`
	Location   string        `mapstructure:"STORAGE_MINIO_LOCATION"    validate:"required"`
	Prefix     string        `mapstructure:"STORAGE_MINIO_PREFIX"`
}

type Mock

type Mock struct {
}

func NewMock

func NewMock() *Mock

func (*Mock) Get

func (m *Mock) Get(_ context.Context, _ uint64, _ uint64) (model.File, error)

func (*Mock) Health

func (m *Mock) Health(_ context.Context) (bool, error)

func (*Mock) Put

func (m *Mock) Put(_ context.Context, album uint64, image uint64, f model.File) (string, error)

func (*Mock) Remove

func (m *Mock) Remove(_ context.Context, _ uint64, _ uint64) error

type StorageConfig

type StorageConfig struct {
	Storage string      `mapstructure:"APP_STORAGE" validate:"required"`
	Minio   MinioConfig `mapstructure:",squash"`
}

Jump to

Keyboard shortcuts

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