summaryrefslogtreecommitdiff
path: root/plugins/boltdb/plugin.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-09-01 13:19:09 +0300
committerValery Piashchynski <[email protected]>2021-09-01 13:19:09 +0300
commit9c8da162b3347b632f33f85d56e8c1ff7014631a (patch)
treebb614a186e05adf816b3f2b62e2d25bfa821a574 /plugins/boltdb/plugin.go
parent0437d1f58514f694ea86e8176e621c009cd510f9 (diff)
Code polishing before release
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/boltdb/plugin.go')
-rw-r--r--plugins/boltdb/plugin.go24
1 files changed, 5 insertions, 19 deletions
diff --git a/plugins/boltdb/plugin.go b/plugins/boltdb/plugin.go
index 683b26f1..ad98cf3c 100644
--- a/plugins/boltdb/plugin.go
+++ b/plugins/boltdb/plugin.go
@@ -19,19 +19,14 @@ const (
// Plugin BoltDB K/V storage.
type Plugin struct {
- cfgPlugin config.Configurer
+ cfg config.Configurer
// logger
log logger.Logger
- // stop is used to stop keys GC and close boltdb connection
- stop chan struct{}
-
- drivers uint
}
func (p *Plugin) Init(log logger.Logger, cfg config.Configurer) error {
- p.stop = make(chan struct{})
p.log = log
- p.cfgPlugin = cfg
+ p.cfg = cfg
return nil
}
@@ -41,12 +36,6 @@ func (p *Plugin) Serve() chan error {
}
func (p *Plugin) Stop() error {
- if p.drivers > 0 {
- for i := uint(0); i < p.drivers; i++ {
- // send close signal to every driver
- p.stop <- struct{}{}
- }
- }
return nil
}
@@ -60,23 +49,20 @@ func (p *Plugin) Available() {}
func (p *Plugin) KVConstruct(key string) (kv.Storage, error) {
const op = errors.Op("boltdb_plugin_provide")
- st, err := boltkv.NewBoltDBDriver(p.log, key, p.cfgPlugin, p.stop)
+ st, err := boltkv.NewBoltDBDriver(p.log, key, p.cfg)
if err != nil {
return nil, errors.E(op, err)
}
- // save driver number to release resources after Stop
- p.drivers++
-
return st, nil
}
// JOBS bbolt implementation
func (p *Plugin) JobsConstruct(configKey string, e events.Handler, queue priorityqueue.Queue) (jobs.Consumer, error) {
- return boltjobs.NewBoltDBJobs(configKey, p.log, p.cfgPlugin, e, queue)
+ return boltjobs.NewBoltDBJobs(configKey, p.log, p.cfg, e, queue)
}
func (p *Plugin) FromPipeline(pipe *pipeline.Pipeline, e events.Handler, queue priorityqueue.Queue) (jobs.Consumer, error) {
- return boltjobs.FromPipeline(pipe, p.log, p.cfgPlugin, e, queue)
+ return boltjobs.FromPipeline(pipe, p.log, p.cfg, e, queue)
}