file_lock

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LegacyHashFunction = false

Functions

This section is empty.

Types

type BaseLock

type BaseLock struct {
	Name        string
	ActiveLocks int
}

func (*BaseLock) GetName

func (lock *BaseLock) GetName() string

func (*BaseLock) Lock

func (lock *BaseLock) Lock(l locker) error

func (*BaseLock) TryLock

func (lock *BaseLock) TryLock(l locker) (bool, error)

func (*BaseLock) Unlock

func (lock *BaseLock) Unlock(l locker) error

type FileLock

type FileLock struct {
	BaseLock
	LocksDir string
	// contains filtered or unexported fields
}

func (*FileLock) Lock

func (lock *FileLock) Lock(timeout time.Duration, readOnly bool, onWait func(doWait func() error) error) error

func (*FileLock) LockFilePath

func (lock *FileLock) LockFilePath() string

func (*FileLock) TryLock

func (lock *FileLock) TryLock(readOnly bool) (bool, error)

func (*FileLock) Unlock

func (lock *FileLock) Unlock() error

type LockObject

type LockObject interface {
	GetName() string
	TryLock(readOnly bool) (bool, error)
	Lock(timeout time.Duration, readOnly bool, onWait func(doWait func() error) error) error
	Unlock() error
}

func NewFileLock

func NewFileLock(name, locksDir string) LockObject

Jump to

Keyboard shortcuts

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