Documentation ¶
Index ¶
- type Constructor
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerID() string
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) GetPeer(ctx context.Context) (peer.Peer, error)
- func (c *Controller) GetPubSub(ctx context.Context) (pubsub.PubSub, error)
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constructor ¶
type Constructor func( ctx context.Context, le *logrus.Entry, peer peer.Peer, handler pubsub.PubSubHandler, ) (pubsub.PubSub, error)
Constructor constructs a PubSub with common parameters.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements a common PubSub controller. The controller monitors active links, and pushes peer ID <-> link UUID tuples to the router. It handles PubSub event callbacks and PubSub related directives, yielding PubSub client handles and managing active topics.
func NewController ¶
func NewController( le *logrus.Entry, bus bus.Bus, controllerInfo *controller.Info, peerID peer.ID, protocolID protocol.ID, ctor Constructor, ) *Controller
NewController constructs a new transport controller.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close releases any resources used by the controller. Error indicates any issue encountered releasing.
func (*Controller) Execute ¶
func (c *Controller) Execute(ctx context.Context) error
Execute executes the transport controller and the transport. Returning nil ends execution. Returning an error triggers a retry with backoff.
func (*Controller) GetControllerID ¶
func (c *Controller) GetControllerID() string
GetControllerID returns the controller ID.
func (*Controller) GetControllerInfo ¶
func (c *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil. Any unexpected errors are returned for logging. It is safe to add a reference to the directive during this call.