Version: v0.0.0-...-8b1022e Latest Latest

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0 Imports: 4 Imported by: 0



Package eventual provides values that eventually have a value.



This section is empty.


This section is empty.


This section is empty.


type Getter

type Getter func(time.Duration) (interface{}, bool)

Getter is a functional interface for the Value.Get function

func DefaultGetter

func DefaultGetter(val interface{}) Getter

DefaultGetter builds a Getter that always returns the supplied value.

func DefaultUnsetGetter

func DefaultUnsetGetter() Getter

DefaultUnsetGetter builds a Getter that always !ok.

type Value

type Value interface {
	// Set sets this Value to the given val.
	Set(val interface{})

	// Get waits up to timeout for the value to be set and returns it, or returns
	// nil if it times out or Cancel() is called. valid will be false in latter
	// case. If timeout is 0, Get won't wait. If timeout is -1, Get will wait
	// forever.
	Get(timeout time.Duration) (ret interface{}, valid bool)

	// Cancel cancels this value, signaling any waiting calls to Get() that no
	// value is coming. If no value was set before Cancel() was called, all future
	// calls to Get() will return nil, false. Subsequent calls to Set after Cancel
	// have no effect.

Value is an eventual value, meaning that callers wishing to access the value block until the value is available.

func NewValue

func NewValue() Value

NewValue creates a new Value.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL