narada4d

package
v0.0.0-...-535d4ab Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDirNotSet         = errors.New("NARADA4D_DIR is not set")
	ErrDirNotDir         = errors.New("NARADA4D_DIR is not a directory")
	ErrDirNotInitialized = errors.New("NARADA4D_DIR is not initialized")
)

Errors returned by Init.

View Source
var (
	// Dir is $NARADA4D_DIR.
	Dir string
)

Functions

func ExclusiveLock

func ExclusiveLock()

ExclusiveLock will set exclusive lock, send SetVersion event and wait for the response. You must Unlock before calling ExclusiveLock or SharedLock again.

func Init

func Init(c chan<- SetVersion) error

Init must be called before using this package.

func SharedLock

func SharedLock()

SharedLock will set shared lock, send SetVersion event and wait for the response. You must Unlock before calling ExclusiveLock or SharedLock again.

func Unlock

func Unlock()

Unlock will release lock set by ExclusiveLock or SharedLock. You must call ExclusiveLock or SharedLock before Unlock.

Types

type SetVersion

type SetVersion struct {
	Version string
	Done    chan<- struct{}
}

SetVersion is an event sent after successful locking. Event consumer should check is it compatible with Version and either setup data access accordingly to Version and then send to Done or shutdown application without sending to Done.

Jump to

Keyboard shortcuts

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