dynamodb

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package dynamodb contains the DynamoDB store implementation.

Index

Constants

View Source
const (
	// DefaultReadCapacityUnits default read capacity used to create table.
	DefaultReadCapacityUnits = 2
	// DefaultWriteCapacityUnits default write capacity used to create table.
	DefaultWriteCapacityUnits = 2
	// TableCreateTimeoutSeconds the maximum time we wait for the AWS DynamoDB table to be created.
	TableCreateTimeoutSeconds = 30
	// DeleteTreeTimeoutSeconds the maximum time we retry a write batch.
	DeleteTreeTimeoutSeconds = 30
)

Variables

View Source
var (
	// ErrBucketOptionMissing is returned when bucket config option is missing.
	ErrBucketOptionMissing = errors.New("missing dynamodb bucket/table name")
	// ErrMultipleEndpointsUnsupported is returned when more than one endpoint is provided.
	ErrMultipleEndpointsUnsupported = errors.New("dynamodb only supports one endpoint")
	// ErrTableCreateTimeout table creation timed out.
	ErrTableCreateTimeout = errors.New("dynamodb table creation timed out")
	// ErrDeleteTreeTimeout delete batch timed out.
	ErrDeleteTreeTimeout = errors.New("delete batch timed out")
	// ErrLockAcquireCancelled stop called before lock was acquired.
	ErrLockAcquireCancelled = errors.New("stop called before lock was acquired")
)

Functions

func New

func New(endpoints []string, options *store.Config) (store.Store, error)

New opens and creates a new table.

func Register

func Register()

Register register a store provider in valkeyrie for AWS DynamoDB.

Types

type DynamoDB

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

DynamoDB store used to interact with AWS DynamoDB.

func (*DynamoDB) AtomicDelete

func (ddb *DynamoDB) AtomicDelete(_ context.Context, key string, previous *store.KVPair) (bool, error)

AtomicDelete delete of a single value.

func (*DynamoDB) AtomicPut

func (ddb *DynamoDB) AtomicPut(_ context.Context, key string, value []byte, previous *store.KVPair, options *store.WriteOptions) (bool, *store.KVPair, error)

AtomicPut Atomic CAS operation on a single value.

func (*DynamoDB) Close

func (ddb *DynamoDB) Close() error

Close nothing to see here.

func (*DynamoDB) Delete

func (ddb *DynamoDB) Delete(_ context.Context, key string) error

Delete the value at the specified key.

func (*DynamoDB) DeleteTree

func (ddb *DynamoDB) DeleteTree(_ context.Context, keyPrefix string) error

DeleteTree deletes a range of keys under a given directory.

func (*DynamoDB) Exists

func (ddb *DynamoDB) Exists(_ context.Context, key string, _ *store.ReadOptions) (bool, error)

Exists if a Key exists in the store.

func (*DynamoDB) Get

func (ddb *DynamoDB) Get(_ context.Context, key string, options *store.ReadOptions) (*store.KVPair, error)

Get a value given its key.

func (*DynamoDB) List

func (ddb *DynamoDB) List(_ context.Context, directory string, options *store.ReadOptions) ([]*store.KVPair, error)

List the content of a given prefix.

func (*DynamoDB) NewLock

func (ddb *DynamoDB) NewLock(_ context.Context, key string, options *store.LockOptions) (store.Locker, error)

NewLock has to implemented at the library level since it's not supported by DynamoDB.

func (*DynamoDB) Put

func (ddb *DynamoDB) Put(_ context.Context, key string, value []byte, options *store.WriteOptions) error

Put a value at the specified key.

func (*DynamoDB) Watch

func (ddb *DynamoDB) Watch(_ context.Context, _ string, _ <-chan struct{}, _ *store.ReadOptions) (<-chan *store.KVPair, error)

Watch has to implemented at the library level since it's not supported by DynamoDB.

func (*DynamoDB) WatchTree

func (ddb *DynamoDB) WatchTree(_ context.Context, _ string, _ <-chan struct{}, _ *store.ReadOptions) (<-chan []*store.KVPair, error)

WatchTree has to implemented at the library level since it's not supported by DynamoDB.

Jump to

Keyboard shortcuts

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