diff options
author | Valery Piashchynski <[email protected]> | 2021-05-31 16:05:00 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-05-31 16:05:00 +0300 |
commit | 49703d70a3ede70ce9a0cab824cbcb96dbf824c0 (patch) | |
tree | 181d72a3321d52c960a519ba3a233e3e7fe8e86a /plugins/channel/plugin.go | |
parent | 0ee91dc24d3e68706d89092c06b1c0d09dab0353 (diff) |
- Rework access_validators
- WS plugin uses it's own pool to handle requests on the /ws (or any
user-defined) endpoint
- Ability to write custom validators
Signed-off-by: Valery Piashchynski <[email protected]>
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 -} |