filelock

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const LogRotateLockName = "logrotate_run.lock"

LogRotateLockName used to lock processes which can touch /var/log/vic logs to avoid race condition during export and logrotate run.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLock

type FileLock struct {
	LockFile string
	LockName string
	// contains filtered or unexported fields
}

FileLock is a cross-process lock designed to work over FS that supports locking.

func NewFileLock

func NewFileLock(lockName string) *FileLock

NewFileLock returns a new instance of the file based lock. it is a user responsibility to ensure lock name is unique and doesn't collide with any other file names in the TEMP directory.

func (*FileLock) Acquire

func (fl *FileLock) Acquire() error

Acquire grabs the lock. If lock is already acquired, it will block. User should check for errors if lock is actually acquired, if lock is not acquired it will panic on Release.

func (*FileLock) Release

func (fl *FileLock) Release() error

Release lock. If lock is not acquired, it will panic.

Jump to

Keyboard shortcuts

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