lock

package
v0.0.0-...-7a1da02 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockManager

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

func NewLockManager

func NewLockManager(dc DynamoDbProvider, opts LockManagerOptions) *LockManager

func NewLockManagerWithEncryption

func NewLockManagerWithEncryption(dc DynamoDbProvider, opts LockManagerOptionsWithEncryption) *LockManager

func (*LockManager) AcquireLock

func (lm *LockManager) AcquireLock(ctx context.Context, opt *models.AcquireLockOptions) (*models.Lock, error)

func (*LockManager) CanAcquireLock

func (lm *LockManager) CanAcquireLock(ctx context.Context, key string) error

func (*LockManager) CreateLockTable

func (*LockManager) GetLock

func (lm *LockManager) GetLock(ctx context.Context, key string) (*models.Lock, error)

func (*LockManager) ReleaseLock

func (lm *LockManager) ReleaseLock(ctx context.Context, key string) (bool, error)

type LockManagerOptions

type LockManagerOptions struct {
	WithEncryption   bool
	PartitionKeyName string
	TableName        string
	OwnerName        string
}

type LockManagerOptionsWithEncryption

type LockManagerOptionsWithEncryption struct {
	LockManagerOptions
	EncryptionKey string
}

type LockManagerProvider

type LockManagerProvider interface {
	CreateLockTable(ctx context.Context, opt *models.CreateDynamoDBTableOptions) (*dynamodb.CreateTableOutput, error)
	CanAcquireLock(ctx context.Context, key string) error
	AcquireLock(ctx context.Context, opt *models.AcquireLockOptions) (*models.Lock, error)
	ReleaseLock(ctx context.Context, key string) (bool, error)
	GetLock(ctx context.Context, key string) (*models.Lock, error)
}

Jump to

Keyboard shortcuts

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