Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold packages a Worker for use in a dependency.Engine.
Types ¶
type Config ¶
type Config struct { ModelUUID string RelationsFacade RemoteRelationsFacade NewRemoteModelFacadeFunc newRemoteRelationsFacadeFunc Clock clock.Clock }
Config defines the operation of a Worker.
type ManifoldConfig ¶
type ManifoldConfig struct { AgentName string APICallerName string NewControllerConnection apicaller.NewExternalControllerConnectionFunc NewRemoteRelationsFacade func(base.APICaller) (RemoteRelationsFacade, error) NewWorker func(Config) (worker.Worker, error) }
ManifoldConfig defines the names of the manifolds on which a Worker manifold will depend.
func (ManifoldConfig) Validate ¶
func (config ManifoldConfig) Validate() error
Validate is called by start to check for bad configuration.
type RemoteModelRelationsFacade ¶
type RemoteModelRelationsFacade interface { // RegisterRemoteRelations sets up the remote model to participate // in the specified relations. RegisterRemoteRelations(relations ...params.RegisterRemoteRelationArg) ([]params.RegisterRemoteRelationResult, error) // PublishRelationChange publishes relation changes to the // model hosting the remote application involved in the relation. PublishRelationChange(params.RemoteRelationChangeEvent) error // WatchRelationUnits returns a watcher that notifies of changes to the // units in the remote model for the relation with the given remote token. WatchRelationUnits(arg params.RemoteEntityArg) (watcher.RelationUnitsWatcher, error) // RelationUnitSettings returns the relation unit settings for the given relation units in the remote model. RelationUnitSettings([]params.RemoteRelationUnit) ([]params.SettingsResult, error) // WatchRelationSuspendedStatus starts a RelationStatusWatcher for watching the // relations of each specified application in the remote model. WatchRelationSuspendedStatus(arg params.RemoteEntityArg) (watcher.RelationStatusWatcher, error) // WatchOfferStatus starts an OfferStatusWatcher for watching the status // of the specified offer in the remote model. WatchOfferStatus(arg params.OfferArg) (watcher.OfferStatusWatcher, error) }
RemoteModelRelationsFacade instances publish local relation changes to the model hosting the remote application involved in the relation, and also watches for remote relation changes which are then pushed to the local model.
func NewRemoteModelRelationsFacade ¶
func NewRemoteModelRelationsFacade(apiCaller base.APICallCloser) (RemoteModelRelationsFacade, error)
type RemoteModelRelationsFacadeCloser ¶
type RemoteModelRelationsFacadeCloser interface { io.Closer RemoteModelRelationsFacade }
RemoteModelRelationsFacadeCloser implements RemoteModelRelationsFacade and add a Close() method.
type RemoteRelationsFacade ¶
type RemoteRelationsFacade interface { // ImportRemoteEntity adds an entity to the remote entities collection // with the specified opaque token. ImportRemoteEntity(entity names.Tag, token string) error // SaveMacaroon saves the macaroon for the entity. SaveMacaroon(entity names.Tag, mac *macaroon.Macaroon) error // ExportEntities allocates unique, remote entity IDs for the // given entities in the local model. ExportEntities([]names.Tag) ([]params.TokenResult, error) // GetToken returns the token associated with the entity with the given tag. GetToken(names.Tag) (string, error) // RelationUnitSettings returns the relation unit settings for the // given relation units in the local model. RelationUnitSettings([]params.RelationUnit) ([]params.SettingsResult, error) // Relations returns information about the relations // with the specified keys in the local model. Relations(keys []string) ([]params.RemoteRelationResult, error) // RemoteApplications returns the current state of the remote applications with // the specified names in the local model. RemoteApplications(names []string) ([]params.RemoteApplicationResult, error) // WatchLocalRelationUnits returns a watcher that notifies of changes to the // local units in the relation with the given key. WatchLocalRelationUnits(relationKey string) (watcher.RelationUnitsWatcher, error) // WatchRemoteApplications watches for addition, removal and lifecycle // changes to remote applications known to the local model. WatchRemoteApplications() (watcher.StringsWatcher, error) // WatchRemoteApplicationRelations starts a StringsWatcher for watching the relations of // each specified application in the local model, and returns the watcher IDs // and initial values, or an error if the application's relations could not be // watched. WatchRemoteApplicationRelations(application string) (watcher.StringsWatcher, error) // ConsumeRemoteRelationChange consumes a change to settings originating // from the remote/offering side of a relation. ConsumeRemoteRelationChange(change params.RemoteRelationChangeEvent) error // ControllerAPIInfoForModel returns the controller api info for a model. ControllerAPIInfoForModel(modelUUID string) (*api.Info, error) // SetRemoteApplicationStatus sets the status for the specified remote application. SetRemoteApplicationStatus(applicationName string, status status.Status, message string) error }
RemoteRelationsFacade exposes remote relation functionality to a worker.
func NewRemoteRelationsFacade ¶
func NewRemoteRelationsFacade(apiCaller base.APICaller) (RemoteRelationsFacade, error)
Click to show internal directories.
Click to hide internal directories.