juju: github.com/wallyworld/juju/worker/pubsub Index | Files

package pubsub

import "github.com/wallyworld/juju/worker/pubsub"


Package Files

manifold.go messagewriter.go remoteserver.go reporter.go subscriber.go

func Manifold Uses

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 Uses

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

NewWorker exposes the subscriber as a Worker.

type Logger Uses

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 Uses

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 Uses

type MessageWriter interface {
    // ForwardMessage forwards the given message to the server.
    ForwardMessage(*params.PubSubMessage) error

MessageWriter defines the two methods called for message forwarding.

func NewMessageWriter Uses

func NewMessageWriter(info *api.Info) (MessageWriter, error)

NewMessageWriter will connect to the remote defined by the info, and return a MessageWriter.

type RemoteServer Uses

type RemoteServer interface {
    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 Uses

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 Uses

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 Uses

type Reporter interface {
    Report() map[string]interface{}
    IntrospectionReport() string

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 Uses

func NewReporter() Reporter

NewReporter returns a reporter for the pubsub forwarding worker.

type WorkerConfig Uses

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 Uses

func (c *WorkerConfig) Validate() error

Validate checks that all the values have been set.

Package pubsub imports 22 packages (graph). Updated 2020-08-11. Refresh now. Tools for package owners.