summaryrefslogtreecommitdiff
path: root/plugins/broadcast/plugin.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-05-20 22:46:19 +0300
committerValery Piashchynski <[email protected]>2021-05-20 22:46:19 +0300
commitd2e9d8320857f5768c54843a43ad16f59d6a3e8f (patch)
treef6f46e688b6005b2b0ea10c7238e925c0b58f25a /plugins/broadcast/plugin.go
parentf85172106b4723b705aa75c3c310e8cebd050a8d (diff)
- Update linters
- Implement base interfaces - Implement BST search algo for the in-memory storage Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/broadcast/plugin.go')
-rw-r--r--plugins/broadcast/plugin.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/broadcast/plugin.go b/plugins/broadcast/plugin.go
index 7ad9e2ae..156bea80 100644
--- a/plugins/broadcast/plugin.go
+++ b/plugins/broadcast/plugin.go
@@ -47,6 +47,12 @@ func (p *Plugin) Serve() chan error {
return errCh
}
+ if p.driver == nil {
+ // Or if no storage detected, use in-memory storage
+ errCh <- errors.E(op, errors.Str("no storage detected"))
+ return errCh
+ }
+
// start the underlying broker
go func() {
// err := p.broker.Serve()
@@ -72,12 +78,16 @@ func (p *Plugin) Name() string {
func (p *Plugin) Collects() []interface{} {
return []interface{}{
- p.CollectBroker,
+ p.CollectSubscriber,
}
}
-func (p *Plugin) CollectBroker(name endure.Named, broker Subscriber) {
- p.broker = broker
+func (p *Plugin) CollectSubscriber(name endure.Named, subscriber Subscriber) {
+ p.broker = subscriber
+}
+
+func (p *Plugin) CollectStorage(name endure.Named, storage Storage) {
+ p.driver = storage
}
func (p *Plugin) RPC() interface{} {