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: 0

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