juju: github.com/juju/juju/worker/state Index | Files

package state

import "github.com/juju/juju/worker/state"

Index

Package Files

manifold.go statetracker.go

Variables

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

func Manifold Uses

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.

type ManifoldConfig Uses

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

    // SetStatePool is called with the state pool when it is created,
    // and called again with nil just before the state pool is closed.
    // This is used for publishing the state pool to the agent's
    // introspection worker, which runs outside of the dependency
    // engine; hence the manifold's Output cannot be relied upon.
    SetStatePool func(*state.StatePool)
}

ManifoldConfig provides the dependencies for Manifold.

func (ManifoldConfig) Validate Uses

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type StateTracker Uses

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

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

    // Report is used to give details about what is going on with this state tracker.
    Report() map[string]interface{}
}

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

Package state imports 11 packages (graph) and is imported by 81 packages. Updated 2019-05-12. Refresh now. Tools for package owners.