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.
Types ¶
type Logger ¶
type Logger interface {
Errorf(message string, args ...interface{})
Infof(message string, args ...interface{})
Debugf(message string, args ...interface{})
Tracef(message string, args ...interface{})
}
Logger represents the logging methods called.
type ManifoldConfig ¶
type ManifoldConfig struct {
AgentName string
CentralHubName string
Clock clock.Clock
Reporter Reporter
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 ¶
func NewMessageWriter(info *api.Info) (MessageWriter, error)
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
// APIInfo is initially populated with the addresses of the target machine.
APIInfo *api.Info
NewWriter func(*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
APIInfo *api.Info
NewWriter func(*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.