remoterelations

package
v0.0.0-...-a0d7459 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: AGPL-3.0 Imports: 15 Imported by: 0

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.

func NewWorker

func NewWorker(config Config) (worker.Worker, error)

Types

type Config

type Config struct {
	ModelUUID                string
	RelationsFacade          RemoteRelationsFacade
	NewPublisherForModelFunc func(modelUUID string) (RemoteRelationChangePublisherCloser, error)
}

Config defines the operation of a Worker.

func (Config) Validate

func (config Config) Validate() error

Validate returns an error if config cannot drive a Worker.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName     string
	APICallerName string

	NewAPIConnForModel       api.NewConnectionForModelFunc
	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 RemoteRelationChangePublisher

type RemoteRelationChangePublisher interface {
	// RegisterRemoteRelation sets up the local model to participate
	// in the specified relations.
	RegisterRemoteRelations(relations ...params.RegisterRemoteRelation) ([]params.RemoteEntityIdResult, error)

	// PublishLocalRelationChange publishes local relation changes to the
	// model hosting the remote application involved in the relation.
	PublishLocalRelationChange(params.RemoteRelationChangeEvent) error
}

RemoteRelationChangePublisher instances publish local relation changes to the model hosting the remote application involved in the relation

type RemoteRelationChangePublisherCloser

type RemoteRelationChangePublisherCloser interface {
	io.Closer
	RemoteRelationChangePublisher
}

RemoteRelationChangePublisherCloser implements RemoteRelationChangePublisher and add a Close() method.

type RemoteRelationsFacade

type RemoteRelationsFacade interface {
	RemoteRelationChangePublisher

	// ImportRemoteEntity adds an entity to the remote entities collection
	// with the specified opaque token.
	ImportRemoteEntity(sourceModelUUID string, entity names.Tag, token string) error

	// ExportEntities allocates unique, remote entity IDs for the
	// given entities in the local model.
	ExportEntities([]names.Tag) ([]params.RemoteEntityIdResult, error)

	// GetToken returns the token associated with the entity with the given tag
	// for the specified model.
	GetToken(string, names.Tag) (string, error)

	// RemoveRemoteEntity removes the specified entity from the remote entities collection.
	RemoveRemoteEntity(sourceModelUUID string, entity names.Tag) 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 environment, and returns the watcher IDs
	// and initial values, or an error if the applications' relations could not be
	// watched.
	WatchRemoteApplicationRelations(application string) (watcher.StringsWatcher, error)
}

RemoteRelationsFacade exposes remote relation functionality to a worker.

func NewRemoteRelationsFacade

func NewRemoteRelationsFacade(apiCaller base.APICaller) (RemoteRelationsFacade, error)

type Worker

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

Worker manages relations and associated settings where one end of the relation is a remote application.

func New

func New(config Config) (*Worker, error)

New returns a Worker backed by config, or an error.

func (*Worker) Kill

func (w *Worker) Kill()

Kill is defined on worker.Worker.

func (*Worker) Wait

func (w *Worker) Wait() error

Wait is defined on worker.Worker.

Jump to

Keyboard shortcuts

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