summaryrefslogtreecommitdiff
path: root/plugins/broadcast/interface.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/broadcast/interface.go')
-rw-r--r--plugins/broadcast/interface.go28
1 files changed, 16 insertions, 12 deletions
diff --git a/plugins/broadcast/interface.go b/plugins/broadcast/interface.go
index 3ed8b412..47c779b5 100644
--- a/plugins/broadcast/interface.go
+++ b/plugins/broadcast/interface.go
@@ -1,25 +1,29 @@
package broadcast
-import "encoding/json"
+import (
+ "encoding/json"
+)
// Subscriber defines the ability to operate as message passing broker.
type Subscriber interface {
// Subscribe broker to one or multiple topics.
- Subscribe(upstream chan *Message, topics ...string) error
-
- // SubscribePattern broker to pattern.
- SubscribePattern(upstream chan *Message, pattern string) error
-
- // Unsubscribe broker from one or multiple topics.
- Unsubscribe(upstream chan *Message, topics ...string) error
-
+ Subscribe(topics ...string) error
// UnsubscribePattern broker from pattern.
- UnsubscribePattern(upstream chan *Message, pattern string) error
+ UnsubscribePattern(pattern string) error
}
+// Storage used to store patterns and topics
type Storage interface {
- Store(topics ...string)
- StorePattern(pattern string)
+ // Store connection uuid associated with the provided topics
+ Store(uuid string, topics ...string)
+ // StorePattern stores pattern associated with the particular connection
+ StorePattern(uuid string, pattern string)
+
+ // GetConnection returns connections for the particular pattern
+ GetConnection(pattern string) []string
+
+ // Construct is a constructor for the storage according to the provided configuration key (broadcast.websocket for example)
+ Construct(key string) (Storage, error)
}
type Publisher interface {