state

package
v0.0.0-...-acd7349 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2013 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Overview

The state package enables reading, observing, and changing the state stored in MongoDB of a whole environment managed by juju.

Index

Constants

View Source
const (
	ItemAdded = iota
	ItemModified
	ItemDeleted
)
View Source
const BootstrapNonce = "user-admin:bootstrap"

BootstrapNonce is used as a nonce for the state server machine.

Variables

View Source
var ErrCannotEnterScope = stderrors.New("cannot enter scope: unit or relation is not alive")

ErrCannotEnterScope indicates that a relation unit failed to enter its scope due to either the unit or the relation not being Alive.

View Source
var ErrCannotEnterScopeYet = stderrors.New("cannot enter scope yet: non-alive subordinate unit has not been removed")

ErrCannotEnterScopeYet indicates that a relation unit failed to enter its scope due to a required and pre-existing subordinate unit that is not Alive. Once that subordinate has been removed, a new one can be created.

View Source
var ErrExcessiveContention = stderrors.New("state changing too quickly; try again soon")
View Source
var ErrSubordinateConstraints = stderrors.New("constraints do not apply to subordinate services")
View Source
var ErrUnitHasSubordinates = stderrors.New("unit has subordinates")

Functions

func ContainerTypeFromId

func ContainerTypeFromId(machineId string) instance.ContainerType

ContainerTypeFromId returns the container type if machineId is a container id, or "" if machineId is not for a container.

func IsHasAssignedUnitsError

func IsHasAssignedUnitsError(err error) bool

func IsHasContainersError

func IsHasContainersError(err error) bool

func IsMachineId

func IsMachineId(name string) bool

IsMachineId returns whether id is a valid machine id.

func IsNotAssigned

func IsNotAssigned(err error) bool

func IsNotProvisionedError

func IsNotProvisionedError(err error) bool

IsNotProvisionedError returns true if err is a NotProvisionedError.

func IsServiceName

func IsServiceName(name string) bool

IsServiceName returns whether name is a valid service name.

func IsUnitName

func IsUnitName(name string) bool

IsUnitName returns whether name is a valid unit name.

func MachineIdFromTag

func MachineIdFromTag(tag string) string

MachineIdFromTag returns the machine id that was used to create the tag.

func MachineTag

func MachineTag(id string) string

MachineTag returns the tag for the machine with the given id.

func NestingLevel

func NestingLevel(machineId string) int

NestingLevel returns how many levels of nesting exist for a machine id.

func ParentId

func ParentId(machineId string) string

ParentId returns the id of the host machine if machineId a container id, or "" if machineId is not for a container.

func SortPorts

func SortPorts(ports []instance.Port)

SortPorts sorts the given ports, first by protocol, then by number.

func TopParentId

func TopParentId(machineId string) string

TopParentId returns the id of the top level host machine for a container id.

func UnitTag

func UnitTag(unitName string) string

UnitTag returns the tag for the unit with the given name.

Types

type AddMachineParams

type AddMachineParams struct {
	Series        string
	Constraints   constraints.Value
	ParentId      string
	ContainerType instance.ContainerType

	Jobs []MachineJob
	// contains filtered or unexported fields
}

AddMachineParams encapsulates the parameters used to create a new machine.

type Annotator

type Annotator interface {
	Annotation(key string) (string, error)
	Annotations() (map[string]string, error)
	SetAnnotations(pairs map[string]string) error
}

Annotator represents entities capable of handling annotations.

type AssignmentPolicy

type AssignmentPolicy string

AssignmentPolicy controls what machine a unit will be assigned to.

const (
	// AssignLocal indicates that all service units should be assigned
	// to machine 0.
	AssignLocal AssignmentPolicy = "local"

	// AssignClean indicates that every service unit should be assigned
	// to a machine which never previously has hosted any units, and that
	// new machines should be launched if required.
	AssignClean AssignmentPolicy = "clean"

	// AssignCleanEmpty indicates that every service unit should be assigned
	// to a machine which never previously has hosted any units, and which is not
	// currently hosting any containers, and that new machines should be launched if required.
	AssignCleanEmpty AssignmentPolicy = "clean-empty"

	// AssignNew indicates that every service unit should be assigned to a new
	// dedicated machine.  A new machine will be launched for each new unit.
	AssignNew AssignmentPolicy = "new"
)

type Authenticator

type Authenticator interface {
	Refresh() error
	SetPassword(pass string) error
	PasswordValid(pass string) bool
}

Authenticator represents entites capable of handling password authentication.

type Charm

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

Charm represents the state of a charm in the environment.

func (*Charm) BundleSha256

func (c *Charm) BundleSha256() string

BundleSha256 returns the SHA256 digest of the charm bundle bytes.

func (*Charm) BundleURL

func (c *Charm) BundleURL() *url.URL

BundleURL returns the url to the charm bundle in the provider storage.

func (*Charm) Config

func (c *Charm) Config() *charm.Config

Config returns the configuration of the charm.

func (*Charm) Meta

func (c *Charm) Meta() *charm.Meta

Meta returns the metadata of the charm.

func (*Charm) Revision

func (c *Charm) Revision() int

Revision returns the monotonically increasing charm revision number.

func (*Charm) String

func (c *Charm) String() string

func (*Charm) URL

func (c *Charm) URL() *charm.URL

URL returns the URL that identifies the charm.

type D

type D []bson.DocElem

TODO(niemeyer): This must not be exported.

type DialOpts

type DialOpts struct {
	// Timeout is the amount of time to wait contacting
	// a state server.
	Timeout time.Duration
}

DialOpts holds configuration parameters that control the Dialing behavior when connecting to a state server.

func DefaultDialOpts

func DefaultDialOpts() DialOpts

DefaultDialOpts returns a DialOpts representing the default parameters for contacting a state server.

type Endpoint

type Endpoint struct {
	ServiceName string
	charm.Relation
}

Endpoint represents one endpoint of a relation.

func (Endpoint) CanRelateTo

func (ep Endpoint) CanRelateTo(other Endpoint) bool

CanRelateTo returns whether a relation may be established between e and other.

func (Endpoint) ImplementedBy

func (ep Endpoint) ImplementedBy(ch charm.Charm) bool

ImplementedBy returns whether the endpoint is implemented by the supplied charm.

func (Endpoint) IsImplicit

