locker

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 6 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.

README

locker

This is a library to create a file for the life of a process, possibly containing something like a pid, or more, based on what interface you pass in.

It has the ability to remove the file on a context cancellation, or to manually remove the file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorAlreadyLocked = errors.New("LockPath is already locked")

ErrorAlreadyLocked reports that our path is already locked.

Functions

This section is empty.

Types

type Locker

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

func New

func New(path string, content interface{}) *Locker

func (Locker) Lock

func (l Locker) Lock() error

lock creates a filesystem lock for a process

func (Locker) Read

func (l Locker) Read(val interface{}) error

Read reads a lockfile to get its content

func (Locker) ShutdownContext

func (l Locker) ShutdownContext(ctx context.Context)

func (Locker) Unlock

func (l Locker) Unlock() error

unlock removes a lock file if it exists

Jump to

Keyboard shortcuts

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