sync

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorWaiter

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

ErrorWaiter is similar to a WaitGroup except it allows collecting failures from subtasks.

func (*ErrorWaiter) Submit

func (ew *ErrorWaiter) Submit(f func() error)

Submit submits a task for execution on the ErrorWaiter.

The function returns immediately.

func (*ErrorWaiter) Wait

func (ew *ErrorWaiter) Wait() []error

Wait waits until all submitted tasks have finished and returns a list of all errors that occurred during task execution in no particular order.

type LifecycleOnce added in v1.0.0

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

LifecycleOnce is a helper for implementing transport.Lifecycles with similar behavior.

func (*LifecycleOnce) IsRunning added in v1.0.0

func (l *LifecycleOnce) IsRunning() bool

IsRunning will return true if current state of the Lifecycle is running

func (*LifecycleOnce) Start added in v1.0.0

func (l *LifecycleOnce) Start(f func() error) error

Start will run the `f` function once and return the error. If Start is called multiple times it will return the error from the first time it was called.

func (*LifecycleOnce) Stop added in v1.0.0

func (l *LifecycleOnce) Stop(f func() error) error

Stop will run the `f` function once and return the error. If Stop is called multiple times it will return the error from the first time it was called.

type LifecycleState added in v1.0.0

type LifecycleState int

LifecycleState represents `states` that a lifecycle object can be in.

const (
	// Idle indicates the Lifecycle hasn't been operated on yet.
	Idle LifecycleState = iota

	// Starting indicates that the Lifecycle has begun it's "start" command
	// but hasn't finished yet.
	Starting

	// Running indicates that the Lifecycle has finished starting and is
	// available.
	Running

	// Stopping indicates that the Lifecycle 'stop' method has been called
	// but hasn't finished yet.
	Stopping

	// Stopped indicates that the Lifecycle has been stopped.
	Stopped

	// Errored indicates that the Lifecycle experienced an error and we can't
	// reasonably determine what state the lifecycle is in.
	Errored
)

Jump to

Keyboard shortcuts

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