storage

package
v0.0.0-...-e7f08e9 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Mode               int           `split_words:"true" default:"0"`
	URL                string        `split_words:"true"`
	MasterURL          string        `split_words:"true"`
	SlaveURL           string        `split_words:"true"`
	Password           string        `default:"" split_words:"true"`
	Expiration         int           `default:"10"`
	PoolSize           int           `split_words:"true" default:"10"`
	MaxRetries         int           `split_words:"true" default:"0"`
	ReadTimeout        time.Duration `split_words:"true" default:"3s"`
	PoolTimeout        time.Duration `split_words:"true" default:"4s"`
	MinRetryBackoff    time.Duration `split_words:"true" default:"8ms"`
	MaxRetryBackoff    time.Duration `split_words:"true" default:"512ms"`
	IdleTimeout        time.Duration `split_words:"true" default:"300s"`
	IdleCheckFrequency time.Duration `split_words:"true" default:"60s"`
	SetMemberExpTime   time.Duration `split_words:"true" default:"300s"`
}

Config is the config of the cache client.

type Mode

type Mode uint8
const (
	Single  Mode = 0
	Cluster Mode = 1
)

type Storage

type Storage interface {
	Persist(context.Context, io.Reader, *models.Metadata) error
	Validate(ctx context.Context, md *models.Metadata) error
	Retrieve(context.Context, *models.Metadata) (*os.File, error)
}

func New

func New(cfg *Config, lg logger.Logger) (Storage, error)

Jump to

Keyboard shortcuts

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