Documentation ¶
Overview ¶
Package dynamodb contains the DynamoDB store implementation.
Index ¶
- Constants
- Variables
- func New(endpoints []string, options *store.Config) (store.Store, error)
- func Register()
- type DynamoDB
- func (ddb *DynamoDB) AtomicDelete(_ context.Context, key string, previous *store.KVPair) (bool, error)
- func (ddb *DynamoDB) AtomicPut(_ context.Context, key string, value []byte, previous *store.KVPair, ...) (bool, *store.KVPair, error)
- func (ddb *DynamoDB) Close() error
- func (ddb *DynamoDB) Delete(_ context.Context, key string) error
- func (ddb *DynamoDB) DeleteTree(_ context.Context, keyPrefix string) error
- func (ddb *DynamoDB) Exists(_ context.Context, key string, _ *store.ReadOptions) (bool, error)
- func (ddb *DynamoDB) Get(_ context.Context, key string, options *store.ReadOptions) (*store.KVPair, error)
- func (ddb *DynamoDB) List(_ context.Context, directory string, options *store.ReadOptions) ([]*store.KVPair, error)
- func (ddb *DynamoDB) NewLock(_ context.Context, key string, options *store.LockOptions) (store.Locker, error)
- func (ddb *DynamoDB) Put(_ context.Context, key string, value []byte, options *store.WriteOptions) error
- func (ddb *DynamoDB) Watch(_ context.Context, _ string, _ <-chan struct{}, _ *store.ReadOptions) (<-chan *store.KVPair, error)
- func (ddb *DynamoDB) WatchTree(_ context.Context, _ string, _ <-chan struct{}, _ *store.ReadOptions) (<-chan []*store.KVPair, error)
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 ¶
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) DeleteTree ¶
DeleteTree deletes a range of keys under a given directory.
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.
Click to show internal directories.
Click to hide internal directories.