state

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStateClosed = errors.New("state closed")

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a manifold whose worker which wraps a *state.State, which is in turn wrapper by a StateTracker. It will exit if the State's associated mongodb session dies.

Types

type ManifoldConfig

type ManifoldConfig struct {
	AgentName              string
	StateConfigWatcherName string
	OpenState              func(coreagent.Config) (*state.State, error)
	PingInterval           time.Duration
}

ManifoldConfig provides the dependencies for Manifold.

type StateTracker

type StateTracker interface {
	// Use returns wrapped State, recording the use of
	// it. ErrStateClosed is returned if the State is closed.
	Use() (*state.State, error)

	// Done records that there's one less user of the wrapped State,
	// closing it if there's no more users. ErrStateClosed is returned
	// if the State has already been closed (indicating that Done has
	// called too many times).
	Done() error
}

StateTracker describes a type which wraps and manages the lifetime of a *state.State.

Jump to

Keyboard shortcuts

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