fcntllock

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: GPL-2.0 Imports: 5 Imported by: 8

Documentation

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 interface {
	LockContext(context.Context, time.Duration) error
	UnLock() error
	io.ReadWriteSeeker
	io.Closer
}

func New

func New(path string) Locker

New create a new fcntl lock

type ReadWriteSeekCloser

type ReadWriteSeekCloser interface {
	io.ReadWriteSeeker
	io.Closer
}

Directories

Path Synopsis
Package mock_fcntlock is a generated GoMock package.
Package mock_fcntlock is a generated GoMock package.

Jump to

Keyboard shortcuts

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