func (ep Endpoint) IsImplicit() bool

IsImplicit returns whether the endpoint is supplied by juju itself, rather than by a charm.

func (Endpoint) String

func (ep Endpoint) String() string

String returns the unique identifier of the relation endpoint.

type EnvironConfigWatcher

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

EnvironConfigWatcher observes changes to the environment configuration.

func (*EnvironConfigWatcher) Changes

func (w *EnvironConfigWatcher) Changes() <-chan *config.Config

Changes returns a channel that will receive the new environment configuration when a change is detected. Note that multiple changes may be observed as a single event in the channel.

func (*EnvironConfigWatcher) Err

func (w *EnvironConfigWatcher) Err() error

Err returns any error encountered while running or shutting down, or tomb.ErrStillAlive if the watcher is still running.

func (*EnvironConfigWatcher) Stop

func (w *EnvironConfigWatcher) Stop() error

Stop stops the watcher, and returns any error encountered while running or shutting down.

type Environment

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

Environment represents the state of an environment.

func (*Environment) Annotation

func (a *Environment) Annotation(key string) (string, error)

Annotation returns the annotation value corresponding to the given key. If the requested annotation is not found, an empty string is returned.

func (*Environment) Annotations

func (a *Environment) Annotations() (map[string]string, error)

Annotations returns all the annotations corresponding to an entity.

func (*Environment) SetAnnotations

func (a *Environment) SetAnnotations(pairs map[string]string) (err error)

SetAnnotations adds key/value pairs to annotations in MongoDB.

func (Environment) Tag

func (e Environment) Tag() string

Tag returns a name identifying the environment. The returned name will be different from other Tag values returned by any other entities from the same state.

func (Environment) UUID

func (e Environment) UUID() string

UUID returns the universally unique identifier of the environment.

type HasAssignedUnitsError

type HasAssignedUnitsError struct {
	MachineId string
	UnitNames []string
}

func (*HasAssignedUnitsError) Error

func (e *HasAssignedUnitsError) Error() string

type HasContainersError

type HasContainersError struct {
	MachineId    string
	ContainerIds []string
}

func (*HasContainersError) Error

func (e *HasContainersError) Error() string

type Info

type Info struct {
	// Addrs gives the addresses of the MongoDB servers for the state.
	// Each address should be in the form address:port.
	Addrs []string

	// CACert holds the CA certificate that will be used
	// to validate the state server's certificate, in PEM format.
	CACert []byte

	// Tag holds the name of the entity that is connecting.
	// It should be empty when connecting as an administrator.
	Tag string

	// Password holds the password for the connecting entity.
	Password string
}

Info encapsulates information about cluster of servers holding juju state and can be used to make a connection to that cluster.

type ItemChange

type ItemChange struct {
	Type     int
	Key      string
	OldValue interface{}
	NewValue interface{}
}

ItemChange represents the change of an item in a settings.

func (*ItemChange) String

func (ic *ItemChange) String() string

String returns the item change in a readable format.

type Life

type Life int8

Life represents the lifecycle state of the entities Relation, Unit, Service and Machine.

const (
	Alive Life = iota
	Dying
	Dead
)

func (Life) String

func (l Life) String() string

type Lifer

type Lifer interface {
	Tagger
	Life() Life
}

Lifer represents entities with a life.

type Living

type Living interface {
	Life() Life
	Destroy() error
	EnsureDead() error
	Refresh() error
}

Living describes state entities with a lifecycle.

type Machine

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

Machine represents the state of a machine.

func (*Machine) AgentAlive

func (m *Machine) AgentAlive() (bool, error)

AgentAlive returns whether the respective remote agent is alive.

func (*Machine) AgentTools

func (m *Machine) AgentTools() (*Tools, error)

AgentTools returns the tools that the agent is currently running. It returns an error that satisfies IsNotFound if the tools have not yet been set.

func (*Machine) Annotation

func (a *Machine) Annotation(key string) (string, error)

Annotation returns the annotation value corresponding to the given key. If the requested annotation is not found, an empty string is returned.

func (*Machine) Annotations

func (a *Machine) Annotations() (map[string]string, error)

Annotations returns all the annotations corresponding to an entity.

func (*Machine) CheckProvisioned

func (m *Machine) CheckProvisioned(nonce string) bool

CheckProvisioned returns true if the machine was provisioned with the given nonce.

func (*Machine) Clean

func (m *Machine) Clean() bool

Clean returns true if the machine does not have any deployed units or containers.

func (*Machine) Constraints

func (m *Machine) Constraints() (constraints.Value, error)

Constraints returns the exact constraints that should apply when provisioning an instance for the machine.

func (*Machine) ContainerType

func (m *Machine) ContainerType() instance.ContainerType

ContainerType returns the type of container hosting this machine.

func (*Machine) Containers

func (m *Machine) Containers() ([]string, error)

Containers returns the container ids belonging to a parent machine. TODO(wallyworld): move this method to a service

func (*Machine) Destroy

func (m *Machine) Destroy() error

Destroy sets the machine lifecycle to Dying if it is Alive. It does nothing otherwise. Destroy will fail if the machine has principal units assigned, or if the machine has JobManageEnviron. If the machine has assigned units, Destroy will return a HasAssignedUnitsError.

func (*Machine) EnsureDead

func (m *Machine) EnsureDead() error

EnsureDead sets the machine lifecycle to Dead if it is Alive or Dying. It does nothing otherwise. EnsureDead will fail if the machine has principal units assigned, or if the machine has JobManageEnviron. If the machine has assigned units, EnsureDead will return a HasAssignedUnitsError.

func (*Machine) HardwareCharacteristics

func (m *Machine) HardwareCharacteristics() (*instance.HardwareCharacteristics, error)

TODO(wallyworld): move this method to a service.

func (*Machine) Id

func (m *Machine) Id() string

Id returns the machine id.

func (*Machine) InstanceId

func (m *Machine) InstanceId() (instance.Id, error)

InstanceId returns the provider specific instance id for this machine and whether it has been set.

func (*Machine) Jobs

func (m *Machine) Jobs() []MachineJob

Jobs returns the responsibilities that must be fulfilled by m's agent.

func (*Machine) Life

func (m *Machine) Life() Life

Life returns whether the machine is Alive, Dying or Dead.

