Skip to content

Commit

Permalink
api: rename connection_pool to pool
Browse files Browse the repository at this point in the history
By convention, packages are given lower case, single-word names; there
should be no need for underscores or mixedCaps [1].

1. https://go.dev/doc/effective_go#package-names

Closes #239
  • Loading branch information
oleg-jukovec committed Mar 21, 2023
1 parent 1e53874 commit 969036d
Show file tree
Hide file tree
Showing 21 changed files with 306 additions and 299 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.

### Changed

- connection_pool renamed to pool (#239)

### Removed

- multi subpackage (#240)
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ testrace:
go clean -testcache
go test -race -tags "$(TAGS)" ./... -v -p 1

.PHONY: test-connection-pool
test-connection-pool:
@echo "Running tests in connection_pool package"
.PHONY: test-pool
test-pool:
@echo "Running tests in pool package"
go clean -testcache
go test -tags "$(TAGS)" ./connection_pool/ -v -p 1
go test -tags "$(TAGS)" ./pool/ -v -p 1

.PHONY: test-datetime
test-datetime:
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ faster than other packages according to public benchmarks.
* [Walking\-through example](#walking-through-example)
* [Migration to v2](#migration-to-v2)
* [multi removed](#multi-subpackage)
* [connection_pool renamed to pool](#pool-subpackage)
* [msgpack.v5 migration](#msgpackv5-migration)
* [Contributing](#contributing)
* [Alternative connectors](#alternative-connectors)
Expand Down Expand Up @@ -166,7 +167,11 @@ The article describes migration from go-tarantool to go-tarantool/v2.

#### multi subpackage

The subpackage has been deleted. You could use `connection_pool` instead.
The subpackage has been deleted. You could use `pool` instead.

#### pool subpackage

The `connection_pool` subpackage has been renamed to `pool`.

#### msgpack.v5 migration

Expand Down
14 changes: 7 additions & 7 deletions connection_pool/call_16_test.go → pool/call_16_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//go:build !go_tarantool_call_17
// +build !go_tarantool_call_17

package connection_pool_test
package pool_test

import (
"testing"

"github.com/stretchr/testify/require"
"github.com/tarantool/go-tarantool/v2/connection_pool"
"github.com/tarantool/go-tarantool/v2/pool"
"github.com/tarantool/go-tarantool/v2/test_helpers"
)

Expand All @@ -17,14 +17,14 @@ func TestCall(t *testing.T) {
err := test_helpers.SetClusterRO(servers, connOpts, roles)
require.Nilf(t, err, "fail to set roles for cluster")

connPool, err := connection_pool.Connect(servers, connOpts)
connPool, err := pool.Connect(servers, connOpts)
require.Nilf(t, err, "failed to connect")
require.NotNilf(t, connPool, "conn is nil after Connect")

defer connPool.Close()

// PreferRO
resp, err := connPool.Call("box.info", []interface{}{}, connection_pool.PreferRO)
resp, err := connPool.Call("box.info", []interface{}{}, pool.PreferRO)
require.Nilf(t, err, "failed to Call")
require.NotNilf(t, resp, "response is nil after Call")
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")
Expand All @@ -35,7 +35,7 @@ func TestCall(t *testing.T) {
require.Truef(t, ro, "expected `true` with mode `PreferRO`")

// PreferRW
resp, err = connPool.Call("box.info", []interface{}{}, connection_pool.PreferRW)
resp, err = connPool.Call("box.info", []interface{}{}, pool.PreferRW)
require.Nilf(t, err, "failed to Call")
require.NotNilf(t, resp, "response is nil after Call")
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")
Expand All @@ -46,7 +46,7 @@ func TestCall(t *testing.T) {
require.Falsef(t, ro, "expected `false` with mode `PreferRW`")

// RO
resp, err = connPool.Call("box.info", []interface{}{}, connection_pool.RO)
resp, err = connPool.Call("box.info", []interface{}{}, pool.RO)
require.Nilf(t, err, "failed to Call")
require.NotNilf(t, resp, "response is nil after Call")
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")
Expand All @@ -57,7 +57,7 @@ func TestCall(t *testing.T) {
require.Truef(t, ro, "expected `true` with mode `RO`")

// RW
resp, err = connPool.Call("box.info", []interface{}{}, connection_pool.RW)
resp, err = connPool.Call("box.info", []interface{}{}, pool.RW)
require.Nilf(t, err, "failed to Call")
require.NotNilf(t, resp, "response is nil after Call")
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")
Expand Down
14 changes: 7 additions & 7 deletions connection_pool/call_17_test.go → pool/call_17_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//go:build go_tarantool_call_17
// +build go_tarantool_call_17

package connection_pool_test
package pool_test

import (
"testing"

"github.com/stretchr/testify/require"
"github.com/tarantool/go-tarantool/v2/connection_pool"
"github.com/tarantool/go-tarantool/v2/pool"
"github.com/tarantool/go-tarantool/v2/test_helpers"
)

Expand All @@ -17,14 +17,14 @@ func TestCall(t *testing.T) {
err := test_helpers.SetClusterRO(servers, connOpts, roles)
require.Nilf(t, err, "fail to set roles for cluster")

connPool, err := connection_pool.Connect(servers, connOpts)
connPool, err := pool.Connect(servers, connOpts)
require.Nilf(t, err, "failed to connect")
require.NotNilf(t, connPool, "conn is nil after Connect")

defer connPool.Close()

// PreferRO
resp, err := connPool.Call("box.info", []interface{}{}, connection_pool.PreferRO)
resp, err := connPool.Call("box.info", []interface{}{}, pool.PreferRO)
require.Nilf(t, err, "failed to Call")
require.NotNilf(t, resp, "response is nil after Call")
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")
Expand All @@ -35,7 +35,7 @@ func TestCall(t *testing.T) {
require.Truef(t, ro, "expected `true` with mode `PreferRO`")

// PreferRW
resp, err = connPool.Call("box.info", []interface{}{}, connection_pool.PreferRW)
resp, err = connPool.Call("box.info", []interface{}{}, pool.PreferRW)
require.Nilf(t, err, "failed to Call")
require.NotNilf(t, resp, "response is nil after Call")
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")
Expand All @@ -46,7 +46,7 @@ func TestCall(t *testing.T) {
require.Falsef(t, ro, "expected `false` with mode `PreferRW`")

// RO
resp, err = connPool.Call("box.info", []interface{}{}, connection_pool.RO)
resp, err = connPool.Call("box.info", []interface{}{}, pool.RO)
require.Nilf(t, err, "failed to Call")
require.NotNilf(t, resp, "response is nil after Call")
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")
Expand All @@ -57,7 +57,7 @@ func TestCall(t *testing.T) {
require.Truef(t, ro, "expected `true` with mode `RO`")

// RW
resp, err = connPool.Call("box.info", []interface{}{}, connection_pool.RW)
resp, err = connPool.Call("box.info", []interface{}{}, pool.RW)
require.Nilf(t, err, "failed to Call")
require.NotNilf(t, resp, "response is nil after Call")
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// - Automatic master discovery by mode parameter.
//
// Since: 1.6.0
package connection_pool
package pool

import (
"errors"
Expand Down
Loading

0 comments on commit 969036d

Please sign in to comment.