filelock

package
v0.0.0-...-a9ed6da Latest Latest
Warning

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

Go to latest
Published: May 7, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectLockUnlock

func ExpectLockUnlock(fileLockerMock *FileLockerMock, lockPath string, ownerId string)

func GetOwnerIdForProcess

func GetOwnerIdForProcess() string

func LockFile

func LockFile(lockPath string, ownerId string, timeoutSeconds int) (locked bool, err error)

func UnlockFile

func UnlockFile(lockPath string, ownerId string) (hadLock bool, err error)

Types

type FileLocker

type FileLocker interface {
	Lock(lockPath string, ownerId string, timeoutSeconds int) (locked bool, err error)
	Unlock(lockPath string, ownerId string) (hadLock bool, err error)
}

func NewFileLocker

func NewFileLocker() FileLocker

type FileLockerMock

type FileLockerMock struct {
	mock.Mock
}

func (*FileLockerMock) Lock

func (fl *FileLockerMock) Lock(lockPath string, ownerId string, timeoutSeconds int) (locked bool, err error)

func (*FileLockerMock) Unlock

func (fl *FileLockerMock) Unlock(lockPath string, ownerId string) (hadLock bool, err error)

type FileLockerNoop

type FileLockerNoop struct{}

func (*FileLockerNoop) Lock

func (fl *FileLockerNoop) Lock(lockPath string, ownerId string, timeoutSeconds int) (locked bool, err error)

func (*FileLockerNoop) Unlock

func (fl *FileLockerNoop) Unlock(lockPath string, ownerId string) (hadLock bool, err error)

Jump to

Keyboard shortcuts

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