func (*Machine) ParentId

func (m *Machine) ParentId() (string, bool)

ParentId returns the Id of the host machine if this machine is a container.

func (*Machine) PasswordValid

func (m *Machine) PasswordValid(password string) bool

PasswordValid returns whether the given password is valid for the given machine.

func (*Machine) Refresh

func (m *Machine) Refresh() error

Refresh refreshes the contents of the machine from the underlying state. It returns an error that satisfies IsNotFound if the machine has been removed.

func (*Machine) Remove

func (m *Machine) Remove() (err error)

Remove removes the machine from state. It will fail if the machine is not Dead.

func (*Machine) Series

func (m *Machine) Series() string

Series returns the operating system series running on the machine.

func (*Machine) SetAgentAlive

func (m *Machine) SetAgentAlive() (*presence.Pinger, error)

SetAgentAlive signals that the agent for machine m is alive. It returns the started pinger.

func (*Machine) SetAgentTools

func (m *Machine) SetAgentTools(t *Tools) (err error)

SetAgentTools sets the tools that the agent is currently running.

func (*Machine) SetAnnotations

func (a *Machine) SetAnnotations(pairs map[string]string) (err error)

SetAnnotations adds key/value pairs to annotations in MongoDB.

func (*Machine) SetConstraints

func (m *Machine) SetConstraints(cons constraints.Value) (err error)

SetConstraints sets the exact constraints to apply when provisioning an instance for the machine. It will fail if the machine is Dead, or if it is already provisioned.

func (*Machine) SetMongoPassword

func (m *Machine) SetMongoPassword(password string) error

SetMongoPassword sets the password the agent responsible for the machine should use to communicate with the state servers. Previous passwords are invalidated.

func (*Machine) SetPassword

func (m *Machine) SetPassword(password string) error

SetPassword sets the password for the machine's agent.

func (*Machine) SetProvisioned

func (m *Machine) SetProvisioned(id instance.Id, nonce string, characteristics *instance.HardwareCharacteristics) (err error)

SetProvisioned sets the provider specific machine id, nonce and also metadata for this machine. Once set, the instance id cannot be changed.

func (*Machine) SetStatus

func (m *Machine) SetStatus(status params.Status, info string) error

SetStatus sets the status of the machine.

func (*Machine) Status

func (m *Machine) Status() (status params.Status, info string, err error)

Status returns the status of the machine.

func (*Machine) String

func (m *Machine) String() string

String returns a unique description of this machine.

func (*Machine) Tag

func (m *Machine) Tag() string

Tag returns a name identifying the machine that is safe to use as a file name. The returned name will be different from other Tag values returned by any other entities from the same state.

func (*Machine) Units

func (m *Machine) Units() (units []*Unit, err error)

Units returns all the units that have been assigned to the machine.

func (*Machine) WaitAgentAlive

func (m *Machine) WaitAgentAlive(timeout time.Duration) (err error)

WaitAgentAlive blocks until the respective agent is alive.

func (*Machine) Watch

func (m *Machine) Watch() NotifyWatcher

Watch returns a watcher for observing changes to a machine.

func (*Machine) WatchContainers

func (m *Machine) WatchContainers(ctype instance.ContainerType) StringsWatcher

WatchContainers returns a StringsWatcher that notifies of changes to the lifecycles of containers on a machine.

func (*Machine) WatchHardwareCharacteristics

func (m *Machine) WatchHardwareCharacteristics() NotifyWatcher

WatchHardwareCharacteristics returns a watcher for observing changes to a machine's hardware characteristics.

func (*Machine) WatchPrincipalUnits

func (m *Machine) WatchPrincipalUnits() StringsWatcher

WatchPrincipalUnits returns a StringsWatcher tracking the machine's principal units.

func (*Machine) WatchUnits

func (m *Machine) WatchUnits() StringsWatcher

WatchUnits returns a new StringsWatcher watching m's units.

type MachineJob

type MachineJob int

MachineJob values define responsibilities that machines may be expected to fulfil.

const (
	JobHostUnits MachineJob
	JobManageEnviron
	JobManageState
)

func (MachineJob) String

func (job MachineJob) String() string

type NotAssignedError

type NotAssignedError struct{ Unit *Unit }

