summaryrefslogtreecommitdiff
path: root/plugins/channel/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/channel/plugin.go')
-rw-r--r--plugins/channel/plugin.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/plugins/channel/plugin.go b/plugins/channel/plugin.go
new file mode 100644
index 00000000..8901c42e
--- /dev/null
+++ b/plugins/channel/plugin.go
@@ -0,0 +1,52 @@
+package channel
+
+import (
+ "sync"
+)
+
+const (
+ PluginName string = "hub"
+)
+
+type Plugin struct {
+ sync.Mutex
+ send chan interface{}
+ receive chan interface{}
+}
+
+func (p *Plugin) Init() error {
+ p.Lock()
+ defer p.Unlock()
+ p.send = make(chan interface{})
+ p.receive = make(chan interface{})
+ return nil
+}
+
+func (p *Plugin) Serve() chan error {
+ return make(chan error)
+}
+
+func (p *Plugin) Stop() error {
+ close(p.receive)
+ return nil
+}
+
+func (p *Plugin) SendCh() chan interface{} {
+ p.Lock()
+ defer p.Unlock()
+ // bi-directional queue
+ return p.send
+}
+
+func (p *Plugin) ReceiveCh() chan interface{} {
+ p.Lock()
+ defer p.Unlock()
+ // bi-directional queue
+ return p.receive
+}
+
+func (p *Plugin) Available() {}
+
+func (p *Plugin) Name() string {
+ return PluginName
+}