filelock

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package filelock implements an exclusive filesystem lock which allows the caller to atomically update the file safely as well. It is built on top of the rkt `filelock` package. It is partially related to discussion in https://github.com/rkt/rkt/pull/3615

Index

Constants

This section is empty.

Variables

View Source
var AlreadyUnlockedErr = errors.New("lock is already unlocked")

Functions

This section is empty.

Types

type UpdateableFileLock

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

UpdateableFileLock is a filelock which can be updated atomically

func NewExclusiveLock

func NewExclusiveLock(path string) (*UpdateableFileLock, error)

NewExclusiveLock creates a new exclusive filelock. The given filepath must exist.

func (*UpdateableFileLock) Unlock

func (l *UpdateableFileLock) Unlock() error

Unlock unlocks the filelock

func (*UpdateableFileLock) Update

func (l *UpdateableFileLock) Update(contents io.Reader) error

Update writes the given contents into the filelock atomically

Jump to

Keyboard shortcuts

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