summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml2
-rwxr-xr-xMakefile1
-rwxr-xr-xgo.mod1
-rwxr-xr-xinterfaces/config/interface.go (renamed from plugins/config/configurer.go)0
-rw-r--r--interfaces/redis/interface.go10
-rwxr-xr-xpkg/worker/worker.go25
-rwxr-xr-xpkg/worker_watcher/worker_watcher.go11
-rw-r--r--plugins/checker/plugin.go4
-rwxr-xr-xplugins/config/tests/plugin1.go6
-rw-r--r--plugins/headers/plugin.go4
-rw-r--r--plugins/http/plugin.go6
-rw-r--r--plugins/http/tests/plugin1.go8
-rw-r--r--plugins/http/tests/plugin_middleware.go10
-rw-r--r--plugins/informer/tests/test_plugin.go6
-rw-r--r--plugins/logger/plugin.go4
-rw-r--r--plugins/logger/tests/plugin.go6
-rw-r--r--plugins/metrics/plugin.go4
-rw-r--r--plugins/metrics/tests/plugin1.go6
-rw-r--r--plugins/redis/config.go18
-rw-r--r--plugins/redis/plugin.go56
-rw-r--r--plugins/redis/tests/configs/.rr-redis.yaml25
-rw-r--r--plugins/redis/tests/redis_plugin_tests.go1
-rw-r--r--plugins/reload/plugin.go4
-rw-r--r--plugins/resetter/tests/test_plugin.go6
-rw-r--r--plugins/rpc/tests/plugin1.go6
-rw-r--r--plugins/server/plugin.go4
-rw-r--r--plugins/server/tests/plugin_pipes.go6
-rw-r--r--plugins/server/tests/plugin_sockets.go6
-rw-r--r--plugins/server/tests/plugin_tcp.go6
-rw-r--r--plugins/static/plugin.go4
30 files changed, 184 insertions, 72 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d6644450..7c52c346 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -65,6 +65,7 @@ jobs:
- name: Run golang tests on Windows without codecov
if: ${{ matrix.os == 'windows-latest' }}
run: |
+ go test -v -race -cover -tags=debug ./util
go test -v -race -cover -tags=debug ./pkg/pipe
go test -v -race -cover -tags=debug ./pkg/pool
go test -v -race -cover -tags=debug ./pkg/socket
@@ -90,6 +91,7 @@ jobs:
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-latest' }}
run: |
mkdir ./coverage-ci
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/util.txt -covermode=atomic ./util
go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/pipe
go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/pool.txt -covermode=atomic ./pkg/pool
go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/socket
diff --git a/Makefile b/Makefile
index 9f86fa4a..1420b2c0 100755
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@ uninstall: ## Uninstall locally installed RR
rm -f /usr/local/bin/rr
test: ## Run application tests
+ go test -v -race -cover -tags=debug -covermode=atomic ./util
go test -v -race -cover -tags=debug -covermode=atomic ./pkg/pipe
go test -v -race -cover -tags=debug -covermode=atomic ./pkg/pool
go test -v -race -cover -tags=debug -covermode=atomic ./pkg/socket
diff --git a/go.mod b/go.mod
index 0dfb50b6..82794f95 100755
--- a/go.mod
+++ b/go.mod
@@ -7,6 +7,7 @@ require (
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/fatih/color v1.10.0
github.com/go-ole/go-ole v1.2.4 // indirect
+ github.com/go-redis/redis/v8 v8.4.4
github.com/gofiber/fiber/v2 v2.2.3
github.com/golang/mock v1.4.4
github.com/hashicorp/go-multierror v1.1.0
diff --git a/plugins/config/configurer.go b/interfaces/config/interface.go
index 00010eae..00010eae 100755
--- a/plugins/config/configurer.go
+++ b/interfaces/config/interface.go
diff --git a/interfaces/redis/interface.go b/interfaces/redis/interface.go
new file mode 100644
index 00000000..61dd6c08
--- /dev/null
+++ b/interfaces/redis/interface.go
@@ -0,0 +1,10 @@
+package redis
+
+import "github.com/go-redis/redis/v8"
+
+type Redis interface {
+ GetClient() *redis.Client
+ GetUniversalClient() *redis.UniversalClient
+ GetClusterClient() *redis.ClusterClient
+ GetSentinelClient() *redis.SentinelClient
+}
diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go
index ae59d611..e60ab3f4 100755
--- a/pkg/worker/worker.go
+++ b/pkg/worker/worker.go
@@ -30,13 +30,6 @@ const (
ReadBufSize = 10240 // Kb
)
-var syncPool = sync.Pool{
- New: func() interface{} {
- buf := make([]byte, ReadBufSize)
- return &buf
- },
-}
-
// Process - supervised process with api over goridge.Relay.
type Process struct {
// created indicates at what time Process has been created.
@@ -79,6 +72,8 @@ type Process struct {
rd io.Reader
// stop signal terminates io.Pipe from reading from stderr
stop chan struct{}
+
+ syncPool sync.Pool
}
// InitBaseWorker creates new Process over given exec.cmd.
@@ -93,6 +88,14 @@ func InitBaseWorker(cmd *exec.Cmd) (worker.BaseProcess, error) {
state: internal.NewWorkerState(internal.StateInactive),
stderr: new(bytes.Buffer),
stop: make(chan struct{}, 1),
+ // sync pool for STDERR
+ // All receivers are pointers
+ syncPool: sync.Pool{
+ New: func() interface{} {
+ buf := make([]byte, ReadBufSize)
+ return &buf
+ },
+ },
}
w.rd, w.cmd.Stderr = io.Pipe()
@@ -258,15 +261,12 @@ func (w *Process) Kill() error {
// put the pointer, to not allocate new slice
// but erase it len and then return back
func (w *Process) put(data *[]byte) {
- *data = (*data)[:0]
- *data = (*data)[:cap(*data)]
-
- syncPool.Put(data)
+ w.syncPool.Put(data)
}
// get pointer to the byte slice
func (w *Process) get() *[]byte {
- return syncPool.Get().(*[]byte)
+ return w.syncPool.Get().(*[]byte)
}
// Write appends the contents of pool to the errBuffer, growing the errBuffer as
@@ -282,6 +282,7 @@ func (w *Process) watch() {
w.events.Push(events.WorkerEvent{Event: events.EventWorkerLog, Worker: w, Payload: (*buf)[:n]})
w.mu.Lock()
// write new message
+ // we are sending only n read bytes, without sending previously written message as bytes slice from syncPool
w.stderr.Write((*buf)[:n])
w.mu.Unlock()
w.put(buf)
diff --git a/pkg/worker_watcher/worker_watcher.go b/pkg/worker_watcher/worker_watcher.go
index 8788e509..918145e5 100755
--- a/pkg/worker_watcher/worker_watcher.go
+++ b/pkg/worker_watcher/worker_watcher.go
@@ -10,7 +10,6 @@ import (
"github.com/spiral/roadrunner/v2/interfaces/events"
"github.com/spiral/roadrunner/v2/interfaces/worker"
"github.com/spiral/roadrunner/v2/internal"
- syncWorker "github.com/spiral/roadrunner/v2/pkg/worker"
)
type Stack struct {
@@ -163,16 +162,12 @@ type workerWatcher struct {
func (ww *workerWatcher) AddToWatch(workers []worker.BaseProcess) error {
for i := 0; i < len(workers); i++ {
- sw, err := syncWorker.From(workers[i])
- if err != nil {
- return err
- }
- ww.stack.Push(sw)
- sw.AddListener(ww.events.Push)
+ ww.stack.Push(workers[i])
+ workers[i].AddListener(ww.events.Push)
go func(swc worker.BaseProcess) {
ww.wait(swc)
- }(sw)
+ }(workers[i])
}
return nil
}
diff --git a/plugins/checker/plugin.go b/plugins/checker/plugin.go
index e6250697..e3e7834a 100644
--- a/plugins/checker/plugin.go
+++ b/plugins/checker/plugin.go
@@ -9,9 +9,9 @@ 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/log"
"github.com/spiral/roadrunner/v2/interfaces/status"
- "github.com/spiral/roadrunner/v2/plugins/config"
)
const (
@@ -26,7 +26,7 @@ type Plugin struct {
cfg *Config
}
-func (c *Plugin) Init(log log.Logger, cfg config.Configurer) error {
+func (c *Plugin) Init(log log.Logger, cfg config2.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 a276c15f..7b5d6bd8 100755
--- a/plugins/config/tests/plugin1.go
+++ b/plugins/config/tests/plugin1.go
@@ -4,7 +4,7 @@ import (
"errors"
"time"
- "github.com/spiral/roadrunner/v2/plugins/config"
+ config2 "github.com/spiral/roadrunner/v2/interfaces/config"
)
// ReloadConfig is a Reload configuration point.
@@ -23,11 +23,11 @@ type ServiceConfig struct {
}
type Foo struct {
- configProvider config.Configurer
+ configProvider config2.Configurer
}
// Depends on S2 and DB (S3 in the current case)
-func (f *Foo) Init(p config.Configurer) error {
+func (f *Foo) Init(p config2.Configurer) error {
f.configProvider = p
return nil
}
diff --git a/plugins/headers/plugin.go b/plugins/headers/plugin.go
index f1c6e6f3..e16f6187 100644
--- a/plugins/headers/plugin.go
+++ b/plugins/headers/plugin.go
@@ -5,7 +5,7 @@ import (
"strconv"
"github.com/spiral/errors"
- "github.com/spiral/roadrunner/v2/plugins/config"
+ config2 "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 config.Configurer) error {
+func (s *Plugin) Init(cfg config2.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 460263f6..a883735a 100644
--- a/plugins/http/plugin.go
+++ b/plugins/http/plugin.go
@@ -15,6 +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/events"
"github.com/spiral/roadrunner/v2/interfaces/log"
"github.com/spiral/roadrunner/v2/interfaces/pool"
@@ -22,7 +23,6 @@ import (
"github.com/spiral/roadrunner/v2/interfaces/status"
"github.com/spiral/roadrunner/v2/interfaces/worker"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
- "github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/http/attributes"
"github.com/spiral/roadrunner/v2/util"
"golang.org/x/net/http2"
@@ -49,7 +49,7 @@ type middleware map[string]Middleware
type Plugin struct {
sync.Mutex
- configurer config.Configurer
+ configurer config2.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 config.Configurer, log log.Logger, server server.Server) error {
+func (s *Plugin) Init(cfg config2.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 1cbca744..7d1f32a1 100644
--- a/plugins/http/tests/plugin1.go
+++ b/plugins/http/tests/plugin1.go
@@ -1,12 +1,14 @@
package tests
-import "github.com/spiral/roadrunner/v2/plugins/config"
+import (
+ config2 "github.com/spiral/roadrunner/v2/interfaces/config"
+)
type Plugin1 struct {
- config config.Configurer
+ config config2.Configurer
}
-func (p1 *Plugin1) Init(cfg config.Configurer) error {
+func (p1 *Plugin1) Init(cfg config2.Configurer) error {
p1.config = cfg
return nil
}
diff --git a/plugins/http/tests/plugin_middleware.go b/plugins/http/tests/plugin_middleware.go
index de829d34..224d4117 100644
--- a/plugins/http/tests/plugin_middleware.go
+++ b/plugins/http/tests/plugin_middleware.go
@@ -3,14 +3,14 @@ package tests
import (
"net/http"
- "github.com/spiral/roadrunner/v2/plugins/config"
+ config2 "github.com/spiral/roadrunner/v2/interfaces/config"
)
type PluginMiddleware struct {
- config config.Configurer
+ config config2.Configurer
}
-func (p *PluginMiddleware) Init(cfg config.Configurer) error {
+func (p *PluginMiddleware) Init(cfg config2.Configurer) error {
p.config = cfg
return nil
}
@@ -34,10 +34,10 @@ func (p *PluginMiddleware) Name() string {
}
type PluginMiddleware2 struct {
- config config.Configurer
+ config config2.Configurer
}
-func (p *PluginMiddleware2) Init(cfg config.Configurer) error {
+func (p *PluginMiddleware2) Init(cfg config2.Configurer) error {
p.config = cfg
return nil
}
diff --git a/plugins/informer/tests/test_plugin.go b/plugins/informer/tests/test_plugin.go
index 3fdefde3..80627801 100644
--- a/plugins/informer/tests/test_plugin.go
+++ b/plugins/informer/tests/test_plugin.go
@@ -4,10 +4,10 @@ import (
"context"
"time"
+ config2 "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"
- "github.com/spiral/roadrunner/v2/plugins/config"
)
var testPoolConfig = poolImpl.Config{
@@ -26,11 +26,11 @@ var testPoolConfig = poolImpl.Config{
// Gauge //////////////
type Plugin1 struct {
- config config.Configurer
+ config config2.Configurer
server server.Server
}
-func (p1 *Plugin1) Init(cfg config.Configurer, server server.Server) error {
+func (p1 *Plugin1) Init(cfg config2.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 64b77a64..ec58b7d6 100644
--- a/plugins/logger/plugin.go
+++ b/plugins/logger/plugin.go
@@ -2,8 +2,8 @@ package logger
import (
"github.com/spiral/endure"
+ config2 "github.com/spiral/roadrunner/v2/interfaces/config"
"github.com/spiral/roadrunner/v2/interfaces/log"
- "github.com/spiral/roadrunner/v2/plugins/config"
"go.uber.org/zap"
)
@@ -18,7 +18,7 @@ type ZapLogger struct {
}
// Init logger service.
-func (z *ZapLogger) Init(cfg config.Configurer) error {
+func (z *ZapLogger) Init(cfg config2.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 32238f63..4095e59d 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/log"
- "github.com/spiral/roadrunner/v2/plugins/config"
)
type Plugin struct {
- config config.Configurer
+ config config2.Configurer
log log.Logger
}
-func (p1 *Plugin) Init(cfg config.Configurer, log log.Logger) error {
+func (p1 *Plugin) Init(cfg config2.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 c115826b..956166ee 100644
--- a/plugins/metrics/plugin.go
+++ b/plugins/metrics/plugin.go
@@ -11,9 +11,9 @@ 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/log"
"github.com/spiral/roadrunner/v2/interfaces/metrics"
- "github.com/spiral/roadrunner/v2/plugins/config"
"golang.org/x/sys/cpu"
)
@@ -40,7 +40,7 @@ type Plugin struct {
}
// Init service.
-func (m *Plugin) Init(cfg config.Configurer, log log.Logger) error {
+func (m *Plugin) Init(cfg config2.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 b48c415d..08dd2593 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"
- "github.com/spiral/roadrunner/v2/plugins/config"
+ config2 "github.com/spiral/roadrunner/v2/interfaces/config"
)
// Gauge //////////////
type Plugin1 struct {
- config config.Configurer
+ config config2.Configurer
}
-func (p1 *Plugin1) Init(cfg config.Configurer) error {
+func (p1 *Plugin1) Init(cfg config2.Configurer) error {
p1.config = cfg
return nil
}
diff --git a/plugins/redis/config.go b/plugins/redis/config.go
new file mode 100644
index 00000000..b39fcd00
--- /dev/null
+++ b/plugins/redis/config.go
@@ -0,0 +1,18 @@
+package redis
+
+type Config struct {
+ // Addr is address to use. If len > 1, cluster client will be used
+ Addr []string
+ // database number to use, 0 is used by default
+ DB int
+ // Master name for failover client, empty by default
+ Master string
+ // Redis password, empty by default
+ Password string
+}
+
+// InitDefaults initializing fill config with default values
+func (s *Config) InitDefaults() error {
+ s.Addr = []string{"localhost:6379"} // default addr is pointing to local storage
+ return nil
+}
diff --git a/plugins/redis/plugin.go b/plugins/redis/plugin.go
new file mode 100644
index 00000000..64b6024e
--- /dev/null
+++ b/plugins/redis/plugin.go
@@ -0,0 +1,56 @@
+package redis
+
+import (
+ "github.com/go-redis/redis/v8"
+ "github.com/spiral/roadrunner/v2/interfaces/config"
+ "github.com/spiral/roadrunner/v2/interfaces/log"
+)
+
+const PluginName = "redis"
+
+type Plugin struct {
+ // config for RR integration
+ cfg *Config
+ // redis client
+ universalClient *redis.UniversalClient
+ clusterClient *redis.ClusterClient
+ client *redis.Client
+ sentinelClient *redis.SentinelClient
+}
+
+func (s *Plugin) GetClient() *redis.Client {
+ return s.client
+}
+
+func (s *Plugin) GetUniversalClient() *redis.UniversalClient {
+ return s.universalClient
+}
+
+func (s *Plugin) GetClusterClient() *redis.ClusterClient {
+ return s.clusterClient
+}
+
+func (s *Plugin) GetSentinelClient() *redis.SentinelClient {
+ return s.sentinelClient
+}
+
+func (s *Plugin) Init(cfg config.Configurer, log log.Logger) error {
+ _ = cfg
+ _ = log
+ _ = s.cfg
+ return nil
+}
+
+func (s *Plugin) Serve() chan error {
+ errCh := make(chan error, 1)
+
+ return errCh
+}
+
+func (s Plugin) Stop() error {
+ return nil
+}
+
+func (s *Plugin) Name() string {
+ return PluginName
+}
diff --git a/plugins/redis/tests/configs/.rr-redis.yaml b/plugins/redis/tests/configs/.rr-redis.yaml
new file mode 100644
index 00000000..52198a35
--- /dev/null
+++ b/plugins/redis/tests/configs/.rr-redis.yaml
@@ -0,0 +1,25 @@
+redis:
+ - cluster:
+ addr:
+ - 'localhost:6379'
+ db: 0
+ master: null
+ password: ''
+ - universal:
+ addr:
+ - 'localhost:6379'
+ db: 0
+ master: null
+ password: ''
+ - default:
+ addr:
+ - 'localhost:6379'
+ db: 0
+ master: null
+ password: ''
+ - sentinel:
+ addr:
+ - 'localhost:6379'
+ db: 0
+ master: null
+ password: '' \ No newline at end of file
diff --git a/plugins/redis/tests/redis_plugin_tests.go b/plugins/redis/tests/redis_plugin_tests.go
new file mode 100644
index 00000000..ca8701d2
--- /dev/null
+++ b/plugins/redis/tests/redis_plugin_tests.go
@@ -0,0 +1 @@
+package tests
diff --git a/plugins/reload/plugin.go b/plugins/reload/plugin.go
index 555ddb82..233c83a4 100644
--- a/plugins/reload/plugin.go
+++ b/plugins/reload/plugin.go
@@ -6,9 +6,9 @@ import (
"time"
"github.com/spiral/errors"
+ config2 "github.com/spiral/roadrunner/v2/interfaces/config"
"github.com/spiral/roadrunner/v2/interfaces/log"
"github.com/spiral/roadrunner/v2/interfaces/resetter"
- "github.com/spiral/roadrunner/v2/plugins/config"
)
// PluginName contains default plugin name.
@@ -25,7 +25,7 @@ type Plugin struct {
}
// Init controller service
-func (s *Plugin) Init(cfg config.Configurer, log log.Logger, res resetter.Resetter) error {
+func (s *Plugin) Init(cfg config2.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 1d770e70..f1c09caf 100644
--- a/plugins/resetter/tests/test_plugin.go
+++ b/plugins/resetter/tests/test_plugin.go
@@ -4,9 +4,9 @@ import (
"context"
"time"
+ config2 "github.com/spiral/roadrunner/v2/interfaces/config"
"github.com/spiral/roadrunner/v2/interfaces/server"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
- "github.com/spiral/roadrunner/v2/plugins/config"
)
var testPoolConfig = poolImpl.Config{
@@ -25,11 +25,11 @@ var testPoolConfig = poolImpl.Config{
// Gauge //////////////
type Plugin1 struct {
- config config.Configurer
+ config config2.Configurer
server server.Server
}
-func (p1 *Plugin1) Init(cfg config.Configurer, server server.Server) error {
+func (p1 *Plugin1) Init(cfg config2.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 79e98ed4..dcb256fa 100644
--- a/plugins/rpc/tests/plugin1.go
+++ b/plugins/rpc/tests/plugin1.go
@@ -3,14 +3,14 @@ package tests
import (
"fmt"
- "github.com/spiral/roadrunner/v2/plugins/config"
+ config2 "github.com/spiral/roadrunner/v2/interfaces/config"
)
type Plugin1 struct {
- config config.Configurer
+ config config2.Configurer
}
-func (p1 *Plugin1) Init(cfg config.Configurer) error {
+func (p1 *Plugin1) Init(cfg config2.Configurer) error {
p1.config = cfg
return nil
}
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go
index e6003fbc..8555fd7e 100644
--- a/plugins/server/plugin.go
+++ b/plugins/server/plugin.go
@@ -8,6 +8,7 @@ import (
"strings"
"github.com/spiral/errors"
+ config2 "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"
@@ -16,7 +17,6 @@ import (
"github.com/spiral/roadrunner/v2/pkg/pipe"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
"github.com/spiral/roadrunner/v2/pkg/socket"
- "github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/util"
)
@@ -30,7 +30,7 @@ type Plugin struct {
}
// Init application provider.
-func (server *Plugin) Init(cfg config.Configurer, log log.Logger) error {
+func (server *Plugin) Init(cfg config2.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 9a8a630c..9d7812a8 100644
--- a/plugins/server/tests/plugin_pipes.go
+++ b/plugins/server/tests/plugin_pipes.go
@@ -5,12 +5,12 @@ import (
"time"
"github.com/spiral/errors"
+ config2 "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"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
"github.com/spiral/roadrunner/v2/pkg/worker"
- "github.com/spiral/roadrunner/v2/plugins/config"
plugin "github.com/spiral/roadrunner/v2/plugins/server"
)
@@ -32,12 +32,12 @@ var testPoolConfig = poolImpl.Config{
}
type Foo struct {
- configProvider config.Configurer
+ configProvider config2.Configurer
wf server.Server
pool pool.Pool
}
-func (f *Foo) Init(p config.Configurer, workerFactory server.Server) error {
+func (f *Foo) Init(p config2.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 b1545718..e5b139d4 100644
--- a/plugins/server/tests/plugin_sockets.go
+++ b/plugins/server/tests/plugin_sockets.go
@@ -4,21 +4,21 @@ import (
"context"
"github.com/spiral/errors"
+ config2 "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"
"github.com/spiral/roadrunner/v2/pkg/worker"
- "github.com/spiral/roadrunner/v2/plugins/config"
plugin "github.com/spiral/roadrunner/v2/plugins/server"
)
type Foo2 struct {
- configProvider config.Configurer
+ configProvider config2.Configurer
wf server.Server
pool pool.Pool
}
-func (f *Foo2) Init(p config.Configurer, workerFactory server.Server) error {
+func (f *Foo2) Init(p config2.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 da92288a..866116a7 100644
--- a/plugins/server/tests/plugin_tcp.go
+++ b/plugins/server/tests/plugin_tcp.go
@@ -4,21 +4,21 @@ import (
"context"
"github.com/spiral/errors"
+ config2 "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"
"github.com/spiral/roadrunner/v2/pkg/worker"
- "github.com/spiral/roadrunner/v2/plugins/config"
plugin "github.com/spiral/roadrunner/v2/plugins/server"
)
type Foo3 struct {
- configProvider config.Configurer
+ configProvider config2.Configurer
wf server.Server
pool pool.Pool
}
-func (f *Foo3) Init(p config.Configurer, workerFactory server.Server) error {
+func (f *Foo3) Init(p config2.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 cf5cee25..fd8d0a9c 100644
--- a/plugins/static/plugin.go
+++ b/plugins/static/plugin.go
@@ -5,8 +5,8 @@ import (
"path"
"github.com/spiral/errors"
+ config2 "github.com/spiral/roadrunner/v2/interfaces/config"
"github.com/spiral/roadrunner/v2/interfaces/log"
- "github.com/spiral/roadrunner/v2/plugins/config"
)
// ID contains default service name.
@@ -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 config.Configurer, log log.Logger) error {
+func (s *Plugin) Init(cfg config2.Configurer, log log.Logger) error {
const op = errors.Op("static plugin init")
err := cfg.UnmarshalKey(RootPluginName, &s.cfg)
if err != nil {