diff options
author | Valery Piashchynski <[email protected]> | 2020-12-21 14:27:27 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-21 14:27:27 +0300 |
commit | 0ad45031047bb479e06ce0a0f496c6db9b2641c9 (patch) | |
tree | 26f4b6e453739bc8e0e4fe26f05b899f5d3a5cce | |
parent | 8543980775e5f8b12e5e200a0764052cdb4350a5 (diff) | |
parent | 960395df42b379c55c095dbed2378bfe20869c83 (diff) |
Merge pull request #459 from spiral/plugin/redisv2.0.0-alpha26
plugin/redis [reopen]
-rwxr-xr-x | go.sum | 1 | ||||
-rw-r--r-- | plugins/checker/plugin.go | 4 | ||||
-rwxr-xr-x | plugins/config/tests/plugin1.go | 6 | ||||
-rw-r--r-- | plugins/headers/plugin.go | 4 | ||||
-rw-r--r-- | plugins/http/plugin.go | 6 | ||||
-rw-r--r-- | plugins/http/tests/plugin1.go | 6 | ||||
-rw-r--r-- | plugins/http/tests/plugin_middleware.go | 10 | ||||
-rw-r--r-- | plugins/informer/tests/test_plugin.go | 6 | ||||
-rw-r--r-- | plugins/logger/plugin.go | 4 | ||||
-rw-r--r-- | plugins/logger/tests/plugin.go | 6 | ||||
-rw-r--r-- | plugins/metrics/plugin.go | 4 | ||||
-rw-r--r-- | plugins/metrics/tests/plugin1.go | 6 | ||||
-rw-r--r-- | plugins/reload/plugin.go | 4 | ||||
-rw-r--r-- | plugins/resetter/tests/test_plugin.go | 6 | ||||
-rw-r--r-- | plugins/rpc/tests/plugin1.go | 6 | ||||
-rw-r--r-- | plugins/server/plugin.go | 4 | ||||
-rw-r--r-- | plugins/server/tests/plugin_pipes.go | 6 | ||||
-rw-r--r-- | plugins/server/tests/plugin_sockets.go | 6 | ||||
-rw-r--r-- | plugins/server/tests/plugin_tcp.go | 6 | ||||
-rw-r--r-- | plugins/static/plugin.go | 4 |
20 files changed, 52 insertions, 53 deletions
@@ -31,7 +31,6 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI= github.com/alicebob/miniredis/v2 v2.14.1 h1:GjlbSeoJ24bzdLRs13HoMEeaRZx9kg5nHoRW7QV/nCs= github.com/alicebob/miniredis/v2 v2.14.1/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wXxSpQUE9EaJ/Blg= github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4= diff --git a/plugins/checker/plugin.go b/plugins/checker/plugin.go index e3e7834a..7aea33b7 100644 --- a/plugins/checker/plugin.go +++ b/plugins/checker/plugin.go @@ -9,7 +9,7 @@ import ( "github.com/gofiber/fiber/v2/middleware/logger" "github.com/spiral/endure" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/log" "github.com/spiral/roadrunner/v2/interfaces/status" ) @@ -26,7 +26,7 @@ type Plugin struct { cfg *Config } -func (c *Plugin) Init(log log.Logger, cfg config2.Configurer) error { +func (c *Plugin) Init(log log.Logger, cfg config.Configurer) error { const op = errors.Op("status plugin init") err := cfg.UnmarshalKey(PluginName, &c.cfg) if err != nil { diff --git a/plugins/config/tests/plugin1.go b/plugins/config/tests/plugin1.go index 7b5d6bd8..724afbd4 100755 --- a/plugins/config/tests/plugin1.go +++ b/plugins/config/tests/plugin1.go @@ -4,7 +4,7 @@ import ( "errors" "time" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" ) // ReloadConfig is a Reload configuration point. @@ -23,11 +23,11 @@ type ServiceConfig struct { } type Foo struct { - configProvider config2.Configurer + configProvider config.Configurer } // Depends on S2 and DB (S3 in the current case) -func (f *Foo) Init(p config2.Configurer) error { +func (f *Foo) Init(p config.Configurer) error { f.configProvider = p return nil } diff --git a/plugins/headers/plugin.go b/plugins/headers/plugin.go index e16f6187..5913da00 100644 --- a/plugins/headers/plugin.go +++ b/plugins/headers/plugin.go @@ -5,7 +5,7 @@ import ( "strconv" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" ) // ID contains default service name. @@ -20,7 +20,7 @@ type Plugin struct { // Init must return configure service and return true if service hasStatus enabled. Must return error in case of // misconfiguration. Services must not be used without proper configuration pushed first. -func (s *Plugin) Init(cfg config2.Configurer) error { +func (s *Plugin) Init(cfg config.Configurer) error { const op = errors.Op("headers plugin init") err := cfg.UnmarshalKey(RootPluginName, &s.cfg) if err != nil { diff --git a/plugins/http/plugin.go b/plugins/http/plugin.go index a883735a..9729a355 100644 --- a/plugins/http/plugin.go +++ b/plugins/http/plugin.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-multierror" "github.com/spiral/endure" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/events" "github.com/spiral/roadrunner/v2/interfaces/log" "github.com/spiral/roadrunner/v2/interfaces/pool" @@ -49,7 +49,7 @@ type middleware map[string]Middleware type Plugin struct { sync.Mutex - configurer config2.Configurer + configurer config.Configurer server server.Server log log.Logger @@ -80,7 +80,7 @@ func (s *Plugin) AddListener(listener events.EventListener) { // Init must return configure svc and return true if svc hasStatus enabled. Must return error in case of // misconfiguration. Services must not be used without proper configuration pushed first. -func (s *Plugin) Init(cfg config2.Configurer, log log.Logger, server server.Server) error { +func (s *Plugin) Init(cfg config.Configurer, log log.Logger, server server.Server) error { const op = errors.Op("http Init") err := cfg.UnmarshalKey(PluginName, &s.cfg) if err != nil { diff --git a/plugins/http/tests/plugin1.go b/plugins/http/tests/plugin1.go index 7d1f32a1..7e5c03da 100644 --- a/plugins/http/tests/plugin1.go +++ b/plugins/http/tests/plugin1.go @@ -1,14 +1,14 @@ package tests import ( - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" ) type Plugin1 struct { - config config2.Configurer + config config.Configurer } -func (p1 *Plugin1) Init(cfg config2.Configurer) error { +func (p1 *Plugin1) Init(cfg config.Configurer) error { p1.config = cfg return nil } diff --git a/plugins/http/tests/plugin_middleware.go b/plugins/http/tests/plugin_middleware.go index 224d4117..9003c0ad 100644 --- a/plugins/http/tests/plugin_middleware.go +++ b/plugins/http/tests/plugin_middleware.go @@ -3,14 +3,14 @@ package tests import ( "net/http" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" ) type PluginMiddleware struct { - config config2.Configurer + config config.Configurer } -func (p *PluginMiddleware) Init(cfg config2.Configurer) error { +func (p *PluginMiddleware) Init(cfg config.Configurer) error { p.config = cfg return nil } @@ -34,10 +34,10 @@ func (p *PluginMiddleware) Name() string { } type PluginMiddleware2 struct { - config config2.Configurer + config config.Configurer } -func (p *PluginMiddleware2) Init(cfg config2.Configurer) error { +func (p *PluginMiddleware2) Init(cfg config.Configurer) error { p.config = cfg return nil } diff --git a/plugins/informer/tests/test_plugin.go b/plugins/informer/tests/test_plugin.go index 80627801..31643952 100644 --- a/plugins/informer/tests/test_plugin.go +++ b/plugins/informer/tests/test_plugin.go @@ -4,7 +4,7 @@ import ( "context" "time" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/server" "github.com/spiral/roadrunner/v2/interfaces/worker" poolImpl "github.com/spiral/roadrunner/v2/pkg/pool" @@ -26,11 +26,11 @@ var testPoolConfig = poolImpl.Config{ // Gauge ////////////// type Plugin1 struct { - config config2.Configurer + config config.Configurer server server.Server } -func (p1 *Plugin1) Init(cfg config2.Configurer, server server.Server) error { +func (p1 *Plugin1) Init(cfg config.Configurer, server server.Server) error { p1.config = cfg p1.server = server return nil diff --git a/plugins/logger/plugin.go b/plugins/logger/plugin.go index ec58b7d6..cdd67482 100644 --- a/plugins/logger/plugin.go +++ b/plugins/logger/plugin.go @@ -2,7 +2,7 @@ package logger import ( "github.com/spiral/endure" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/log" "go.uber.org/zap" ) @@ -18,7 +18,7 @@ type ZapLogger struct { } // Init logger service. -func (z *ZapLogger) Init(cfg config2.Configurer) error { +func (z *ZapLogger) Init(cfg config.Configurer) error { err := cfg.UnmarshalKey(PluginName, &z.cfg) if err != nil { return err diff --git a/plugins/logger/tests/plugin.go b/plugins/logger/tests/plugin.go index 4095e59d..37c5c5f2 100644 --- a/plugins/logger/tests/plugin.go +++ b/plugins/logger/tests/plugin.go @@ -2,16 +2,16 @@ package tests import ( "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/log" ) type Plugin struct { - config config2.Configurer + config config.Configurer log log.Logger } -func (p1 *Plugin) Init(cfg config2.Configurer, log log.Logger) error { +func (p1 *Plugin) Init(cfg config.Configurer, log log.Logger) error { p1.config = cfg p1.log = log return nil diff --git a/plugins/metrics/plugin.go b/plugins/metrics/plugin.go index 956166ee..1f3ca005 100644 --- a/plugins/metrics/plugin.go +++ b/plugins/metrics/plugin.go @@ -11,7 +11,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/spiral/endure" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/log" "github.com/spiral/roadrunner/v2/interfaces/metrics" "golang.org/x/sys/cpu" @@ -40,7 +40,7 @@ type Plugin struct { } // Init service. -func (m *Plugin) Init(cfg config2.Configurer, log log.Logger) error { +func (m *Plugin) Init(cfg config.Configurer, log log.Logger) error { const op = errors.Op("Metrics Init") err := cfg.UnmarshalKey(PluginName, &m.cfg) if err != nil { diff --git a/plugins/metrics/tests/plugin1.go b/plugins/metrics/tests/plugin1.go index 08dd2593..7a5e5e6c 100644 --- a/plugins/metrics/tests/plugin1.go +++ b/plugins/metrics/tests/plugin1.go @@ -2,15 +2,15 @@ package tests import ( "github.com/prometheus/client_golang/prometheus" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" ) // Gauge ////////////// type Plugin1 struct { - config config2.Configurer + config config.Configurer } -func (p1 *Plugin1) Init(cfg config2.Configurer) error { +func (p1 *Plugin1) Init(cfg config.Configurer) error { p1.config = cfg return nil } diff --git a/plugins/reload/plugin.go b/plugins/reload/plugin.go index 233c83a4..dce9502c 100644 --- a/plugins/reload/plugin.go +++ b/plugins/reload/plugin.go @@ -6,7 +6,7 @@ import ( "time" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/log" "github.com/spiral/roadrunner/v2/interfaces/resetter" ) @@ -25,7 +25,7 @@ type Plugin struct { } // Init controller service -func (s *Plugin) Init(cfg config2.Configurer, log log.Logger, res resetter.Resetter) error { +func (s *Plugin) Init(cfg config.Configurer, log log.Logger, res resetter.Resetter) error { const op = errors.Op("reload plugin init") s.cfg = &Config{} InitDefaults(s.cfg) diff --git a/plugins/resetter/tests/test_plugin.go b/plugins/resetter/tests/test_plugin.go index f1c09caf..af96508a 100644 --- a/plugins/resetter/tests/test_plugin.go +++ b/plugins/resetter/tests/test_plugin.go @@ -4,7 +4,7 @@ import ( "context" "time" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/server" poolImpl "github.com/spiral/roadrunner/v2/pkg/pool" ) @@ -25,11 +25,11 @@ var testPoolConfig = poolImpl.Config{ // Gauge ////////////// type Plugin1 struct { - config config2.Configurer + config config.Configurer server server.Server } -func (p1 *Plugin1) Init(cfg config2.Configurer, server server.Server) error { +func (p1 *Plugin1) Init(cfg config.Configurer, server server.Server) error { p1.config = cfg p1.server = server return nil diff --git a/plugins/rpc/tests/plugin1.go b/plugins/rpc/tests/plugin1.go index dcb256fa..797f821a 100644 --- a/plugins/rpc/tests/plugin1.go +++ b/plugins/rpc/tests/plugin1.go @@ -3,14 +3,14 @@ package tests import ( "fmt" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" ) type Plugin1 struct { - config config2.Configurer + config config.Configurer } -func (p1 *Plugin1) Init(cfg config2.Configurer) error { +func (p1 *Plugin1) Init(cfg config.Configurer) error { p1.config = cfg return nil } diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go index 580c1e10..9f3921e9 100644 --- a/plugins/server/plugin.go +++ b/plugins/server/plugin.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/events" "github.com/spiral/roadrunner/v2/interfaces/log" "github.com/spiral/roadrunner/v2/interfaces/pool" @@ -30,7 +30,7 @@ type Plugin struct { } // Init application provider. -func (server *Plugin) Init(cfg config2.Configurer, log log.Logger) error { +func (server *Plugin) Init(cfg config.Configurer, log log.Logger) error { const op = errors.Op("Init") err := cfg.UnmarshalKey(PluginName, &server.cfg) if err != nil { diff --git a/plugins/server/tests/plugin_pipes.go b/plugins/server/tests/plugin_pipes.go index f49cf6dc..9a7d3e3b 100644 --- a/plugins/server/tests/plugin_pipes.go +++ b/plugins/server/tests/plugin_pipes.go @@ -5,7 +5,7 @@ import ( "time" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/pool" "github.com/spiral/roadrunner/v2/interfaces/server" "github.com/spiral/roadrunner/v2/pkg/payload" @@ -32,12 +32,12 @@ var testPoolConfig = poolImpl.Config{ } type Foo struct { - configProvider config2.Configurer + configProvider config.Configurer wf server.Server pool pool.Pool } -func (f *Foo) Init(p config2.Configurer, workerFactory server.Server) error { +func (f *Foo) Init(p config.Configurer, workerFactory server.Server) error { f.configProvider = p f.wf = workerFactory return nil diff --git a/plugins/server/tests/plugin_sockets.go b/plugins/server/tests/plugin_sockets.go index ee971e45..c62871b1 100644 --- a/plugins/server/tests/plugin_sockets.go +++ b/plugins/server/tests/plugin_sockets.go @@ -4,7 +4,7 @@ import ( "context" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/pool" "github.com/spiral/roadrunner/v2/interfaces/server" "github.com/spiral/roadrunner/v2/pkg/payload" @@ -13,12 +13,12 @@ import ( ) type Foo2 struct { - configProvider config2.Configurer + configProvider config.Configurer wf server.Server pool pool.Pool } -func (f *Foo2) Init(p config2.Configurer, workerFactory server.Server) error { +func (f *Foo2) Init(p config.Configurer, workerFactory server.Server) error { f.configProvider = p f.wf = workerFactory return nil diff --git a/plugins/server/tests/plugin_tcp.go b/plugins/server/tests/plugin_tcp.go index cdf23e21..781b87d0 100644 --- a/plugins/server/tests/plugin_tcp.go +++ b/plugins/server/tests/plugin_tcp.go @@ -4,7 +4,7 @@ import ( "context" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/pool" "github.com/spiral/roadrunner/v2/interfaces/server" "github.com/spiral/roadrunner/v2/pkg/payload" @@ -13,12 +13,12 @@ import ( ) type Foo3 struct { - configProvider config2.Configurer + configProvider config.Configurer wf server.Server pool pool.Pool } -func (f *Foo3) Init(p config2.Configurer, workerFactory server.Server) error { +func (f *Foo3) Init(p config.Configurer, workerFactory server.Server) error { f.configProvider = p f.wf = workerFactory return nil diff --git a/plugins/static/plugin.go b/plugins/static/plugin.go index fd8d0a9c..d12f84a0 100644 --- a/plugins/static/plugin.go +++ b/plugins/static/plugin.go @@ -5,7 +5,7 @@ import ( "path" "github.com/spiral/errors" - config2 "github.com/spiral/roadrunner/v2/interfaces/config" + "github.com/spiral/roadrunner/v2/interfaces/config" "github.com/spiral/roadrunner/v2/interfaces/log" ) @@ -27,7 +27,7 @@ type Plugin struct { // Init must return configure service and return true if service hasStatus enabled. Must return error in case of // misconfiguration. Services must not be used without proper configuration pushed first. -func (s *Plugin) Init(cfg config2.Configurer, log log.Logger) error { +func (s *Plugin) Init(cfg config.Configurer, log log.Logger) error { const op = errors.Op("static plugin init") err := cfg.UnmarshalKey(RootPluginName, &s.cfg) if err != nil { |