Skip to content

Commit 969036d

Browse files
committed
api: rename connection_pool to pool
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
1 parent 1e53874 commit 969036d

21 files changed

+306
-299
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
1818

1919
### Changed
2020

21+
- connection_pool renamed to pool (#239)
22+
2123
### Removed
2224

2325
- multi subpackage (#240)

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ testrace:
5757
go clean -testcache
5858
go test -race -tags "$(TAGS)" ./... -v -p 1
5959

60-
.PHONY: test-connection-pool
61-
test-connection-pool:
62-
@echo "Running tests in connection_pool package"
60+
.PHONY: test-pool
61+
test-pool:
62+
@echo "Running tests in pool package"
6363
go clean -testcache
64-
go test -tags "$(TAGS)" ./connection_pool/ -v -p 1
64+
go test -tags "$(TAGS)" ./pool/ -v -p 1
6565

6666
.PHONY: test-datetime
6767
test-datetime:

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ faster than other packages according to public benchmarks.
3333
* [Walking\-through example](#walking-through-example)
3434
* [Migration to v2](#migration-to-v2)
3535
* [multi removed](#multi-subpackage)
36+
* [connection_pool renamed to pool](#pool-subpackage)
3637
* [msgpack.v5 migration](#msgpackv5-migration)
3738
* [Contributing](#contributing)
3839
* [Alternative connectors](#alternative-connectors)
@@ -166,7 +167,11 @@ The article describes migration from go-tarantool to go-tarantool/v2.
166167

167168
#### multi subpackage
168169

169-
The subpackage has been deleted. You could use `connection_pool` instead.
170+
The subpackage has been deleted. You could use `pool` instead.
171+
172+
#### pool subpackage
173+
174+
The `connection_pool` subpackage has been renamed to `pool`.
170175

171176
#### msgpack.v5 migration
172177

connection_pool/call_16_test.go renamed to pool/call_16_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//go:build !go_tarantool_call_17
22
// +build !go_tarantool_call_17
33

4-
package connection_pool_test
4+
package pool_test
55

66
import (
77
"testing"
88

99
"github.com/stretchr/testify/require"
10-
"github.com/tarantool/go-tarantool/v2/connection_pool"
10+
"github.com/tarantool/go-tarantool/v2/pool"
1111
"github.com/tarantool/go-tarantool/v2/test_helpers"
1212
)
1313

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

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

2424
defer connPool.Close()
2525

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

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

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

5959
// RW
60-
resp, err = connPool.Call("box.info", []interface{}{}, connection_pool.RW)
60+
resp, err = connPool.Call("box.info", []interface{}{}, pool.RW)
6161
require.Nilf(t, err, "failed to Call")
6262
require.NotNilf(t, resp, "response is nil after Call")
6363
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")

connection_pool/call_17_test.go renamed to pool/call_17_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//go:build go_tarantool_call_17
22
// +build go_tarantool_call_17
33

4-
package connection_pool_test
4+
package pool_test
55

66
import (
77
"testing"
88

99
"github.com/stretchr/testify/require"
10-
"github.com/tarantool/go-tarantool/v2/connection_pool"
10+
"github.com/tarantool/go-tarantool/v2/pool"
1111
"github.com/tarantool/go-tarantool/v2/test_helpers"
1212
)
1313

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

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

2424
defer connPool.Close()
2525

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

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

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

5959
// RW
60-
resp, err = connPool.Call("box.info", []interface{}{}, connection_pool.RW)
60+
resp, err = connPool.Call("box.info", []interface{}{}, pool.RW)
6161
require.Nilf(t, err, "failed to Call")
6262
require.NotNilf(t, resp, "response is nil after Call")
6363
require.GreaterOrEqualf(t, len(resp.Data), 1, "response.Data is empty after Call")
File renamed without changes.

connection_pool/connection_pool.go renamed to pool/connection_pool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// - Automatic master discovery by mode parameter.
99
//
1010
// Since: 1.6.0
11-
package connection_pool
11+
package pool
1212

1313
import (
1414
"errors"

0 commit comments

Comments
 (0)