lock

package
v0.0.0-...-6ec7e1c Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package lock contains the resources required to create a lock.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLockNotObtained is returned when a lock cannot be returned.
	ErrLockNotObtained error = errors.New("the lock could not be obtained")
	// ErrUnableToUnlock is returned when a lock cannot be released.
	ErrUnableToUnlock error = errors.New("the lock could not be released")
)

Functions

This section is empty.

Types

type Locker

type Locker interface {
	// Creates a new lock using an existing lock instance
	NewLock(key string) (Locker, error)

	// Releases the lock
	// Otherwise returns ErrorUnableToUnlock.
	Unlock() error

	// Attempts to acquire lock. If successful, returns the true.
	// Otherwise returns false, ErrorLockNotObtained.
	TryLock() (bool, error)
}

Locker is the abstract interface for providing a lock client that stores data in the lock The data can be used to provide information about the application using the lock including the prior lock client version.

Directories

Path Synopsis
Package dynamolock contains the resources required a create a DynamoDB lock.
Package dynamolock contains the resources required a create a DynamoDB lock.
Package filelock provides the resources required to create a file lock.
Package filelock provides the resources required to create a file lock.
Package nillock contains the resources required to create a nil lock.
Package nillock contains the resources required to create a nil lock.
Package redislock contains the resources required a create a Redis lock.
Package redislock contains the resources required a create a Redis lock.

Jump to

Keyboard shortcuts

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