diff options
author | Valery Piashchynski <[email protected]> | 2021-05-27 00:09:33 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-05-27 00:09:33 +0300 |
commit | dc3c5455e5c9b32737a0620c8bdb8bda0226dba7 (patch) | |
tree | 6ba562da6de7f32a8d528b72cbb56a8bc98c1b30 /plugins/broadcast/interface.go | |
parent | d2e9d8320857f5768c54843a43ad16f59d6a3e8f (diff) |
- Update all main abstractions
- Desighn a new interfaces responsible for the whole PubSub
- New plugin - websockets
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/broadcast/interface.go')
-rw-r--r-- | plugins/broadcast/interface.go | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/plugins/broadcast/interface.go b/plugins/broadcast/interface.go deleted file mode 100644 index 47c779b5..00000000 --- a/plugins/broadcast/interface.go +++ /dev/null @@ -1,41 +0,0 @@ -package broadcast - -import ( - "encoding/json" -) - -// Subscriber defines the ability to operate as message passing broker. -type Subscriber interface { - // Subscribe broker to one or multiple topics. - Subscribe(topics ...string) error - // UnsubscribePattern broker from pattern. - UnsubscribePattern(pattern string) error -} - -// Storage used to store patterns and topics -type Storage interface { - // 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 { - // Publish one or multiple Channel. - Publish(messages ...*Message) error -} - -// Message represent single message. -type Message struct { - // Topic message been pushed into. - Topic string `json:"topic"` - - // Payload to be broadcasted. Must be valid json when transferred over RPC. - Payload json.RawMessage `json:"payload"` -} |