state

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package state provides index-based state change tracking facilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracker

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

Tracker provides index-based state tracking using a condition variable.

func NewTracker

func NewTracker() *Tracker

NewTracker creates a new tracker instance with state index 1.

func (*Tracker) NotifyOfChange

func (t *Tracker) NotifyOfChange()

NotifyOfChange indicates the state index and notifies waiters.

func (*Tracker) Poison

func (t *Tracker) Poison()

Poison terminates tracking.

func (*Tracker) WaitForChange

func (t *Tracker) WaitForChange(previousIndex uint64) (uint64, bool)

WaitForChange waits for a state index change from the previous index.

type TrackingLock

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

TrackingLock provides locking facilities with automatic state tracking notifications.

func NewTrackingLock

func NewTrackingLock(tracker *Tracker) *TrackingLock

NewTrackingLock creates a new tracking lock with the specified tracker.

func (*TrackingLock) Lock

func (l *TrackingLock) Lock()

Lock locks the tracking lock.

func (*TrackingLock) Unlock

func (l *TrackingLock) Unlock()

Unlock unlocks the tracking lock and triggers a state update notification.

func (*TrackingLock) UnlockWithoutNotify

func (l *TrackingLock) UnlockWithoutNotify()

UnlockWithoutNotify unlocks the tracking lock without triggering a state update notification.

Jump to

Keyboard shortcuts

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