NotAssignedError indicates that a unit is not assigned to a machine (and, in the case of subordinate units, that the unit's principal is not assigned).

func (*NotAssignedError) Error

func (e *NotAssignedError) Error() string

type NotProvisionedError

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

NotProvisionedError records an error when a machine is not provisioned.

func (*NotProvisionedError) Error

func (e *NotProvisionedError) Error() string

type NotifyWatcher

type NotifyWatcher interface {
	Stop() error
	Err() error
	Changes() <-chan struct{}
}

NotifyWatcher generates signals when something changes, but it does not return any content for those changes

type Relation

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

Relation represents a relation between one or two service endpoints.

func (*Relation) Destroy

func (r *Relation) Destroy() (err error)

Destroy ensures that the relation will be removed at some point; if no units are currently in scope, it will be removed immediately.

func (*Relation) Endpoint

func (r *Relation) Endpoint(serviceName string) (Endpoint, error)

Endpoint returns the endpoint of the relation for the named service. If the service is not part of the relation, an error will be returned.

func (*Relation) Id

func (r *Relation) Id() int

Id returns the integer internal relation key. This is exposed because the unit agent needs to expose a value derived from this (as JUJU_RELATION_ID) to allow relation hooks to differentiate between relations with different services.

func (*Relation) Life

func (r *Relation) Life() Life

Life returns the relation's current life state.

func (*Relation) Refresh

func (r *Relation) Refresh() error

Refresh refreshes the contents of the relation from the underlying state. It returns an error that satisfies IsNotFound if the relation has been removed.

func (*Relation) RelatedEndpoints

func (r *Relation) RelatedEndpoints(serviceName string) ([]Endpoint, error)

RelatedEndpoints returns the endpoints of the relation r with which units of the named service will establish relations. If the service is not part of the relation r, an error will be returned.

func (*Relation) String

func (r *Relation) String() string

func (*Relation) Unit

func (r *Relation) Unit(u *Unit) (*RelationUnit, error)

Unit returns a RelationUnit for the supplied unit.

type RelationScopeChange

type RelationScopeChange struct {
	Entered []string
	Left    []string
}

RelationScopeChange contains information about units that have entered or left a particular scope.

type RelationScopeWatcher

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

RelationScopeWatcher observes changes to the set of units in a particular relation scope.

func (*RelationScopeWatcher) Changes

func (w *RelationScopeWatcher) Changes() <-chan *RelationScopeChange

Changes returns a channel that will receive changes when units enter and leave a relation scope. The Entered field in the first event on the channel holds the initial state.

func (*RelationScopeWatcher) Err

func (w *RelationScopeWatcher) Err() error

Err returns any error encountered while running or shutting down, or tomb.ErrStillAlive if the watcher is still running.

func (*RelationScopeWatcher) Stop

func (w *RelationScopeWatcher) Stop() error

Stop stops the watcher, and returns any error encountered while running or shutting down.

type RelationUnit

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

RelationUnit holds information about a single unit in a relation, and allows clients to conveniently access unit-specific functionality.

func (*RelationUnit) Endpoint

func (ru *RelationUnit) Endpoint() Endpoint

Endpoint returns the relation endpoint that defines the unit's participation in the relation.

func (*RelationUnit) EnterScope

func (ru *RelationUnit) EnterScope(settings map[string]interface{}) error

EnterScope ensures that the unit has entered its scope in the relation. When the unit has already entered its relation scope, EnterScope will report success but make no changes to state.

Otherwise, assuming both the relation and the unit are alive, it will enter scope and create or overwrite the unit's settings in the relation according to the supplied map.

If the unit is a principal and the relation has container scope, EnterScope will also create the required subordinate unit, if it does not already exist; this is because there's no point having a principal in scope if there is no corresponding subordinate to join it.

Once a unit has entered a scope, it stays in scope without further intervention; the relation will not be able to become Dead until all units have departed its scopes.

func (*RelationUnit) LeaveScope

func (ru *RelationUnit) LeaveScope() error

LeaveScope signals that the unit has left its scope in the relation. After the unit has left its relation scope, it is no longer a member of the relation; if the relation is dying when its last member unit leaves, it is removed immediately. It is not an error to leave a scope that the unit is not, or never was, a member of.

func (*RelationUnit) PrivateAddress

func (ru *RelationUnit) PrivateAddress() (string, bool)

PrivateAddress returns the private address of the unit and whether it is valid.

func (*RelationUnit) ReadSettings

func (ru *RelationUnit) ReadSettings(uname string) (m map[string]interface{}, err error)

ReadSettings returns a map holding the settings of the unit with the supplied name within this relation. An error will be returned if the relation no longer exists, or if the unit's service is not part of the relation, or the settings are invalid; but mere non-existence of the unit is not grounds for an error, because the unit settings are guaranteed to persist for the lifetime of the relation, regardless of the lifetime of the unit.

func (*RelationUnit) Relation

func (ru *RelationUnit) Relation() *Relation

Relation returns the relation associated with the unit.

func (*RelationUnit) Settings

func (ru *RelationUnit) Settings() (*Settings, error)

Settings returns a Settings which allows access to the unit's settings within the relation.

func (*RelationUnit) Watch

func (ru *RelationUnit) Watch() *RelationUnitsWatcher

Watch returns a watcher that notifies of changes to conterpart units in the relation.

func (*RelationUnit) WatchScope

func (ru *RelationUnit) WatchScope() *RelationScopeWatcher

WatchScope returns a watcher which notifies of counterpart units entering and leaving the unit's scope.

type RelationUnitsChange

type RelationUnitsChange struct {
	Joined   []string
	Changed  map[string]UnitSettings
	Departed []string
}

RelationUnitsChange holds notifications of units entering and leaving the scope of a RelationUnit, and changes to the settings of those units known to have entered.

When a counterpart first enters scope, it is/ noted in the Joined field, and its settings are noted in the Changed field. Subsequently, settings changes will be noted in the Changed field alone, until the couterpart leaves the scope; at that point, it will be noted in the Departed field, and no further events will be sent for that counterpart unit.

type RelationUnitsWatcher

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

RelationUnitsWatcher sends notifications of units entering and leaving the scope of a RelationUnit, and changes to the settings of those units known to have entered.

func (*RelationUnitsWatcher) Changes

func (w *RelationUnitsWatcher) Changes() <-chan RelationUnitsChange

Changes returns a channel that will receive the changes to counterpart units in a relation. The first event on the channel holds the initial state of the relation in its Joined and Changed fields.

func (*RelationUnitsWatcher) Err

func (w *RelationUnitsWatcher) Err() error

Err returns any error encountered while running or shutting down, or tomb.ErrStillAlive if the watcher is still running.

func (*RelationUnitsWatcher) Stop

func (w *RelationUnitsWatcher) Stop() error

Stop stops the watcher, and returns any error encountered while running or shutting down.

type Remover

type Remover interface {
	Tagger
	EnsureDead() error
	Remove() error
}

Remover represents entities with EnsureDead and Remove methods.

type ResolvedMode

type ResolvedMode string

ResolvedMode describes the way state transition errors are resolved.

const (
	ResolvedNone       ResolvedMode = ""
	ResolvedRetryHooks ResolvedMode = "retry-hooks"
	ResolvedNoHooks    ResolvedMode = "no-hooks"
)

type Service

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

Service represents the state of a service.

func (*Service) AddUnit

func (s *Service) AddUnit() (unit *Unit, err error)

AddUnit adds a new principal unit to the service.

func (*Service) AllUnits

func (s *Service) AllUnits() (units []*Unit, err error)

AllUnits returns all units of the service.

func (*Service) Annotation

func (a *Service) Annotation(key string) (string, error)

Annotation returns the annotation value corresponding to the given key. If the requested annotation is not found, an empty string is returned.

func (*Service) Annotations

func (a *Service) Annotations() (map[string]string, error)

Annotations returns all the annotations corresponding to an entity.

func (*Service) Charm

func (s *Service) Charm() (ch *Charm, force bool, err error)

Charm returns the service's charm and whether units should upgrade to that charm even if they are in an error state.

func (*Service) CharmURL

func (s *Service) CharmURL() (curl *charm.URL, force bool)

CharmURL returns the service's charm URL, and whether units should upgrade to the charm with that URL even if they are in an error state.

func (*Service) ClearExposed

func (s *Service) ClearExposed() error

ClearExposed removes the exposed flag from the service. See SetExposed and IsExposed.

func (*Service) ConfigSettings

func (s *Service) ConfigSettings() (charm.Settings, error)

ConfigSettings returns the raw user configuration for the service's charm. Unset values are omitted.

func (*Service) Constraints

func (s *Service) Constraints() (constraints.Value, error)

Constraints returns the current service constraints.

func (*Service) Destroy

func (s *Service) Destroy() (err error)

Destroy ensures that the service and all its relations will be removed at some point; if the service has no units, and no relation involving the service has any units in scope, they are all removed immediately.

func (*Service) Endpoint

func (s *Service) Endpoint(relationName string) (Endpoint, error)

Endpoint returns the relation endpoint with the supplied name, if it exists.

func (*Service) Endpoints

func (s *Service) Endpoints() (eps []Endpoint, err error)

Endpoints returns the service's currently available relation endpoints.

func (*Service) IsExposed

func (s *Service) IsExposed() bool

IsExposed returns whether this service is exposed. The explicitly open ports (with open-port) for exposed services may be accessed from machines outside of the local deployment network. See SetExposed and ClearExposed.

func (*Service) IsPrincipal

func (s *Service) IsPrincipal() bool

IsPrincipal returns whether units of the service can have subordinate units.

func (*Service) Life

func (s *Service) Life() Life

Life returns whether the service is Alive, Dying or Dead.

func (*Service) MinUnits

func (s *Service) MinUnits() int

MinUnits returns the minimum units count for the service.

func (*Service) Name

func (s *Service) Name() string

Name returns the service name.

func (*Service) Refresh

func (s *Service) Refresh() error

Refresh refreshes the contents of the Service from the underlying state. It returns an error that satisfies IsNotFound if the service has been removed.

func (*Service) Relations

func (s *Service) Relations() (relations []*Relation, err error)

Relations returns a Relation for every relation the service is in.

func (*Service) SetAnnotations

func (a *Service) SetAnnotations(pairs map[string]string) (err error)

SetAnnotations adds key/value pairs to annotations in MongoDB.

func (*Service) SetCharm

func (s *Service) SetCharm(ch *Charm, force bool) (err error)

SetCharm changes the charm for the service. New units will be started with this charm, and existing units will be upgraded to use it. If force is true, units will be upgraded even if they are in an error state.

func (*Service) SetConstraints

func (s *Service) SetConstraints(cons constraints.Value) (err error)

SetConstraints replaces the current service constraints.

func (*Service) SetExposed

func (s *Service) SetExposed() error

SetExposed marks the service as exposed. See ClearExposed and IsExposed.

func (*Service) SetMinUnits

func (s *Service) SetMinUnits(minUnits int) (err error)

SetMinUnits changes the number of minimum units required by the service.

func (*Service) String

func (s *Service) String() string

String returns the service name.

func (*Service) Tag

func (s *Service) Tag() string

Tag returns a name identifying the service that is safe to use as a file name. The returned name will be different from other Tag values returned by any other entities from the same state.

func (*Service) Unit

func (s *Service) Unit(name string) (*Unit, error)

Unit returns the service's unit with name.

func (*Service) UpdateConfigSettings

func (s *Service) UpdateConfigSettings(changes charm.Settings) error

UpdateConfigSettings changes a service's charm config settings. Values set to nil will be deleted; unknown and invalid values will return an error.

func (*Service) Watch

func (s *Service) Watch() NotifyWatcher

Watch returns a watcher for observing changes to a service.

func (*Service) WatchRelations

func (s *Service) WatchRelations() StringsWatcher

WatchRelations returns a StringsWatcher that notifies of changes to the lifecycles of relations involving s.

func (*Service) WatchUnits

func (s *Service) WatchUnits() StringsWatcher

WatchUnits returns a StringsWatcher that notifies of changes to the lifecycles of units of s.

type Settings

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

A Settings manages changes to settings as a delta in memory and merges them back in the database when explicitly requested.

func (*Settings) Delete

func (c *Settings) Delete(key string)

Delete removes key.

func (*Settings) Get

func (c *Settings) Get(key string) (value interface{}, found bool)

Get returns the value of key and whether it was found.

func (*Settings) Keys

func (c *Settings) Keys() []string

Keys returns the current keys in alphabetical order.

func (*Settings) Map

func (c *Settings) Map() map[string]interface{}

Map returns all keys and values of the node.

func (*Settings) Read

func (c *Settings) Read() error

Read (re)reads the node data into c.

func (*Settings) Set

func (c *Settings) Set(key string, value interface{})

Set sets key to value

func (*Settings) Update

func (c *Settings) Update(kv map[string]interface{})

Update sets multiple key/value pairs.

func (*Settings) Write

func (c *Settings) Write() ([]ItemChange, error)

Write writes changes made to c back onto its node. Changes are written as a delta applied on top of the latest version of the node, to prevent overwriting unrelated changes made to the node since it was last read.

type State

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

State represents the state of an environment managed by juju.

func Initialize

func Initialize(info *Info, cfg *config.Config, opts DialOpts) (rst *State, err error)

Initialize sets up an initial empty state and returns it. This needs to be performed only once for a given environment. It returns unauthorizedError if access is unauthorized.

func Open

func Open(info *Info, opts DialOpts) (*State, error)

Open connects to the server described by the given info, waits for it to be initialized, and returns a new State representing the environment connected to. It returns unauthorizedError if access is unauthorized.

func (*State) APIAddresses

func (st *State) APIAddresses() ([]string, error)

APIAddresses returns the list of addresses used to connect to the API.

func (*State) AddCharm

func (st *State) AddCharm(ch charm.Charm, curl *charm.URL, bundleURL *url.URL, bundleSha256 string) (stch *Charm, err error)

AddCharm adds the ch charm with curl to the state. bundleUrl must be set to a URL where the bundle for ch may be downloaded from. On success the newly added charm state is returned.

func (*State) AddMachine

func (st *State) AddMachine(series string, jobs ...MachineJob) (m *Machine, err error)

AddMachine adds a new machine configured to run the supplied jobs on the supplied series. The machine's constraints will be taken from the environment constraints.

func (*State) AddMachineWithConstraints

func (st *State) AddMachineWithConstraints(params *AddMachineParams) (m *Machine, err error)

AddMachineWithConstraints adds a new machine configured to run the supplied jobs on the supplied series. The machine's constraints and other configuration will be taken from the supplied params struct.

func (*State) AddRelation

func (st *State) AddRelation(eps ...Endpoint) (r *Relation, err error)

AddRelation creates a new relation with the given endpoints.

func (*State) AddService

func (st *State) AddService(name string, ch *Charm) (service *Service, err error)

AddService creates a new service, running the supplied charm, with the supplied name (which must be unique). If the charm defines peer relations, they will be created automatically.

func (*State) AddUser

func (st *State) AddUser(name, password string) (*User, error)

AddUser adds a user to the state.

func (*State) Addresses

func (st *State) Addresses() ([]string, error)

Addresses returns the list of addresses used to connect to the state.

func (*State) AllMachines

func (st *State) AllMachines() (machines []*Machine, err error)

AllMachines returns all machines in the environment ordered by id.

func (*State) AllServices

func (st *State) AllServices() (services []*Service, err error)

AllServices returns all deployed services in the environment.

func (*State) Annotator

func (st *State) Annotator(tag string) (TaggedAnnotator, error)

Annotator attempts to return aa TaggedAnnotator with the given tag.

func (*State) AssignUnit

func (st *State) AssignUnit(u *Unit, policy AssignmentPolicy) (err error)

AssignUnit places the unit on a machine. Depending on the policy, and the state of the environment, this may lead to new instances being launched within the environment.

func (*State) Authenticator

func (st *State) Authenticator(tag string) (TaggedAuthenticator, error)

Authenticator attempts to return a TaggedAuthenticator with the given tag.

func (*State) CACert

func (st *State) CACert() (cert []byte)

CACert returns the certificate used to validate the state connection.

func (*State) Charm

func (st *State) Charm(curl *charm.URL) (*Charm, error)

Charm returns the charm with the given URL.

func (*State) Cleanup

func (st *State) Cleanup() error

Cleanup removes all documents that were previously marked for removal, if any such exist. It should be called periodically by at least one element of the system.

func (*State) Close

func (st *State) Close() error

func (*State) DestroyMachines

func (st *State) DestroyMachines(ids ...string) (err error)

DestroyMachines destroys the machines with the specified ids.

func (*State) DestroyUnits

func (st *State) DestroyUnits(names ...string) (err error)

DestroyUnits destroys the units with the specified names.

func (*State) EndpointsRelation

func (st *State) EndpointsRelation(endpoints ...Endpoint) (*Relation, error)

EndpointsRelation returns the existing relation with the given endpoints.

func (*State) EnvironConfig

func (st *State) EnvironConfig() (*config.Config, error)

func (*State) EnvironConstraints

func (st *State) EnvironConstraints() (constraints.Value, error)

EnvironConstraints returns the current environment constraints.

func (*State) Environment

func (st *State) Environment() (*Environment, error)

Environment returns the environment entity.

func (*State) InferEndpoints

func (st *State) InferEndpoints(names []string) ([]Endpoint, error)

InferEndpoints returns the endpoints corresponding to the supplied names. There must be 1 or 2 supplied names, of the form <service>[:<relation>]. If the supplied names uniquely specify a possible relation, or if they uniquely specify a possible relation once all implicit relations have been filtered, the endpoints corresponding to that relation will be returned.

func (*State) InjectMachine

func (st *State) InjectMachine(series string, cons constraints.Value, instanceId instance.Id, jobs ...MachineJob) (m *Machine, err error)

InjectMachine adds a new machine, corresponding to an existing provider instance, configured to run the supplied jobs on the supplied series, using the specified constraints.

func (*State) KeyRelation

func (st *State) KeyRelation(key string) (*Relation, error)

KeyRelation returns the existing relation with the given key (which can be derived unambiguously from the relation's endpoints).

func (*State) Lifer

func (st *State) Lifer(tag string) (Lifer, error)

Lifer attempts to return a Lifer with the given tag.

func (*State) Machine

func (st *State) Machine(id string) (*Machine, error)

Machine returns the machine with the given id.

func (*State) NeedsCleanup

func (st *State) NeedsCleanup() (bool, error)

NeedsCleanup returns true if documents previously marked for removal exist.

func (*State) ParseTag

func (st *State) ParseTag(tag string) (string, string, error)

ParseTag, given an entity tag, returns the collection name and id of the entity document.

func (*State) Relation

func (st *State) Relation(id int) (*Relation, error)

Relation returns the existing relation with the given id.

func (*State) ResumeTransactions

func (st *State) ResumeTransactions() error

ResumeTransactions resumes all pending transactions.

func (*State) Service

func (st *State) Service(name string) (service *Service, err error)

Service returns a service state by name.

func (*State) SetAdminMongoPassword

func (st *State) SetAdminMongoPassword(password string) error

SetAdminMongoPassword sets the administrative password to access the state. If the password is non-empty, all subsequent attempts to access the state must be authorized; otherwise no authorization is required.

func (*State) SetEnvironConfig

func (st *State) SetEnvironConfig(cfg *config.Config) error

SetEnvironConfig replaces the current configuration of the environment with the provided configuration.

func (*State) SetEnvironConstraints

func (st *State) SetEnvironConstraints(cons constraints.Value) error

SetEnvironConstraints replaces the current environment constraints.

func (*State) StartSync

func (st *State) StartSync()

StartSync forces watchers to resynchronize their state with the database immediately. This will happen periodically automatically.

func (*State) Sync

func (st *State) Sync()

Sync forces watchers to resynchronize their state with the database immediately, and waits until all events are known.

func (*State) Unit

func (st *State) Unit(name string) (*Unit, error)

Unit returns a unit by name.

func (*State) User

func (st *State) User(name string) (*User, error)

User returns the state user for the given name,

func (*State) Watch

func (st *State) Watch() *multiwatcher.Watcher

func (*State) WatchCleanups

func (st *State) WatchCleanups() NotifyWatcher

WatchCleanups starts and returns a CleanupWatcher.

func (*State) WatchEnvironConfig

func (s *State) WatchEnvironConfig() *EnvironConfigWatcher

WatchEnvironConfig returns a watcher for observing changes to the environment configuration.

func (*State) WatchEnvironMachines

func (st *State) WatchEnvironMachines() StringsWatcher

WatchEnvironMachines returns a StringsWatcher that notifies of changes to the lifecycles of the machines (but not containers) in the environment.

func (*State) WatchForEnvironConfigChanges

func (st *State) WatchForEnvironConfigChanges() NotifyWatcher

WatchForEnvironConfigChanges return a NotifyWatcher waiting for the Environ Config to change. This differs from WatchEnvironConfig in that the watcher is a NotifyWatcher that does not give content during Changes()

func (*State) WatchMinUnits

func (st *State) WatchMinUnits() StringsWatcher

func (*State) WatchServices

func (st *State) WatchServices() StringsWatcher

WatchServices returns a StringsWatcher that notifies of changes to the lifecycles of the services in the environment.

type StringsWatcher

type StringsWatcher interface {
	Stop() error
	Err() error
	Changes() <-chan []string
}

StringsWatcher generates signals when something changes, returning the changes as a list of strings.

type TaggedAnnotator

type TaggedAnnotator interface {
	Annotator
	Tagger
}

TaggedAnnotator represents tagged entities capable of handling annotations.

type TaggedAuthenticator

type TaggedAuthenticator interface {
	Authenticator
	Tagger
}

TaggedAuthenticator represents tagged entities capable of authentication.

type Tagger

type Tagger interface {
	Tag() string
}

Tagger represents entities with a tag.

type Tools

type Tools struct {
	version.Binary
	URL string
}

Tools describes a particular set of juju tools and where to find them.

func (*Tools) GetBSON

func (t *Tools) GetBSON() (interface{}, error)

func (*Tools) SetBSON

func (t *Tools) SetBSON(raw bson.Raw) error

type Unit

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

Unit represents the state of a service unit.

func (*Unit) AgentAlive

func (u *Unit) AgentAlive() (bool, error)

AgentAlive returns whether the respective remote agent is alive.

func (*Unit) AgentTools

func (u *Unit) AgentTools() (*Tools, error)

AgentTools returns the tools that the agent is currently running. It an error that satisfies IsNotFound if the tools have not yet been set.

func (*Unit) Annotation

func (a *Unit) Annotation(key string) (string, error)

Annotation returns the annotation value corresponding to the given key. If the requested annotation is not found, an empty string is returned.

func (*Unit) Annotations

func (a *Unit) Annotations() (map[string]string, error)

Annotations returns all the annotations corresponding to an entity.

func (*Unit) AssignToCleanEmptyMachine

func (u *Unit) AssignToCleanEmptyMachine() (m *Machine, err error)

AssignToCleanMachine assigns u to a machine which is marked as clean and is also not hosting any containers. A machine is clean if it has never had any principal units assigned to it. If there are no clean machines besides any machine(s) running JobHostEnviron, an error is returned. This method does not take constraints into consideration when choosing a machine (lp:1161919).

func (*Unit) AssignToCleanMachine

func (u *Unit) AssignToCleanMachine() (m *Machine, err error)

AssignToCleanMachine assigns u to a machine which is marked as clean. A machine is clean if it has never had any principal units assigned to it. If there are no clean machines besides any machine(s) running JobHostEnviron, an error is returned. This method does not take constraints into consideration when choosing a machine (lp:1161919).

func (*Unit) AssignToMachine

func (u *Unit) AssignToMachine(m *Machine) (err error)

AssignToMachine assigns this unit to a given machine.

func (*Unit) AssignToNewMachine

func (u *Unit) AssignToNewMachine() (err error)

AssignToNewMachine assigns the unit to a new machine, with constraints determined according to the service and environment constraints at the time of unit creation.

func (*Unit) AssignedMachineId

func (u *Unit) AssignedMachineId() (id string, err error)

AssignedMachineId returns the id of the assigned machine.

func (*Unit) CharmURL

func (u *Unit) CharmURL() (*charm.URL, bool)

CharmURL returns the charm URL this unit is currently using.

func (*Unit) ClearResolved

func (u *Unit) ClearResolved() error

ClearResolved removes any resolved setting on the unit.

func (*Unit) ClosePort

func (u *Unit) ClosePort(protocol string, number int) (err error)

ClosePort sets the policy of the port with protocol and number to be closed.

func (*Unit) ConfigSettings

func (u *Unit) ConfigSettings() (charm.Settings, error)

ConfigSettings returns the complete set of service charm config settings available to the unit. Unset values will be replaced with the default value for the associated option, and may thus be nil when no default is specified.

func (*Unit) DeployerTag

func (u *Unit) DeployerTag() (string, bool)

DeployerTag returns the tag of the agent responsible for deploying the unit. If no such entity can be determined, false is returned.

func (*Unit) Destroy

func (u *Unit) Destroy() (err error)

Destroy, when called on a Alive unit, advances its lifecycle as far as possible; it otherwise has no effect. In most situations, the unit's life is just set to Dying; but if a principal unit that is not assigned to a provisioned machine is Destroyed, it will be removed from state directly.

func (*Unit) EnsureDead

func (u *Unit) EnsureDead() (err error)

EnsureDead sets the unit lifecycle to Dead if it is Alive or Dying. It does nothing otherwise. If the unit has subordinates, it will return ErrUnitHasSubordinates.

func (*Unit) IsPrincipal

func (u *Unit) IsPrincipal() bool

IsPrincipal returns whether the unit is deployed in its own container, and can therefore have subordinate services deployed alongside it.

func (*Unit) Life

func (u *Unit) Life() Life

Life returns whether the unit is Alive, Dying or Dead.

func (*Unit) Name

func (u *Unit) Name() string

Name returns the unit name.

func (*Unit) OpenPort

func (u *Unit) OpenPort(protocol string, number int) (err error)

OpenPort sets the policy of the port with protocol and number to be opened.

func (*Unit) OpenedPorts

func (u *Unit) OpenedPorts() []instance.Port

OpenedPorts returns a slice containing the open ports of the unit.

func (*Unit) PasswordValid

func (u *Unit) PasswordValid(password string) bool

PasswordValid returns whether the given password is valid for the given unit.

func (*Unit) PrivateAddress

func (u *Unit) PrivateAddress() (string, bool)

PrivateAddress returns the private address of the unit and whether it is valid.

func (*Unit) PublicAddress

func (u *Unit) PublicAddress() (string, bool)

PublicAddress returns the public address of the unit and whether it is valid.

func (*Unit) Refresh

func (u *Unit) Refresh() error

Refresh refreshes the contents of the Unit from the underlying state. It an error that satisfies IsNotFound if the unit has been removed.

func (*Unit) Remove

func (u *Unit) Remove() (err error)

Remove removes the unit from state, and may remove its service as well, if the service is Dying and no other references to it exist. It will fail if the unit is not Dead.

func (*Unit) Resolve

func (u *Unit) Resolve(retryHooks bool) error

Resolve marks the unit as having had any previous state transition problems resolved, and informs the unit that it may attempt to reestablish normal workflow. The retryHooks parameter informs whether to attempt to reexecute previous failed hooks or to continue as if they had succeeded before.

func (*Unit) Resolved

func (u *Unit) Resolved() ResolvedMode

Resolved returns the resolved mode for the unit.

func (*Unit) Service

func (u *Unit) Service() (*Service, error)

Service returns the service.

func (*Unit) ServiceName

func (u *Unit) ServiceName() string

ServiceName returns the service name.

func (*Unit) SetAgentAlive

func (u *Unit) SetAgentAlive() (*presence.Pinger, error)

SetAgentAlive signals that the agent for unit u is alive. It returns the started pinger.

func (*Unit) SetAgentTools

func (u *Unit) SetAgentTools(t *Tools) (err error)

SetAgentTools sets the tools that the agent is currently running.

func (*Unit) SetAnnotations

func (a *Unit) SetAnnotations(pairs map[string]string) (err error)

SetAnnotations adds key/value pairs to annotations in MongoDB.

func (*Unit) SetCharmURL

func (u *Unit) SetCharmURL(curl *charm.URL) (err error)

SetCharmURL marks the unit as currently using the supplied charm URL. An error will be returned if the unit is dead, or the charm URL not known.

func (*Unit) SetMongoPassword

func (u *Unit) SetMongoPassword(password string) error

SetMongoPassword sets the password the agent responsible for the unit should use to communicate with the state servers. Previous passwords are invalidated.

func (*Unit) SetPassword

func (u *Unit) SetPassword(password string) error

SetPassword sets the password for the machine's agent.

func (*Unit) SetPrivateAddress

func (u *Unit) SetPrivateAddress(address string) error

SetPrivateAddress sets the private address of the unit.

func (*Unit) SetPublicAddress

func (u *Unit) SetPublicAddress(address string) (err error)

SetPublicAddress sets the public address of the unit.

func (*Unit) SetResolved

func (u *Unit) SetResolved(mode ResolvedMode) (err error)

SetResolved marks the unit as having had any previous state transition problems resolved, and informs the unit that it may attempt to reestablish normal workflow. The resolved mode parameter informs whether to attempt to reexecute previous failed hooks or to continue as if they had succeeded before.

func (*Unit) SetStatus

func (u *Unit) SetStatus(status params.Status, info string) error

SetStatus sets the status of the unit.

func (*Unit) Status

func (u *Unit) Status() (status params.Status, info string, err error)

Status returns the status of the unit's agent.

func (*Unit) String

func (u *Unit) String() string

String returns the unit as string.

func (*Unit) SubordinateNames

func (u *Unit) SubordinateNames() []string

SubordinateNames returns the names of any subordinate units.

func (*Unit) Tag

func (u *Unit) Tag() string

Tag returns a name identifying the unit that is safe to use as a file name. The returned name will be different from other Tag values returned by any other entities from the same state.

func (*Unit) UnassignFromMachine

func (u *Unit) UnassignFromMachine() (err error)

UnassignFromMachine removes the assignment between this unit and the machine it's assigned to.

func (*Unit) WaitAgentAlive

func (u *Unit) WaitAgentAlive(timeout time.Duration) (err error)

WaitAgentAlive blocks until the respective agent is alive.

func (*Unit) Watch

func (u *Unit) Watch() NotifyWatcher

Watch returns a watcher for observing changes to a unit.

func (*Unit) WatchConfigSettings

func (u *Unit) WatchConfigSettings() (NotifyWatcher, error)

WatchConfigSettings returns a watcher for observing changes to the unit's service configuration settings. The unit must have a charm URL set before this method is called, and the returned watcher will be valid only while the unit's charm URL is not changed. TODO(fwereade): this could be much smarter; if it were, uniter.Filter could be somewhat simpler.

func (*Unit) WatchSubordinateUnits

func (u *Unit) WatchSubordinateUnits() StringsWatcher

WatchSubordinateUnits returns a StringsWatcher tracking the unit's subordinate units.

type UnitSettings

type UnitSettings struct {
	Version  int64
	Settings map[string]interface{}
}

UnitSettings holds information about a service unit's settings within a relation.

type User

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

User represents a juju client user.

func (*User) Name

func (u *User) Name() string

Name returns the user name,

func (*User) PasswordValid

func (u *User) PasswordValid(password string) bool

PasswordValid returns whether the given password is valid for the user.

func (*User) Refresh

func (u *User) Refresh() error

Refresh refreshes information about the user from the state.

func (*User) SetPassword

func (u *User) SetPassword(password string) error

SetPassword sets the password associated with the user.

func (*User) SetPasswordHash

func (u *User) SetPasswordHash(pwHash string) error

SetPasswordHash sets the password to the inverse of utils.PasswordHash(pwHash). It can be used when we know only the hash of the password, but not the clear text.

func (*User) Tag

func (u *User) Tag() string

Tag returns the Tag for the user ("user-$username")

Directories

Path Synopsis
api
machine
The machine package implements the API interfaces used by the machine agent.
The machine package implements the API interfaces used by the machine agent.
The presence package implements an interface for observing liveness of arbitrary keys (agents, processes, etc) on top of MongoDB.
The presence package implements an interface for observing liveness of arbitrary keys (agents, processes, etc) on top of MongoDB.
The statecmd package is a temporary package to put code that's used by both cmd/juju and state/api.
The statecmd package is a temporary package to put code that's used by both cmd/juju and state/api.
The watcher package provides an interface for observing changes to arbitrary MongoDB documents that are maintained via the mgo/txn transaction package.
The watcher package provides an interface for observing changes to arbitrary MongoDB documents that are maintained via the mgo/txn transaction package.

Jump to

Keyboard shortcuts

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