fcntllock

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 8 Imported by: 8

Documentation

Overview

Package fcntllock provides simple whole file lock methods based on fcntl

Lock functions create lock directory if absent

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lock

type Lock struct {
	ReadWriteSeekCloser
	// contains filtered or unexported fields
}

Lock implement fcntl lock features

func (*Lock) LockContext

func (lck *Lock) LockContext(ctx context.Context, retryDelay time.Duration) error

LockContext repeat TryLock with retry delay until succeed or context Done

func (*Lock) TryLock

func (lck *Lock) TryLock() error

TryLock acquires an exclusive write file lock (non blocking)

func (Lock) UnLock

func (lck Lock) UnLock() (err error)

UnLock release lock

type Locker

type Locker = locker.Locker

func New

func New(path string) Locker

New create a new fcntl lock

type ReadWriteSeekCloser

type ReadWriteSeekCloser interface {
	io.ReadWriteSeeker
	io.Closer
}

Jump to

Keyboard shortcuts

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