memory

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryBackend

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

func NewMemoryBackend

func NewMemoryBackend(groups []string) *MemoryBackend

func (*MemoryBackend) Close

func (m *MemoryBackend) Close() error

Calls all necessary finalization if necessary

func (*MemoryBackend) GetLocks

func (m *MemoryBackend) GetLocks(group string) (int, error)

Returns the current number of locks for the given group

func (*MemoryBackend) GetStaleLocks

func (m *MemoryBackend) GetStaleLocks(ts time.Duration) ([]types.Lock, error)

Return all locks older than x

func (*MemoryBackend) HasLock

func (m *MemoryBackend) HasLock(group, id string) (bool, error)

Check if a given id already has a lock for this group

func (*MemoryBackend) Release

func (m *MemoryBackend) Release(group string, id string) error

Release the lock currently held by the id. Does not fail when no lock is held.

func (*MemoryBackend) Reserve

func (m *MemoryBackend) Reserve(group string, id string) error

Reserve a lock for the given group. Returns true if the lock is successfully reserved, even if the lock is already held by the specific id

Jump to

Keyboard shortcuts

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