filelock

package
v1.5.0-rc5 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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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