Skip to content

Commit

Permalink
pool: add Instance type
Browse files Browse the repository at this point in the history
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
  • Loading branch information
oleg-jukovec committed Jan 26, 2024
1 parent b6e0c4a commit b8d9914
Show file tree
Hide file tree
Showing 8 changed files with 351 additions and 292 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
- Change `OverrideSchema(*Schema)` to `SetSchema(Schema)` (#7)
- Change values, stored by pointers in the `Schema`, `Space`, `Index` structs,
to be stored by their values (#7)
- Make `Dialer` mandatory for creation a single connection / connection pool (#321)
- Make `Dialer` mandatory for creation a single connection (#321)
- Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
Add `Addr()` function instead (#321)
- Remove `Connection.ClientProtocolInfo`, `Connection.ServerProtocolInfo`.
Expand Down Expand Up @@ -93,6 +93,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
`Call`, `Call16`, `Call17`, `Eval`, `Execute` of a `Connector` and `Pooler`
return response data instead of an actual responses (#237)
- Renamed `StrangerResponse` to `MockResponse` (#237)
- `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a new type
`pool.Instance` to determinate connection options (#356)

### Deprecated

Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,19 @@ The subpackage has been deleted. You could use `pool` instead.

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

0 comments on commit b8d9914

Please sign in to comment.