Skip to content

Commit b8d9914

Browse files
committed
pool: add Instance type
The type Instance: ``` type Instance struct { // Name is an unique name of the instance. Name string // Dialer will be used to create a connection to the instance. Dialer tarantool.Dialer // Opts will be used to specify a connection options. Opts tarantool.Opts } ``` The type allows to specify a dialer and connection options per a pool instance. It is used in `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` to specify an instance configuration now. Closes #356
1 parent b6e0c4a commit b8d9914

8 files changed

+351
-292
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
6565
- Change `OverrideSchema(*Schema)` to `SetSchema(Schema)` (#7)
6666
- Change values, stored by pointers in the `Schema`, `Space`, `Index` structs,
6767
to be stored by their values (#7)
68-
- Make `Dialer` mandatory for creation a single connection / connection pool (#321)
68+
- Make `Dialer` mandatory for creation a single connection (#321)
6969
- Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
7070
Add `Addr()` function instead (#321)
7171
- Remove `Connection.ClientProtocolInfo`, `Connection.ServerProtocolInfo`.
@@ -93,6 +93,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
9393
`Call`, `Call16`, `Call17`, `Eval`, `Execute` of a `Connector` and `Pooler`
9494
return response data instead of an actual responses (#237)
9595
- Renamed `StrangerResponse` to `MockResponse` (#237)
96+
- `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a new type
97+
`pool.Instance` to determinate connection options (#356)
9698

9799
### Deprecated
98100

README.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,19 @@ The subpackage has been deleted. You could use `pool` instead.
192192

193193
* The `connection_pool` subpackage has been renamed to `pool`.
194194
* The type `PoolOpts` has been renamed to `Opts`.
195-
* `pool.Connect` now accepts context as first argument, which user may cancel
196-
in process. If it is canceled in progress, an error will be returned.
197-
All created connections will be closed.
198-
* `pool.Add` now accepts context as first argument, which user may cancel in
199-
process.
200-
* Now you need to pass `map[string]Dialer` to the `pool.Connect` as the second
201-
argument, instead of a list of addresses. Each dialer is associated with a
202-
unique string ID, which allows them to be distinguished.
203-
* `pool.GetPoolInfo` has been renamed to `pool.GetInfo`. Return type has been changed
204-
to `map[string]ConnectionInfo`.
195+
* `pool.Connect` and `pool.ConnectWithOpts` now accept context as the first
196+
argument, which user may cancel in process. If it is canceled in progress,
197+
an error will be returned and all created connections will be closed.
198+
* `pool.Connect` and `pool.ConnectWithOpts` now accept `[]pool.Instance` as
199+
the second argument instead of a list of addresses. Each instance is
200+
associated with a unique string name, `Dialer` and connection options which
201+
allows instances to be independently configured.
202+
* `pool.Add` now accepts context as the first argument, which user may cancel
203+
in process.
204+
* `pool.Add` now accepts `pool.Instance` as the second argument instead of
205+
an address, it allows to configure a new instance more flexible.
206+
* `pool.GetPoolInfo` has been renamed to `pool.GetInfo`. Return type has been
207+
changed to `map[string]ConnectionInfo`.
205208
* Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`, `Update`, `Upsert`,
206209
`Call`, `Call16`, `Call17`, `Eval`, `Execute` of a `Pooler` return
207210
response data instead of an actual responses.

0 commit comments

Comments
 (0)