lock

package
v4.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrByteRangeAcquired = errors.New("file byte-range lock is already acquired")

ErrByteRangeAcquired corresponds to the error returned when a file byte-range is already acquired.

View Source
var ErrLockNotSupported = errors.New("file lock is not supported")

ErrLockNotSupported corresponds to the error returned when file locking is not supported.

Functions

func Exclusive

func Exclusive(path string) (fd int, err error)

Exclusive applies an exclusive lock on path

func Release

func Release(fd int) error

Release removes a lock on path referenced by fd

Types

type ByteRange

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

ByteRange defines a file byte-range lock.

func NewByteRange

func NewByteRange(fd int, start, len int64) *ByteRange

NewByteRange returns a file byte-range lock.

func (*ByteRange) Lock

func (r *ByteRange) Lock() error

Lock places a write lock for the corresponding byte-range.

func (*ByteRange) RLock

func (r *ByteRange) RLock() error

RLock places a read lock for the corresponding byte-range.

func (*ByteRange) Unlock

func (r *ByteRange) Unlock() error

Unlock removes the lock for the corresponding byte-range.

Jump to

Keyboard shortcuts

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