diff options
author | Valery Piashchynski <[email protected]> | 2021-07-10 13:57:49 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-07-10 13:57:49 +0300 |
commit | 453eb10b436925ef91b1206e795e581e6293d132 (patch) | |
tree | 1bf08147397e2d68b7531039b989901a951c66df | |
parent | 435cfae06a963cce2e85384afd3946b95e4b8344 (diff) |
Return structure instead of interface in places where that possible
Signed-off-by: Valery Piashchynski <[email protected]>
-rwxr-xr-x | pkg/worker/sync_worker.go | 2 | ||||
-rw-r--r-- | plugins/kv/drivers/boltdb/driver.go | 3 | ||||
-rw-r--r-- | plugins/kv/drivers/memcached/driver.go | 3 | ||||
-rw-r--r-- | plugins/memory/kv.go | 3 | ||||
-rw-r--r-- | plugins/memory/pubsub.go | 2 | ||||
-rw-r--r-- | plugins/redis/kv.go | 3 | ||||
-rw-r--r-- | plugins/redis/pubsub.go | 2 | ||||
-rw-r--r-- | tests/plugins/kv/rr.db | bin | 32768 -> 0 bytes |
8 files changed, 7 insertions, 11 deletions
diff --git a/pkg/worker/sync_worker.go b/pkg/worker/sync_worker.go index 84ff5977..38f44461 100755 --- a/pkg/worker/sync_worker.go +++ b/pkg/worker/sync_worker.go @@ -23,7 +23,7 @@ type SyncWorkerImpl struct { } // From creates SyncWorker from BaseProcess -func From(process *Process) SyncWorker { +func From(process *Process) *SyncWorkerImpl { return &SyncWorkerImpl{ process: process, fPool: sync.Pool{New: func() interface{} { diff --git a/plugins/kv/drivers/boltdb/driver.go b/plugins/kv/drivers/boltdb/driver.go index 0f737fbd..15a5674f 100644 --- a/plugins/kv/drivers/boltdb/driver.go +++ b/plugins/kv/drivers/boltdb/driver.go @@ -9,7 +9,6 @@ import ( "time" "github.com/spiral/errors" - "github.com/spiral/roadrunner/v2/common/kv" "github.com/spiral/roadrunner/v2/plugins/config" "github.com/spiral/roadrunner/v2/plugins/logger" kvv1 "github.com/spiral/roadrunner/v2/proto/kv/v1beta" @@ -34,7 +33,7 @@ type Driver struct { stop chan struct{} } -func NewBoltDBDriver(log logger.Logger, key string, cfgPlugin config.Configurer, stop chan struct{}) (kv.Storage, error) { +func NewBoltDBDriver(log logger.Logger, key string, cfgPlugin config.Configurer, stop chan struct{}) (*Driver, error) { const op = errors.Op("new_boltdb_driver") d := &Driver{ diff --git a/plugins/kv/drivers/memcached/driver.go b/plugins/kv/drivers/memcached/driver.go index 42e342ac..e24747fe 100644 --- a/plugins/kv/drivers/memcached/driver.go +++ b/plugins/kv/drivers/memcached/driver.go @@ -6,7 +6,6 @@ import ( "github.com/bradfitz/gomemcache/memcache" "github.com/spiral/errors" - kv "github.com/spiral/roadrunner/v2/common/kv" "github.com/spiral/roadrunner/v2/plugins/config" "github.com/spiral/roadrunner/v2/plugins/logger" kvv1 "github.com/spiral/roadrunner/v2/proto/kv/v1beta" @@ -21,7 +20,7 @@ type Driver struct { // NewMemcachedDriver returns a memcache client using the provided server(s) // with equal weight. If a server is listed multiple times, // it gets a proportional amount of weight. -func NewMemcachedDriver(log logger.Logger, key string, cfgPlugin config.Configurer) (kv.Storage, error) { +func NewMemcachedDriver(log logger.Logger, key string, cfgPlugin config.Configurer) (*Driver, error) { const op = errors.Op("new_memcached_driver") s := &Driver{ diff --git a/plugins/memory/kv.go b/plugins/memory/kv.go index 3cec1f97..68ea7266 100644 --- a/plugins/memory/kv.go +++ b/plugins/memory/kv.go @@ -6,7 +6,6 @@ import ( "time" "github.com/spiral/errors" - kv "github.com/spiral/roadrunner/v2/common/kv" "github.com/spiral/roadrunner/v2/plugins/config" "github.com/spiral/roadrunner/v2/plugins/logger" kvv1 "github.com/spiral/roadrunner/v2/proto/kv/v1beta" @@ -21,7 +20,7 @@ type Driver struct { cfg *Config } -func NewInMemoryDriver(log logger.Logger, key string, cfgPlugin config.Configurer, stop chan struct{}) (kv.Storage, error) { +func NewInMemoryDriver(log logger.Logger, key string, cfgPlugin config.Configurer, stop chan struct{}) (*Driver, error) { const op = errors.Op("new_in_memory_driver") d := &Driver{ diff --git a/plugins/memory/pubsub.go b/plugins/memory/pubsub.go index 3c909900..c79f3eb0 100644 --- a/plugins/memory/pubsub.go +++ b/plugins/memory/pubsub.go @@ -17,7 +17,7 @@ type PubSubDriver struct { log logger.Logger } -func NewPubSubDriver(log logger.Logger, _ string) (pubsub.PubSub, error) { +func NewPubSubDriver(log logger.Logger, _ string) (*PubSubDriver, error) { ps := &PubSubDriver{ pushCh: make(chan *pubsub.Message, 10), storage: bst.NewBST(), diff --git a/plugins/redis/kv.go b/plugins/redis/kv.go index 5bf03af1..29f89d46 100644 --- a/plugins/redis/kv.go +++ b/plugins/redis/kv.go @@ -7,7 +7,6 @@ import ( "github.com/go-redis/redis/v8" "github.com/spiral/errors" - "github.com/spiral/roadrunner/v2/common/kv" "github.com/spiral/roadrunner/v2/plugins/config" "github.com/spiral/roadrunner/v2/plugins/logger" kvv1 "github.com/spiral/roadrunner/v2/proto/kv/v1beta" @@ -20,7 +19,7 @@ type Driver struct { cfg *Config } -func NewRedisDriver(log logger.Logger, key string, cfgPlugin config.Configurer) (kv.Storage, error) { +func NewRedisDriver(log logger.Logger, key string, cfgPlugin config.Configurer) (*Driver, error) { const op = errors.Op("new_boltdb_driver") d := &Driver{ diff --git a/plugins/redis/pubsub.go b/plugins/redis/pubsub.go index 8bd78514..01efc623 100644 --- a/plugins/redis/pubsub.go +++ b/plugins/redis/pubsub.go @@ -21,7 +21,7 @@ type PubSubDriver struct { stopCh chan struct{} } -func NewPubSubDriver(log logger.Logger, key string, cfgPlugin config.Configurer, stopCh chan struct{}) (pubsub.PubSub, error) { +func NewPubSubDriver(log logger.Logger, key string, cfgPlugin config.Configurer, stopCh chan struct{}) (*PubSubDriver, error) { const op = errors.Op("new_pub_sub_driver") ps := &PubSubDriver{ log: log, diff --git a/tests/plugins/kv/rr.db b/tests/plugins/kv/rr.db Binary files differdeleted file mode 100644 index 4267eb2c..00000000 --- a/tests/plugins/kv/rr.db +++ /dev/null |