dynamolock

package
v0.0.0-...-963cbb1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dynamolock contains the resources required a create a DynamoDB lock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute string

Attribute represents attribute names in DynamoDB items.

type DynamoLock

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

DynamoLock represents a lock for a key stored as a single DynamoDB entry.

func New

func New(client dynamodbutils.Client, tableName string, key string, opts Options) (*DynamoLock, error)

New creates a new DynamoLock instance.

func (*DynamoLock) NewLock

func (l *DynamoLock) NewLock(key string) (lock.Locker, error)

NewLock creates a new DynamoLock instance using an existing DynamoLock instance.

func (*DynamoLock) TryLock

func (l *DynamoLock) TryLock() (bool, error)

TryLock attempts to acquire a DynamoDB lock.

func (*DynamoLock) Unlock

func (l *DynamoLock) Unlock() error

Unlock releases a DynamoDB lock.

type Options

type Options struct {
	// The amount of time (in seconds) that the owner has this lock for.
	// If lease_duration is None then the lock is non-expirable.
	TTL                         time.Duration
	HeartBeat                   time.Duration
	DeleteOnRelease             bool
	MaxRetryTableCreateAttempts uint16
	// The number of read capacity units which can be consumed per second (https://aws.amazon.com/dynamodb/pricing/provisioned/)
	RCU int64
	// The number of write capacity units which can be consumed per second (https://aws.amazon.com/dynamodb/pricing/provisioned/)
	WCU int64
}

Options contains settings that can be adjusted to change the behavior of a DynamoDB lock.

Jump to

Keyboard shortcuts

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