Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold returns a dependency manifold that runs a pubsub worker, using the resource names defined in the supplied config.
func NewWorker ¶
func NewWorker(config WorkerConfig) (worker.Worker, error)
NewWorker exposes the subscriber as a Worker.
Types ¶
type ManifoldConfig ¶
type ManifoldConfig struct { AgentName string CentralHubName string Clock clock.Clock Reporter Reporter Logger logger.Logger NewWorker func(WorkerConfig) (worker.Worker, error) }
ManifoldConfig defines the names of the manifolds on which a Manifold will depend.
type MessageWriter ¶
type MessageWriter interface { // ForwardMessage forwards the given message to the server. ForwardMessage(*params.PubSubMessage) error Close() }
MessageWriter defines the two methods called for message forwarding.
func NewMessageWriter ¶
NewMessageWriter will connect to the remote defined by the info, and return a MessageWriter.
type RemoteServer ¶
type RemoteServer interface { worker.Worker Reporter UpdateAddresses(addresses []string) Publish(message *params.PubSubMessage) }
RemoteServer represents the public interface of the worker responsible for forwarding messages to a single other API server.
func NewRemoteServer ¶
func NewRemoteServer(config RemoteServerConfig) (RemoteServer, error)
NewRemoteServer creates a new RemoteServer that will connect to the remote apiserver and pass on messages to the pubsub endpoint of that apiserver.
type RemoteServerConfig ¶
type RemoteServerConfig struct { // Hub is used to publish connection messages Hub *pubsub.StructuredHub Origin string Target string Clock clock.Clock Logger logger.Logger // APIInfo is initially populated with the addresses of the target machine. APIInfo *api.Info NewWriter func(context.Context, *api.Info) (MessageWriter, error) }
RemoteServerConfig defines all the attributes that are needed for a RemoteServer.
type Reporter ¶
Reporter gives visibility for the introspection worker into the internals of the pubsub forwarding worker. Also defines the Report method used by the engine report.
func NewReporter ¶
func NewReporter() Reporter
NewReporter returns a reporter for the pubsub forwarding worker.
type WorkerConfig ¶
type WorkerConfig struct { Origin string Clock clock.Clock Hub *pubsub.StructuredHub Logger logger.Logger APIInfo *api.Info NewWriter func(context.Context, *api.Info) (MessageWriter, error) NewRemote func(RemoteServerConfig) (RemoteServer, error) }
WorkerConfig defines the configuration values that the pubsub worker needs to operate.
func (*WorkerConfig) Validate ¶
func (c *WorkerConfig) Validate() error
Validate checks that all the values have been set.