backing

package
v0.0.0-...-982583b Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backing

type Backing interface {
	// List lists all keys in the store with the given prefix. This is likely a very slow operation, so use with caution.
	List(prefix string) ([]Key, error)
	// Get returns the value for the given key.
	Get(key Key) ([]byte, error)
	// Set sets the value for the given key.
	Set(key Key, value []byte) error
	// Del deletes the key-value pair for the given key.
	Del(key Key) error
}

Backing is an interface by which a Store accesses data in some backend datastore.

func NewS3

func NewS3(args S3Args) (Backing, error)

NewS3 creates a new backing which stores data in AWS S3.

type Key

type Key = string

Key is the key for a key-value pair in the store.

type S3

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

S3 stores data in AWS S3.

func (*S3) Del

func (s *S3) Del(key Key) error

Del deletes the key-value pair for the given key.

func (*S3) Get

func (s *S3) Get(key Key) ([]byte, error)

Get returns the value for the given key.

func (*S3) List

func (s *S3) List(prefix string) ([]Key, error)

List lists all keys in the store with the given prefix. This is likely a very slow operation, so use with caution.

func (*S3) Set

func (s *S3) Set(key Key, value []byte) error

Set sets the value for the given key.

type S3Args

type S3Args struct {
	Bucket    string          // Required. The name of the S3 bucket to use.
	Namespace string          // Required. The namespace prefixed to all keys when stored in S3.
	Client    *s3.Client      // Optional. The S3 client to use. If not provided, a client will be automatically configured from your environment.
	Context   context.Context // Optional. The context to use for S3 operations. If not provided, defaults to context.Background().
}

S3Args are the arguments for creating a new S3 backing.

Jump to

Keyboard shortcuts

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