store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Stores map[string]func(opts ...Option) (Store, error) = map[string]func(opts ...Option) (Store, error){
	"file": NewFileStore,
	"s3":   NewS3Store,
}

Functions

func Close

func Close() error

func Delete

func Delete(key string) error

func Get

func Get(key string, value interface{}) (bool, error)

func Set

func Set(key string, value interface{}) error

func String

func String() string

Types

type Option

type Option func(o *Options)

func WithAWSAccessKey

func WithAWSAccessKey(ak string) Option

func WithAWSSecretAccessKey

func WithAWSSecretAccessKey(sak string) Option

func WithDirectory

func WithDirectory(dir string) Option

func WithPathStyleAddressing

func WithPathStyleAddressing(ps bool) Option

func WithS3Endpoint

func WithS3Endpoint(ep string) Option

type Options

type Options struct {
	// Directory is the directory name for file store
	// For s3 Directory is used as Bucket name
	Directory string
	// S3Endpoint is used for custom s3 hosted server
	// or other aws s3 compatible solutions.
	// eg - for local minio server without https will be
	// http://localhost:9000
	S3Endpoint string
	// S3 differentiates between "virtual hosted bucket addressing" and "path-style addressing".
	// Example URL for the virtual host style: http://BUCKET.s3.amazonaws.com/KEY.
	// Example UL for the path style: http://s3.amazonaws.com/BUCKET/KEY.
	// Most S3-compatible servers work with both styles,
	// but some work only with the virtual host style (e.g. Alibaba Cloud Object Storage Service (OSS))
	// and some work only with the path style (especially self-hosted services like a Minio server running on localhost).
	// Optional (false by default).
	UsePathStyleAddressing bool
	// AWS access key ID (part of the credentials).
	// Optional (read from shared credentials file or environment variable if not set).
	// Environment variable: "AWS_ACCESS_KEY_ID".
	AWSaccessKeyID string
	// AWS secret access key (part of the credentials).
	// Optional (read from shared credentials file or environment variable if not set).
	// Environment variable: "AWS_SECRET_ACCESS_KEY".
	AWSsecretAccessKey string
}

type Store

type Store interface {
	gokv.Store
	String() string
}

func NewFileStore

func NewFileStore(opts ...Option) (Store, error)

func NewS3Store

func NewS3Store(opts ...Option) (Store, error)

Jump to

Keyboard shortcuts

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