diff options
Diffstat (limited to 'plugins/channel/plugin.go')
-rw-r--r-- | plugins/channel/plugin.go | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/plugins/channel/plugin.go b/plugins/channel/plugin.go deleted file mode 100644 index 362dbc07..00000000 --- a/plugins/channel/plugin.go +++ /dev/null @@ -1,59 +0,0 @@ -package channel - -import ( - "sync" -) - -const ( - PluginName string = "hub" -) - -type Plugin struct { - sync.Mutex - fromCh chan interface{} - toCh chan interface{} -} - -func (p *Plugin) Init() error { - p.Lock() - defer p.Unlock() - - p.fromCh = make(chan interface{}) - p.toCh = make(chan interface{}) - return nil -} - -func (p *Plugin) Serve() chan error { - return make(chan error) -} - -func (p *Plugin) Stop() error { - // read from the channels on stop to prevent blocking - go func() { - for range p.fromCh { - } - }() - go func() { - for range p.toCh { - } - }() - return nil -} - -func (p *Plugin) FromWorker() chan interface{} { - p.Lock() - defer p.Unlock() - // one-directional queue - return p.fromCh -} - -func (p *Plugin) ToWorker() chan interface{} { - p.Lock() - defer p.Unlock() - // one-directional queue - return p.toCh -} - -func (p *Plugin) Name() string { - return PluginName -} |