Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2: ability to mock Connector.Do()/Future/Response in tests #237

Closed
oleg-jukovec opened this issue Nov 24, 2022 · 3 comments · Fixed by #363
Closed

v2: ability to mock Connector.Do()/Future/Response in tests #237

oleg-jukovec opened this issue Nov 24, 2022 · 3 comments · Fixed by #363
Assignees

Comments

@oleg-jukovec
Copy link
Collaborator

oleg-jukovec commented Nov 24, 2022

At now it is required to write integration tests with Tarantool to test the code written using go-tarantool. I saw this problem while writing tests for tt. I couldn't mock the workflow:

ret := some_code_to_test(mockConnectorObject) {
    // some code to test
    future := mockConnectorObject.Do(someRequest)
    mock_response, mock_err := future.Get()
    // more code to test
}
if ret != expected {
    t.Errorf("test failed")
}

It would be great to have that ability.

@oleg-jukovec
Copy link
Collaborator Author

oleg-jukovec commented Dec 12, 2022

At now the code must be changed when adding new requests.

go-tarantool/response.go

Lines 112 to 143 in 265f96c

func (resp *Response) decodeHeader(d *decoder) (err error) {
var l int
d.Reset(&resp.buf)
if l, err = d.DecodeMapLen(); err != nil {
return
}
for ; l > 0; l-- {
var cd int
if cd, err = resp.smallInt(d); err != nil {
return
}
switch cd {
case KeySync:
var rid uint64
if rid, err = d.DecodeUint64(); err != nil {
return
}
resp.RequestId = uint32(rid)
case KeyCode:
var rcode uint64
if rcode, err = d.DecodeUint64(); err != nil {
return
}
resp.Code = uint32(rcode)
default:
if err = d.Skip(); err != nil {
return
}
}
}
return nil
}

go-tarantool/response.go

Lines 145 to 248 in 265f96c

func (resp *Response) decodeBody() (err error) {
if resp.buf.Len() > 2 {
offset := resp.buf.Offset()
defer resp.buf.Seek(offset)
var l, larr int
var stmtID, bindCount uint64
var serverProtocolInfo ProtocolInfo
var feature ProtocolFeature
var errorExtendedInfo *BoxError = nil
d := newDecoder(&resp.buf)
if l, err = d.DecodeMapLen(); err != nil {
return err
}
for ; l > 0; l-- {
var cd int
if cd, err = resp.smallInt(d); err != nil {
return err
}
switch cd {
case KeyData:
var res interface{}
var ok bool
if res, err = d.DecodeInterface(); err != nil {
return err
}
if resp.Data, ok = res.([]interface{}); !ok {
return fmt.Errorf("result is not array: %v", res)
}
case KeyError:
if errorExtendedInfo, err = decodeBoxError(d); err != nil {
return err
}
case KeyError24:
if resp.Error, err = d.DecodeString(); err != nil {
return err
}
case KeySQLInfo:
if err = d.Decode(&resp.SQLInfo); err != nil {
return err
}
case KeyMetaData:
if err = d.Decode(&resp.MetaData); err != nil {
return err
}
case KeyStmtID:
if stmtID, err = d.DecodeUint64(); err != nil {
return err
}
case KeyBindCount:
if bindCount, err = d.DecodeUint64(); err != nil {
return err
}
case KeyVersion:
if err = d.Decode(&serverProtocolInfo.Version); err != nil {
return err
}
case KeyFeatures:
if larr, err = d.DecodeArrayLen(); err != nil {
return err
}
serverProtocolInfo.Features = make([]ProtocolFeature, larr)
for i := 0; i < larr; i++ {
if err = d.Decode(&feature); err != nil {
return err
}
serverProtocolInfo.Features[i] = feature
}
default:
if err = d.Skip(); err != nil {
return err
}
}
}
if stmtID != 0 {
stmt := &Prepared{
StatementID: PreparedID(stmtID),
ParamCount: bindCount,
MetaData: resp.MetaData,
}
resp.Data = []interface{}{stmt}
}
// Tarantool may send only version >= 1
if (serverProtocolInfo.Version != ProtocolVersion(0)) || (serverProtocolInfo.Features != nil) {
if serverProtocolInfo.Version == ProtocolVersion(0) {
return fmt.Errorf("No protocol version provided in Id response")
}
if serverProtocolInfo.Features == nil {
return fmt.Errorf("No features provided in Id response")
}
resp.Data = []interface{}{serverProtocolInfo}
}
if resp.Code != OkCode && resp.Code != PushCode {
resp.Code &^= ErrorCodeBit
err = Error{resp.Code, resp.Error, errorExtendedInfo}
}
}
return
}

It's better to redesign the interface (add ability to decode header/body per request?) a bit and get rid of it. This may also be related to the issue:

#129

@oleg-jukovec
Copy link
Collaborator Author

oleg-jukovec commented Nov 29, 2023

It would be also nice to highlight/fix that Future.Err() does not return an error for all cases. From the Telegram chat:

-- доброго дня, странная ситуация. видимо кончилась память, узнал я об этом только через консоль тарантула. при всем при этом гошный коннектор ошибку не выдает а просто принимает данные как будто все хорошо. не подскажите куда копать что бы ошибка явно приходила? (the user uses Future.Err() to check the result of a request).
-- future.Err() не декодирует тело ответа msgpack, а ошибка может быть там. Нужно future.Get()/future.GetTyped() вызвать и ловить ошибку от них.
-- ого. очень и очень не очевидно. спасибо

@DerekBum
Copy link

DerekBum commented Nov 29, 2023

As a first priority task we want to do something with the Response struct. Here's some thoughts on how to redesign this struct:

The first approach is to create the Response interface.

We can create an interface:

type Response interface {
	Decode() ([]interface{}, error)
	DecodeTyped(res interface{}) error

	Pos() ([]byte, error) // just []byte
	MetaData() ([]ColumnMetaData, error) // just []ColumnMetaData
	SQLInfo() (SQLInfo, error) // just SQLInfo
}

And make the current Response implementation a part of it:

type baseResponse struct {
	requestId uint32
	code      uint32
	// Error contains an error message.
	error string
	buf   smallBuf
	data []interface // how it is already
	sqlInfo // // how it is already
	metadata // // how it is already
	pos // how it is already
}

After that, some changes to the Future methods needs to be done: all methods that return *Response needs to return just the Response. User could access old Pos, MetaData and SQLInfo fields via Pos(), MetaData() or SQLInfo methods call respectively.
Also, we could redesign Get() and GetTyped methods for the Future to return Data from the response (and not the response itself). To get the response new method could be added: GetResponse.

As example:

data, err := conn.Do(...).Get()
if err != nil {
        ...
}
// Do something with the response data.
resp, err := conn.Do(...).GetResponse()
if err != nil {
        ...
}
sqlInfo, err := resp.SQLInfo()
if err != nil {
        ...
}
// Do something with the response sql info.

Same goes with the Pos and MetaData.

The second approach is to create the Response interface and create different Response types for each Request type.

The problem with the first approach is that every request will have Pos, MetaData and SQLInfo methods regardless the actual need in them. Responses on some requests does not have those fields, some have only part of them.

So the idea is to create something like current Requests structure:

go-tarantool/request.go

Lines 820 to 824 in b2b800b

type baseRequest struct {
rtype iproto.Type
async bool
ctx context.Context
}

go-tarantool/request.go

Lines 841 to 844 in b2b800b

type spaceRequest struct {
baseRequest
space interface{}
}

go-tarantool/request.go

Lines 850 to 853 in b2b800b

type spaceIndexRequest struct {
spaceRequest
index interface{}
}

All in all, the response structure will be something like that:

type Response interface {
	Decode() ([]interface{}, error)
	DecodeTyped(res interface{}) error
}
type baseResponse struct {
	requestId uint32
	code      uint32
	// Error contains an error message.
	error string
	buf   smallBuf
}
type SelectResponse struct {
	baseResponse
        pos []byte
}
type ExecuteResponse struct {
	baseResponse
        metaData []ColumnMetaData
        sqlInfo []SQLInfo
}

But, there is also a downside from the user experience. Since the interface is minimalistic, to get the Pos, MetaData or SQLInfo, the user needs to try to convert the Request instance to the corresponding type first.
As an example:

resp, err := conn.Do(InsertRequest).GetResponse()
if err != nil {
        ...
}
data, err := resp.Decode()
if err != nil {
        ...
}
// Do something with the response data.

Data is easy accessible for every kind of response (no need to convert to anything). However,

resp, err := conn.Do(SelectRequest).GetResponse()
if err != nil {
        ...
}
selectResp, err := resp.(SelectResponse)
if err != nil {
        ...
}
pos := selectResp.GetPos()
// Do something with the response pos.
resp, err := conn.Do(ExecuteRequest).GetResponse()
if err != nil {
        ...
}
selectResp, err := resp.(ExecuteResponse)
if err != nil {
        ...
}
metaInfo := selectResp.GetMetaInfo()
sqlInfo := selectResp.GetSQLInfo()
// Do something.

There is no performance penalty in this method compared to the previous one.

For the developer-side: we also could create for each Request a new method: CreateResponse([]byte) (Response, error) that will return corresponding response.

What about user experience?

Which method is more user-friendly? (in case of any more discovered approaches to this problem, I will add them to this Issue).

DerekBum added a commit that referenced this issue Dec 7, 2023
DerekBum added a commit that referenced this issue Dec 7, 2023
DerekBum added a commit that referenced this issue Dec 7, 2023
DerekBum added a commit that referenced this issue Dec 7, 2023
DerekBum added a commit that referenced this issue Dec 7, 2023
DerekBum added a commit that referenced this issue Jan 10, 2024
DerekBum added a commit that referenced this issue Jan 11, 2024
This commit creates a new `Response` interface.
But still, only one `Response` implementation exists:
`ConnResponse`. But this change will make it easier to
create custom responses (mocks as well).

Create a `Response` interface and its implementation
`ConnResponse`.

For the `Future` method `Get` now returns response data.
To get the actual response new method `GetResponse` is added.

`IsPush()` method is added to the response iterator. It returns
the information if the current response is a `Push`.
Right now it does not have a lot of usage, but it will be
crutial once we create a separate response for pushes.

All deprecated asynchronous requests operations on a `Connector`
return response data instead of an actual responses.
All deprecated asynchronous requests operations on a `Pooler`
return response data instead of an actual responses.

Part of #237
DerekBum added a commit that referenced this issue Jan 11, 2024
Different implementations of the `Response` interface created.
Special types of responses are used with special requests.

Thus `Response` interface was simplified: some special methods
were moved to the corresponding implementations.
This means that if a user wants to access this methods, the
response should be casted to its actual type.

`SelectResponse`, `ExecuteResponse`, `PrepareResponse`,
`PushResponse` are part of a public API. `Pos()`, `MetaData()`,
`SQLInfo()` methods created for them to get specific info.

`Future` constructors now accept `Request` as their argument.
`Future` methods `AppendPush` and `SetResponse` accepts
response `Header` and data as their arguments.

`IsPush()` method is used to return the information if the current
response is a `PushResponse`. `PushCode` constant is removed. To get
information, if the current response is a push response, `IsPush()`
method could be used instead.

Part of #237
DerekBum added a commit that referenced this issue Jan 11, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structurem that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usege
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Closes #237
DerekBum added a commit that referenced this issue Jan 11, 2024
This commit creates a new `Response` interface.
But still, only one `Response` implementation exists:
`ConnResponse`. But this change will make it easier to
create custom responses (mocks as well).

Create a `Response` interface and its implementation
`ConnResponse`.

For the `Future` method `Get` now returns response data.
To get the actual response new method `GetResponse` is added.

`IsPush()` method is added to the response iterator. It returns
the information if the current response is a `Push`.
Right now it does not have a lot of usage, but it will be
crucial once we create a separate response for pushes.

All deprecated asynchronous requests operations on a `Connector`
return response data instead of an actual responses.
All deprecated asynchronous requests operations on a `Pooler`
return response data instead of an actual responses.

Part of #237
DerekBum added a commit that referenced this issue Jan 11, 2024
Different implementations of the `Response` interface created.
Special types of responses are used with special requests.

Thus `Response` interface was simplified: some special methods
were moved to the corresponding implementations.
This means that if a user wants to access this methods, the
response should be casted to its actual type.

`SelectResponse`, `ExecuteResponse`, `PrepareResponse`,
`PushResponse` are part of a public API. `Pos()`, `MetaData()`,
`SQLInfo()` methods created for them to get specific info.

`Future` constructors now accept `Request` as their argument.
`Future` methods `AppendPush` and `SetResponse` accepts
response `Header` and data as their arguments.

`IsPush()` method is used to return the information if the current
response is a `PushResponse`. `PushCode` constant is removed. To get
information, if the current response is a push response, `IsPush()`
method could be used instead.

Part of #237
DerekBum added a commit that referenced this issue Jan 11, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Closes #237
DerekBum added a commit that referenced this issue Jan 12, 2024
Different implementations of the `Response` interface created.
Special types of responses are used with special requests.

Thus `Response` interface was simplified: some special methods
were moved to the corresponding implementations.
This means that if a user wants to access this methods, the
response should be casted to its actual type.

`SelectResponse`, `ExecuteResponse`, `PrepareResponse`,
`PushResponse` are part of a public API. `Pos()`, `MetaData()`,
`SQLInfo()` methods created for them to get specific info.

`Future` constructors now accept `Request` as their argument.
`Future` methods `AppendPush` and `SetResponse` accepts
response `Header` and data as their arguments.

`IsPush()` method is used to return the information if the current
response is a `PushResponse`. `PushCode` constant is removed. To get
information, if the current response is a push response, `IsPush()`
method could be used instead.

Part of #237
DerekBum added a commit that referenced this issue Jan 12, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Closes #237
DerekBum added a commit that referenced this issue Jan 16, 2024
This commit creates a new `Response` interface.
But still, only one `Response` implementation exists:
`ConnResponse`. But this change will make it easier to
create custom responses (mocks as well).

Create a `Response` interface and its implementation
`ConnResponse`.

For the `Future` method `Get` now returns response data.
To get the actual response new method `GetResponse` is added.

`IsPush()` method is added to the response iterator. It returns
the information if the current response is a `Push`.
Right now it does not have a lot of usage, but it will be
crucial once we create a separate response for pushes.

All deprecated asynchronous requests operations on a `Connector`
return response data instead of an actual responses.
All deprecated asynchronous requests operations on a `Pooler`
return response data instead of an actual responses.

Part of #237
DerekBum added a commit that referenced this issue Jan 16, 2024
Different implementations of the `Response` interface created.
Special types of responses are used with special requests.

Thus `Response` interface was simplified: some special methods
were moved to the corresponding implementations.
This means that if a user wants to access this methods, the
response should be casted to its actual type.

`SelectResponse`, `ExecuteResponse`, `PrepareResponse`,
`PushResponse` are part of a public API. `Pos()`, `MetaData()`,
`SQLInfo()` methods created for them to get specific info.

`Future` constructors now accept `Request` as their argument.
`Future` methods `AppendPush` and `SetResponse` accepts
response `Header` and data as their arguments.

`IsPush()` method is used to return the information if the current
response is a `PushResponse`. `PushCode` constant is removed. To get
information, if the current response is a push response, `IsPush()`
method could be used instead.

Part of #237
DerekBum added a commit that referenced this issue Jan 21, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
DerekBum added a commit that referenced this issue Jan 22, 2024
This commit creates a new `Response` interface.
But still, only one `Response` implementation exists:
`ConnResponse`. Custom responses (including mocks)
are expected to implement this interface.

Create a `Response` interface and its implementation
`ConnResponse`.

For the `Future` method `Get` now returns response data.
To get the actual response new method `GetResponse` is added.

`IsPush()` method is added to the response iterator. It returns
the information if the current response is a `Push`.
Right now it does not have a lot of usage, but it will be
crucial once we create a separate response for pushes.

Part of #237
DerekBum added a commit that referenced this issue Jan 22, 2024
Different implementations of the `Response` interface created.
Special types of responses are used with special requests.

Thus `Response` interface was simplified: some special methods
were moved to the corresponding implementations.
This means that if a user wants to access this methods, the
response should be casted to its actual type.

`SelectResponse`, `ExecuteResponse`, `PrepareResponse`,
`PushResponse` are part of a public API. `Pos()`, `MetaData()`,
`SQLInfo()` methods created for them to get specific info.

`Future` constructors now accept `Request` as their argument.
`Future` methods `AppendPush` and `SetResponse` accepts
response `Header` and data as their arguments.

`IsPush()` method is used to return the information if the current
response is a `PushResponse`. `PushCode` constant is removed. To get
information, if the current response is a push response, `IsPush()`
method could be used instead.

After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Connector` return response data instead of an actual responses.
After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Pooler` return response data instead of an actual responses.

Part of #237
DerekBum added a commit that referenced this issue Jan 22, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
DerekBum added a commit that referenced this issue Jan 22, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
DerekBum added a commit that referenced this issue Jan 23, 2024
This commit creates a new `Response` interface.
But still, only one `Response` implementation exists:
`ConnResponse`. Custom responses (including mocks)
are expected to implement this interface.

Create a `Response` interface and its implementation
`ConnResponse`.

For the `Future` method `Get` now returns response data.
To get the actual response new method `GetResponse` is added.

`IsPush()` method is added to the response iterator. It returns
the information if the current response is a `Push`.
Right now it does not have a lot of usage, but it will be
crucial once we create a separate response for pushes.

Part of #237
DerekBum added a commit that referenced this issue Jan 23, 2024
Different implementations of the `Response` interface created.
Special types of responses are used with special requests.

Thus `Response` interface was simplified: some special methods
were moved to the corresponding implementations.
This means that if a user wants to access this methods, the
response should be casted to its actual type.

`SelectResponse`, `ExecuteResponse`, `PrepareResponse`,
`PushResponse` are part of a public API. `Pos()`, `MetaData()`,
`SQLInfo()` methods created for them to get specific info.

`Future` constructors now accept `Request` as their argument.
`Future` methods `AppendPush` and `SetResponse` accepts
response `Header` and data as their arguments.

`IsPush()` method is used to return the information if the current
response is a `PushResponse`. `PushCode` constant is removed. To get
information, if the current response is a push response, `IsPush()`
method could be used instead.

After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Connector` return response data instead of an actual responses.
After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Pooler` return response data instead of an actual responses.

Part of #237
DerekBum added a commit that referenced this issue Jan 23, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
DerekBum added a commit that referenced this issue Jan 24, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
DerekBum added a commit that referenced this issue Jan 24, 2024
Different implementations of the `Response` interface created.
Special types of responses are used with special requests.

Thus `Response` interface was simplified: some special methods
were moved to the corresponding implementations.
This means that if a user wants to access this methods, the
response should be casted to its actual type.

`SelectResponse`, `ExecuteResponse`, `PrepareResponse`,
`PushResponse` are part of a public API. `Pos()`, `MetaData()`,
`SQLInfo()` methods created for them to get specific info.

`Future` constructors now accept `Request` as their argument.
`Future` methods `AppendPush` and `SetResponse` accept
response `Header` and data as their arguments.

`IsPush()` method is used to return the information if the current
response is a `PushResponse`. `PushCode` constant is removed. To get
information, if the current response is a push response, `IsPush()`
method could be used instead.

After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Connector` return response data instead of an actual responses.
After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Pooler` return response data instead of an actual responses.

Part of #237
DerekBum added a commit that referenced this issue Jan 24, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
DerekBum added a commit that referenced this issue Jan 24, 2024
This commit creates a new `Response` interface.
But still, only one `Response` implementation exists:
`ConnResponse`. Custom responses (including mocks)
are expected to implement this interface.

Create a `Response` interface and its implementation
`ConnResponse`.

For the `Future` method `Get` now returns response data.
To get the actual response new method `GetResponse` is added.

`IsPush()` method is added to the response iterator. It returns
the information if the current response is a `Push`.
Right now it does not have a lot of usage, but it will be
crucial once we create a separate response for pushes.

Part of #237
DerekBum added a commit that referenced this issue Jan 24, 2024
Different implementations of the `Response` interface created.
Special types of responses are used with special requests.

Thus `Response` interface was simplified: some special methods
were moved to the corresponding implementations.
This means that if a user wants to access this methods, the
response should be casted to its actual type.

`SelectResponse`, `ExecuteResponse`, `PrepareResponse`,
`PushResponse` are part of a public API. `Pos()`, `MetaData()`,
`SQLInfo()` methods created for them to get specific info.

`Future` constructors now accept `Request` as their argument.
`Future` methods `AppendPush` and `SetResponse` accept
response `Header` and data as their arguments.

`IsPush()` method is used to return the information if the current
response is a `PushResponse`. `PushCode` constant is removed. To get
information, if the current response is a push response, `IsPush()`
method could be used instead.

After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Connector` return response data instead of an actual responses.
After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Pooler` return response data instead of an actual responses.

Part of #237
DerekBum added a commit that referenced this issue Jan 24, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
DerekBum added a commit that referenced this issue Jan 24, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
DerekBum added a commit that referenced this issue Jan 25, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
oleg-jukovec pushed a commit that referenced this issue Jan 25, 2024
This commit creates a new `Response` interface.
But still, only one `Response` implementation exists:
`ConnResponse`. Custom responses (including mocks)
are expected to implement this interface.

Create a `Response` interface and its implementation
`ConnResponse`.

For the `Future` method `Get` now returns response data.
To get the actual response new method `GetResponse` is added.

`IsPush()` method is added to the response iterator. It returns
the information if the current response is a `Push`.
Right now it does not have a lot of usage, but it will be
crucial once we create a separate response for pushes.

Part of #237
oleg-jukovec pushed a commit that referenced this issue Jan 25, 2024
Different implementations of the `Response` interface created.
Special types of responses are used with special requests.

Thus `Response` interface was simplified: some special methods
were moved to the corresponding implementations.
This means that if a user wants to access this methods, the
response should be casted to its actual type.

`SelectResponse`, `ExecuteResponse`, `PrepareResponse`,
`PushResponse` are part of a public API. `Pos()`, `MetaData()`,
`SQLInfo()` methods created for them to get specific info.

`Future` constructors now accept `Request` as their argument.
`Future` methods `AppendPush` and `SetResponse` accept
response `Header` and data as their arguments.

`IsPush()` method is used to return the information if the current
response is a `PushResponse`. `PushCode` constant is removed. To get
information, if the current response is a push response, `IsPush()`
method could be used instead.

After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Connector` return response data instead of an actual responses.
After this patch, operations `Ping`, `Select`, `Insert`, `Replace`,
`Delete`, `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
of a `Pooler` return response data instead of an actual responses.

Part of #237
oleg-jukovec pushed a commit that referenced this issue Jan 25, 2024
Create a mock implementations `MockRequest`, `MockResponse` and
`MockDoer`.
The last one allows to mock not the full `Connection`, but its
part -- a structure, that implements new `Doer` interface
(a `Do` function).

Also added missing comments, all the changes are recorded in
the `CHANGELOG` and `README` files. Added new tests and
examples.

So this entity is easier to implement and it is enough to
mock tests that require working `Connection`.
All new mock structs and an example for `MockDoer` usage
are added to the `test_helpers` package.

Added new structs `MockDoer`, `MockRequest` to `test_helpers`.
Renamed `StrangerResponse` to `MockResponse`.

Added new connection log constant: `LogAppendPushFailed`.
It is logged when connection fails to append a push response.

Closes #237
oleg-jukovec added a commit that referenced this issue Feb 11, 2024
Overview

    There are a lot of changes in the new major version. The main ones:

    * The `go_tarantool_call_17` build tag is no longer needed, since
      by default the `CallRequest` is `Call17Request`.
    * The `go_tarantool_msgpack_v5` build tag is no longer needed,
      since only the `msgpack/v5` library is used.
    * The `go_tarantool_ssl_disable` build tag is no longer needed,
      since the connector is no longer depends on `OpenSSL` by default.
      You could use the external library go-tlsdialer[1] to create a
      connection with the `ssl` transport.
    * Required Go version is `1.20` now.
    * The `Connect` function became more flexible. It now allows
      to create a connection with cancellation and a custom `Dialer`
      implementation.
    * It is required to use `Request` implementation types with the
      `Connection.Do` method instead of `Connection.<Request>` methods.
    * The `connection_pool` package renamed to `pool`.

    See the migration guide[2] for more details.

Breaking changes

    connection_pool renamed to pool (#239).

    Use msgpack/v5 instead of msgpack.v2 (#236).

    Call/NewCallRequest = Call17/NewCall17Request (#235).

    Change encoding of the queue.Identify() UUID argument from binary
    blob to plain string. Needed for upgrade to Tarantool 3.0, where a
    binary blob is decoded to a varbinary object (#313).

    Use objects of the Decimal type instead of pointers (#238).

    Use objects of the Datetime type instead of pointers (#238).

    `connection.Connect` no longer return non-working connection
    objects (#136). This function now does not attempt to reconnect
    and tries to establish a connection only once. Function might be
    canceled via context. Context accepted as first argument.
    `pool.Connect` and `pool.Add` now accept context as the first
    argument, which user may cancel in process. If `pool.Connect` is
    canceled in progress, an error will be returned. All created
    connections will be closed.

    `iproto.Feature` type now used instead of `ProtocolFeature` (#337).

    `iproto.IPROTO_FEATURE_` constants now used instead of local
    `Feature` constants for `protocol` (#337).

    Change `crud` operations `Timeout` option type to `crud.OptFloat64`
    instead of `crud.OptUint` (#342).

    Change all `Upsert` and `Update` requests to accept
    `*tarantool.Operations`  as `ops` parameters instead of
    `interface{}` (#348).

    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 (#321).

    Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
    Add `Addr()` function instead (#321).

    Remove `Connection.ClientProtocolInfo`,
    `Connection.ServerProtocolInfo`. Add `ProtocolInfo()` function
    instead, which returns the server protocol info (#321).

    `NewWatcher` checks the actual features of the server, rather
    than relying on the features provided by the user during connection
    creation (#321).

    `pool.NewWatcher` does not create watchers for connections that do
    not support it (#321).

    Rename `pool.GetPoolInfo` to `pool.GetInfo`. Change return type to
    `map[string]ConnectionInfo` (#321).

    `Response` is now an interface (#237).

    All responses are now implementations of the `Response`
    interface (#237). `SelectResponse`, `ExecuteResponse`,
    `PrepareResponse`, `PushResponse` are part of a public API.
    `Pos()`, `MetaData()`, `SQLInfo()` methods created for them to
    get specific info. Special types of responses are used with
    special requests.

    `IsPush()` method is added to the response iterator (#237). It
    returns the information if the current response is a
    `PushResponse`. `PushCode` constant is removed.

    Method `Get` for `Future` now returns response data (#237). To get
    the actual response new `GetResponse` method has been added.
    Methods `AppendPush` and `SetResponse` accept response `Header`
    and data as their arguments.

    `Future` constructors now accept `Request` as their argument
    (#237).

    Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`,
    `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
    of a `Connector` and `Pooler` return response data instead of an
    actual responses (#237).

    `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a
    new type `pool.Instance` to determinate connection options (#356).

    `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add
    connections to the pool even it is unable to connect to it (#372).

    Required Go version from `1.13` to `1.20` (#378).

    multi subpackage is removed (#240).

    msgpack.v2 support is removed (#236).

    pool/RoundRobinStrategy is removed (#158).

    DeadlineIO is removed (#158).

    UUID_extId is removed (#158).

    IPROTO constants are removed (#158).

    Code() method from the Request interface is removed (#158).

    `Schema` field from the `Connection` struct is removed (#7).

    `OkCode` and `PushCode` constants is removed (#237).

    SSL support is removed (#301).

    `Future.Err()` method is removed (#382).

New features

    Type() method to the Request interface (#158).

    Enumeration types for RLimitAction/iterators (#158).

    IsNullable flag for Field (#302).

    More linters on CI (#310).

    Meaningful description for read/write socket errors (#129).

    Support `operation_data` in `crud.Error` (#330).

    Support `fetch_latest_metadata` option for crud requests with
    metadata (#335).

    Support `noreturn` option for data change crud requests (#335).

    Support `crud.schema` request (#336, #351).

    Support `IPROTO_WATCH_ONCE` request type for Tarantool
    version >= 3.0.0-alpha1 (#337).

    Support `yield_every` option for crud select requests (#350).

    Support `IPROTO_FEATURE_SPACE_AND_INDEX_NAMES` for Tarantool
    version >= 3.0.0-alpha1 (#338). It allows to use space and index
    names in requests instead of their IDs.

    `GetSchema` function to get the actual schema (#7).

    Support connection via an existing socket fd (#321).

    `Header` struct for the response header (#237). It can be accessed
    via `Header()` method of the `Response` interface.

   `Response` method added to the `Request` interface (#237).

   New `LogAppendPushFailed` connection log constant (#237).
   It is logged when connection fails to append a push response.

   `ErrorNo` constant that indicates that no error has occurred while
   getting the response (#237).

   `AuthDialer` type for creating a dialer with authentication (#301).

   `ProtocolDialer` type for creating a dialer with `ProtocolInfo`
   receiving and  check (#301).

   `GreetingDialer` type for creating a dialer, that fills `Greeting`
   of a connection (#301).

   New method `Pool.DoInstance` to execute a request on a target
   instance in a pool (#376).

Bugfixes

    Race condition at roundRobinStrategy.GetNextConnection() (#309).

    Incorrect decoding of an MP_DECIMAL when the `scale` value is
    negative (#314).

    Incorrect options (`after`, `batch_size` and `force_map_call`)
    setup for crud.SelectRequest (#320).

    Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
    `prefer_replica`, `balance`) setup for crud.GetRequest (#335)

    Splice update operation accepts 3 arguments instead of 5 (#348).

    Unable to use a slice of custom types as a slice of tuples or
    objects for `crud.*ManyRequest/crud.*ObjectManyRequest` (#365).

Testing

    Added an ability to mock connections for tests (#237). Added new
    types `MockDoer`, `MockRequest` to `test_helpers`.

    Flaky decimal/TestSelect (#300).

    Tests with crud 1.4.0 (#336).

    Tests with case sensitive SQL (#341).

    Renamed `StrangerResponse` to `MockResponse` (#237).

Other

    All Connection.<Request>, Connection.<Request>Typed and
    Connection.<Request>Async methods are now deprecated. Instead you
    should use requests objects + Connection.Do() (#241).

    All ConnectionPool.<Request>, ConnectionPool.<Request>Typed and
    ConnectionPool.<Request>Async methods are now deprecated. Instead
    you should use requests objects + ConnectionPool.Do() (#241).

    box.session.push() usage is deprecated: Future.AppendPush() and
    Future.GetIterator() methods, ResponseIterator and
    TimeoutResponseIterator types (#324).

1. https://github.com/tarantool/go-tlsdialer
2. https://github.com/tarantool/go-tarantool/blob/master/MIGRATION.md
oleg-jukovec added a commit that referenced this issue Feb 11, 2024
Overview

    There are a lot of changes in the new major version. The main ones:

    * The `go_tarantool_call_17` build tag is no longer needed, since
      by default the `CallRequest` is `Call17Request`.
    * The `go_tarantool_msgpack_v5` build tag is no longer needed,
      since only the `msgpack/v5` library is used.
    * The `go_tarantool_ssl_disable` build tag is no longer needed,
      since the connector is no longer depends on `OpenSSL` by default.
      You could use the external library go-tlsdialer[1] to create a
      connection with the `ssl` transport.
    * Required Go version is `1.20` now.
    * The `Connect` function became more flexible. It now allows
      to create a connection with cancellation and a custom `Dialer`
      implementation.
    * It is required to use `Request` implementation types with the
      `Connection.Do` method instead of `Connection.<Request>` methods.
    * The `connection_pool` package renamed to `pool`.

    See the migration guide[2] for more details.

Breaking changes

    connection_pool renamed to pool (#239).

    Use msgpack/v5 instead of msgpack.v2 (#236).

    Call/NewCallRequest = Call17/NewCall17Request (#235).

    Change encoding of the queue.Identify() UUID argument from binary
    blob to plain string. Needed for upgrade to Tarantool 3.0, where a
    binary blob is decoded to a varbinary object (#313).

    Use objects of the Decimal type instead of pointers (#238).

    Use objects of the Datetime type instead of pointers (#238).

    `connection.Connect` no longer return non-working connection
    objects (#136). This function now does not attempt to reconnect
    and tries to establish a connection only once. Function might be
    canceled via context. Context accepted as first argument.
    `pool.Connect` and `pool.Add` now accept context as the first
    argument, which user may cancel in process. If `pool.Connect` is
    canceled in progress, an error will be returned. All created
    connections will be closed.

    `iproto.Feature` type now used instead of `ProtocolFeature` (#337).

    `iproto.IPROTO_FEATURE_` constants now used instead of local
    `Feature` constants for `protocol` (#337).

    Change `crud` operations `Timeout` option type to `crud.OptFloat64`
    instead of `crud.OptUint` (#342).

    Change all `Upsert` and `Update` requests to accept
    `*tarantool.Operations`  as `ops` parameters instead of
    `interface{}` (#348).

    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 (#321).

    Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
    Add `Addr()` function instead (#321).

    Remove `Connection.ClientProtocolInfo`,
    `Connection.ServerProtocolInfo`. Add `ProtocolInfo()` function
    instead, which returns the server protocol info (#321).

    `NewWatcher` checks the actual features of the server, rather
    than relying on the features provided by the user during connection
    creation (#321).

    `pool.NewWatcher` does not create watchers for connections that do
    not support it (#321).

    Rename `pool.GetPoolInfo` to `pool.GetInfo`. Change return type to
    `map[string]ConnectionInfo` (#321).

    `Response` is now an interface (#237).

    All responses are now implementations of the `Response`
    interface (#237). `SelectResponse`, `ExecuteResponse`,
    `PrepareResponse`, `PushResponse` are part of a public API.
    `Pos()`, `MetaData()`, `SQLInfo()` methods created for them to
    get specific info. Special types of responses are used with
    special requests.

    `IsPush()` method is added to the response iterator (#237). It
    returns the information if the current response is a
    `PushResponse`. `PushCode` constant is removed.

    Method `Get` for `Future` now returns response data (#237). To get
    the actual response new `GetResponse` method has been added.
    Methods `AppendPush` and `SetResponse` accept response `Header`
    and data as their arguments.

    `Future` constructors now accept `Request` as their argument
    (#237).

    Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`,
    `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
    of a `Connector` and `Pooler` return response data instead of an
    actual responses (#237).

    `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a
    new type `pool.Instance` to determinate connection options (#356).

    `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add
    connections to the pool even it is unable to connect to it (#372).

    Required Go version from `1.13` to `1.20` (#378).

    multi subpackage is removed (#240).

    msgpack.v2 support is removed (#236).

    pool/RoundRobinStrategy is removed (#158).

    DeadlineIO is removed (#158).

    UUID_extId is removed (#158).

    IPROTO constants are removed (#158).

    Code() method from the Request interface is removed (#158).

    `Schema` field from the `Connection` struct is removed (#7).

    `OkCode` and `PushCode` constants is removed (#237).

    SSL support is removed (#301).

    `Future.Err()` method is removed (#382).

New features

    Type() method to the Request interface (#158).

    Enumeration types for RLimitAction/iterators (#158).

    IsNullable flag for Field (#302).

    More linters on CI (#310).

    Meaningful description for read/write socket errors (#129).

    Support `operation_data` in `crud.Error` (#330).

    Support `fetch_latest_metadata` option for crud requests with
    metadata (#335).

    Support `noreturn` option for data change crud requests (#335).

    Support `crud.schema` request (#336, #351).

    Support `IPROTO_WATCH_ONCE` request type for Tarantool
    version >= 3.0.0-alpha1 (#337).

    Support `yield_every` option for crud select requests (#350).

    Support `IPROTO_FEATURE_SPACE_AND_INDEX_NAMES` for Tarantool
    version >= 3.0.0-alpha1 (#338). It allows to use space and index
    names in requests instead of their IDs.

    `GetSchema` function to get the actual schema (#7).

    Support connection via an existing socket fd (#321).

    `Header` struct for the response header (#237). It can be accessed
    via `Header()` method of the `Response` interface.

   `Response` method added to the `Request` interface (#237).

   New `LogAppendPushFailed` connection log constant (#237).
   It is logged when connection fails to append a push response.

   `ErrorNo` constant that indicates that no error has occurred while
   getting the response (#237).

   `AuthDialer` type for creating a dialer with authentication (#301).

   `ProtocolDialer` type for creating a dialer with `ProtocolInfo`
   receiving and  check (#301).

   `GreetingDialer` type for creating a dialer, that fills `Greeting`
   of a connection (#301).

   New method `Pool.DoInstance` to execute a request on a target
   instance in a pool (#376).

Bugfixes

    Race condition at roundRobinStrategy.GetNextConnection() (#309).

    Incorrect decoding of an MP_DECIMAL when the `scale` value is
    negative (#314).

    Incorrect options (`after`, `batch_size` and `force_map_call`)
    setup for crud.SelectRequest (#320).

    Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
    `prefer_replica`, `balance`) setup for crud.GetRequest (#335).

    Splice update operation accepts 3 arguments instead of 5 (#348).

    Unable to use a slice of custom types as a slice of tuples or
    objects for `crud.*ManyRequest/crud.*ObjectManyRequest` (#365).

Testing

    Added an ability to mock connections for tests (#237). Added new
    types `MockDoer`, `MockRequest` to `test_helpers`.

    Fixed flaky decimal/TestSelect (#300).

    Fixed tests with crud 1.4.0 (#336).

    Fixed tests with case sensitive SQL (#341).

    Renamed `StrangerResponse` to `MockResponse` (#237).

Other

    All Connection.<Request>, Connection.<Request>Typed and
    Connection.<Request>Async methods are now deprecated. Instead you
    should use requests objects + Connection.Do() (#241).

    All ConnectionPool.<Request>, ConnectionPool.<Request>Typed and
    ConnectionPool.<Request>Async methods are now deprecated. Instead
    you should use requests objects + ConnectionPool.Do() (#241).

    box.session.push() usage is deprecated: Future.AppendPush() and
    Future.GetIterator() methods, ResponseIterator and
    TimeoutResponseIterator types (#324).

1. https://github.com/tarantool/go-tlsdialer
2. https://github.com/tarantool/go-tarantool/blob/master/MIGRATION.md
oleg-jukovec added a commit that referenced this issue Feb 11, 2024
Overview

    There are a lot of changes in the new major version. The main ones:

    * The `go_tarantool_call_17` build tag is no longer needed, since
      by default the `CallRequest` is `Call17Request`.
    * The `go_tarantool_msgpack_v5` build tag is no longer needed,
      since only the `msgpack/v5` library is used.
    * The `go_tarantool_ssl_disable` build tag is no longer needed,
      since the connector is no longer depends on `OpenSSL` by default.
      You could use the external library go-tlsdialer[1] to create a
      connection with the `ssl` transport.
    * Required Go version is `1.20` now.
    * The `Connect` function became more flexible. It now allows
      to create a connection with cancellation and a custom `Dialer`
      implementation.
    * It is required to use `Request` implementation types with the
      `Connection.Do` method instead of `Connection.<Request>` methods.
    * The `connection_pool` package renamed to `pool`.

    See the migration guide[2] for more details.

Breaking changes

    connection_pool renamed to pool (#239).

    Use msgpack/v5 instead of msgpack.v2 (#236).

    Call/NewCallRequest = Call17/NewCall17Request (#235).

    Change encoding of the queue.Identify() UUID argument from binary
    blob to plain string. Needed for upgrade to Tarantool 3.0, where a
    binary blob is decoded to a varbinary object (#313).

    Use objects of the Decimal type instead of pointers (#238).

    Use objects of the Datetime type instead of pointers (#238).

    `connection.Connect` no longer return non-working connection
    objects (#136). This function now does not attempt to reconnect
    and tries to establish a connection only once. Function might be
    canceled via context. Context accepted as first argument.
    `pool.Connect` and `pool.Add` now accept context as the first
    argument, which user may cancel in process. If `pool.Connect` is
    canceled in progress, an error will be returned. All created
    connections will be closed.

    `iproto.Feature` type now used instead of `ProtocolFeature` (#337).

    `iproto.IPROTO_FEATURE_` constants now used instead of local
    `Feature` constants for `protocol` (#337).

    Change `crud` operations `Timeout` option type to `crud.OptFloat64`
    instead of `crud.OptUint` (#342).

    Change all `Upsert` and `Update` requests to accept
    `*tarantool.Operations`  as `ops` parameters instead of
    `interface{}` (#348).

    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 (#321).

    Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
    Add `Addr()` function instead (#321).

    Remove `Connection.ClientProtocolInfo`,
    `Connection.ServerProtocolInfo`. Add `ProtocolInfo()` function
    instead, which returns the server protocol info (#321).

    `NewWatcher` checks the actual features of the server, rather
    than relying on the features provided by the user during connection
    creation (#321).

    `pool.NewWatcher` does not create watchers for connections that do
    not support it (#321).

    Rename `pool.GetPoolInfo` to `pool.GetInfo`. Change return type to
    `map[string]ConnectionInfo` (#321).

    `Response` is now an interface (#237).

    All responses are now implementations of the `Response`
    interface (#237). `SelectResponse`, `ExecuteResponse`,
    `PrepareResponse`, `PushResponse` are part of a public API.
    `Pos()`, `MetaData()`, `SQLInfo()` methods created for them to
    get specific info. Special types of responses are used with
    special requests.

    `IsPush()` method is added to the response iterator (#237). It
    returns the information if the current response is a
    `PushResponse`. `PushCode` constant is removed.

    Method `Get` for `Future` now returns response data (#237). To get
    the actual response new `GetResponse` method has been added.
    Methods `AppendPush` and `SetResponse` accept response `Header`
    and data as their arguments.

    `Future` constructors now accept `Request` as their argument
    (#237).

    Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`,
    `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
    of a `Connector` and `Pooler` return response data instead of an
    actual responses (#237).

    `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a
    new type `pool.Instance` to determinate connection options (#356).

    `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add
    connections to the pool even it is unable to connect to it (#372).

    Required Go version from `1.13` to `1.20` (#378).

    multi subpackage is removed (#240).

    msgpack.v2 support is removed (#236).

    pool/RoundRobinStrategy is removed (#158).

    DeadlineIO is removed (#158).

    UUID_extId is removed (#158).

    IPROTO constants are removed (#158).

    Code() method from the Request interface is removed (#158).

    `Schema` field from the `Connection` struct is removed (#7).

    `OkCode` and `PushCode` constants is removed (#237).

    SSL support is removed (#301).

    `Future.Err()` method is removed (#382).

New features

    Type() method to the Request interface (#158).

    Enumeration types for RLimitAction/iterators (#158).

    IsNullable flag for Field (#302).

    Meaningful description for read/write socket errors (#129).

    Support `operation_data` in `crud.Error` (#330).

    Support `fetch_latest_metadata` option for crud requests with
    metadata (#335).

    Support `noreturn` option for data change crud requests (#335).

    Support `crud.schema` request (#336, #351).

    Support `IPROTO_WATCH_ONCE` request type for Tarantool
    version >= 3.0.0-alpha1 (#337).

    Support `yield_every` option for crud select requests (#350).

    Support `IPROTO_FEATURE_SPACE_AND_INDEX_NAMES` for Tarantool
    version >= 3.0.0-alpha1 (#338). It allows to use space and index
    names in requests instead of their IDs.

    `GetSchema` function to get the actual schema (#7).

    Support connection via an existing socket fd (#321).

    `Header` struct for the response header (#237). It can be accessed
    via `Header()` method of the `Response` interface.

   `Response` method added to the `Request` interface (#237).

   New `LogAppendPushFailed` connection log constant (#237).
   It is logged when connection fails to append a push response.

   `ErrorNo` constant that indicates that no error has occurred while
   getting the response (#237).

   `AuthDialer` type for creating a dialer with authentication (#301).

   `ProtocolDialer` type for creating a dialer with `ProtocolInfo`
   receiving and  check (#301).

   `GreetingDialer` type for creating a dialer, that fills `Greeting`
   of a connection (#301).

   New method `Pool.DoInstance` to execute a request on a target
   instance in a pool (#376).

Bugfixes

    Race condition at roundRobinStrategy.GetNextConnection() (#309).

    Incorrect decoding of an MP_DECIMAL when the `scale` value is
    negative (#314).

    Incorrect options (`after`, `batch_size` and `force_map_call`)
    setup for crud.SelectRequest (#320).

    Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
    `prefer_replica`, `balance`) setup for crud.GetRequest (#335).

    Splice update operation accepts 3 arguments instead of 5 (#348).

    Unable to use a slice of custom types as a slice of tuples or
    objects for `crud.*ManyRequest/crud.*ObjectManyRequest` (#365).

Testing

    More linters on CI (#310).

    Added an ability to mock connections for tests (#237). Added new
    types `MockDoer`, `MockRequest` to `test_helpers`.

    Fixed flaky decimal/TestSelect (#300).

    Fixed tests with crud 1.4.0 (#336).

    Fixed tests with case sensitive SQL (#341).

    Renamed `StrangerResponse` to `MockResponse` (#237).

Other

    All Connection.<Request>, Connection.<Request>Typed and
    Connection.<Request>Async methods are now deprecated. Instead you
    should use requests objects + Connection.Do() (#241).

    All ConnectionPool.<Request>, ConnectionPool.<Request>Typed and
    ConnectionPool.<Request>Async methods are now deprecated. Instead
    you should use requests objects + ConnectionPool.Do() (#241).

    box.session.push() usage is deprecated: Future.AppendPush() and
    Future.GetIterator() methods, ResponseIterator and
    TimeoutResponseIterator types (#324).

1. https://github.com/tarantool/go-tlsdialer
2. https://github.com/tarantool/go-tarantool/blob/master/MIGRATION.md
oleg-jukovec added a commit that referenced this issue Feb 11, 2024
Overview

    There are a lot of changes in the new major version. The main ones:

    * The `go_tarantool_call_17` build tag is no longer needed, since
      by default the `CallRequest` is `Call17Request`.
    * The `go_tarantool_msgpack_v5` build tag is no longer needed,
      since only the `msgpack/v5` library is used.
    * The `go_tarantool_ssl_disable` build tag is no longer needed,
      since the connector is no longer depends on `OpenSSL` by default.
      You could use the external library go-tlsdialer[1] to create a
      connection with the `ssl` transport.
    * Required Go version is `1.20` now.
    * The `Connect` function became more flexible. It now allows
      to create a connection with cancellation and a custom `Dialer`
      implementation.
    * It is required to use `Request` implementation types with the
      `Connection.Do` method instead of `Connection.<Request>` methods.
    * The `connection_pool` package renamed to `pool`.

    See the migration guide[2] for more details.

Breaking changes

    connection_pool renamed to pool (#239).

    Use msgpack/v5 instead of msgpack.v2 (#236).

    Call/NewCallRequest = Call17/NewCall17Request (#235).

    Change encoding of the queue.Identify() UUID argument from binary
    blob to plain string. Needed for upgrade to Tarantool 3.0, where a
    binary blob is decoded to a varbinary object (#313).

    Use objects of the Decimal type instead of pointers (#238).

    Use objects of the Datetime type instead of pointers (#238).

    `connection.Connect` no longer return non-working connection
    objects (#136). This function now does not attempt to reconnect
    and tries to establish a connection only once. Function might be
    canceled via context. Context accepted as first argument.
    `pool.Connect` and `pool.Add` now accept context as the first
    argument, which user may cancel in process. If `pool.Connect` is
    canceled in progress, an error will be returned. All created
    connections will be closed.

    `iproto.Feature` type now used instead of `ProtocolFeature` (#337).

    `iproto.IPROTO_FEATURE_` constants now used instead of local
    `Feature` constants for `protocol` (#337).

    Change `crud` operations `Timeout` option type to `crud.OptFloat64`
    instead of `crud.OptUint` (#342).

    Change all `Upsert` and `Update` requests to accept
    `*tarantool.Operations`  as `ops` parameters instead of
    `interface{}` (#348).

    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 (#321).

    Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
    Add `Addr()` function instead (#321).

    Remove `Connection.ClientProtocolInfo`,
    `Connection.ServerProtocolInfo`. Add `ProtocolInfo()` function
    instead, which returns the server protocol info (#321).

    `NewWatcher` checks the actual features of the server, rather
    than relying on the features provided by the user during connection
    creation (#321).

    `pool.NewWatcher` does not create watchers for connections that do
    not support it (#321).

    Rename `pool.GetPoolInfo` to `pool.GetInfo`. Change return type to
    `map[string]ConnectionInfo` (#321).

    `Response` is now an interface (#237).

    All responses are now implementations of the `Response`
    interface (#237). `SelectResponse`, `ExecuteResponse`,
    `PrepareResponse`, `PushResponse` are part of a public API.
    `Pos()`, `MetaData()`, `SQLInfo()` methods created for them to
    get specific info. Special types of responses are used with
    special requests.

    `IsPush()` method is added to the response iterator (#237). It
    returns the information if the current response is a
    `PushResponse`. `PushCode` constant is removed.

    Method `Get` for `Future` now returns response data (#237). To get
    the actual response new `GetResponse` method has been added.
    Methods `AppendPush` and `SetResponse` accept response `Header`
    and data as their arguments.

    `Future` constructors now accept `Request` as their argument
    (#237).

    Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`,
    `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
    of a `Connector` and `Pooler` return response data instead of an
    actual responses (#237).

    `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a
    new type `pool.Instance` to determinate connection options (#356).

    `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add
    connections to the pool even it is unable to connect to it (#372).

    Required Go version from `1.13` to `1.20` (#378).

    multi subpackage is removed (#240).

    msgpack.v2 support is removed (#236).

    pool/RoundRobinStrategy is removed (#158).

    DeadlineIO is removed (#158).

    UUID_extId is removed (#158).

    IPROTO constants are removed (#158).

    Code() method from the Request interface is removed (#158).

    `Schema` field from the `Connection` struct is removed (#7).

    `OkCode` and `PushCode` constants is removed (#237).

    SSL support is removed (#301).

    `Future.Err()` method is removed (#382).

New features

    Type() method to the Request interface (#158).

    Enumeration types for RLimitAction/iterators (#158).

    IsNullable flag for Field (#302).

    Meaningful description for read/write socket errors (#129).

    Support `operation_data` in `crud.Error` (#330).

    Support `fetch_latest_metadata` option for crud requests with
    metadata (#335).

    Support `noreturn` option for data change crud requests (#335).

    Support `crud.schema` request (#336, #351).

    Support `IPROTO_WATCH_ONCE` request type for Tarantool
    version >= 3.0.0-alpha1 (#337).

    Support `yield_every` option for crud select requests (#350).

    Support `IPROTO_FEATURE_SPACE_AND_INDEX_NAMES` for Tarantool
    version >= 3.0.0-alpha1 (#338). It allows to use space and index
    names in requests instead of their IDs.

    `GetSchema` function to get the actual schema (#7).

    Support connection via an existing socket fd (#321).

    `Header` struct for the response header (#237). It can be accessed
    via `Header()` method of the `Response` interface.

   `Response` method added to the `Request` interface (#237).

   New `LogAppendPushFailed` connection log constant (#237).
   It is logged when connection fails to append a push response.

   `ErrorNo` constant that indicates that no error has occurred while
   getting the response (#237).

   `AuthDialer` type for creating a dialer with authentication (#301).

   `ProtocolDialer` type for creating a dialer with `ProtocolInfo`
   receiving and  check (#301).

   `GreetingDialer` type for creating a dialer, that fills `Greeting`
   of a connection (#301).

   New method `Pool.DoInstance` to execute a request on a target
   instance in a pool (#376).

Bugfixes

    Race condition at roundRobinStrategy.GetNextConnection() (#309).

    Incorrect decoding of an MP_DECIMAL when the `scale` value is
    negative (#314).

    Incorrect options (`after`, `batch_size` and `force_map_call`)
    setup for crud.SelectRequest (#320).

    Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
    `prefer_replica`, `balance`) setup for crud.GetRequest (#335).

    Splice update operation accepts 3 arguments instead of 5 (#348).

    Unable to use a slice of custom types as a slice of tuples or
    objects for `crud.*ManyRequest/crud.*ObjectManyRequest` (#365).

Testing

    More linters on CI (#310).

    Added an ability to mock connections for tests (#237). Added new
    types `MockDoer`, `MockRequest` to `test_helpers`.

    Fixed flaky decimal/TestSelect (#300).

    Fixed tests with crud 1.4.0 (#336).

    Fixed tests with case sensitive SQL (#341).

    Renamed `StrangerResponse` to `MockResponse` (#237).

Other

    All Connection.<Request>, Connection.<Request>Typed and
    Connection.<Request>Async methods are now deprecated. Instead you
    should use requests objects + Connection.Do() (#241).

    All ConnectionPool.<Request>, ConnectionPool.<Request>Typed and
    ConnectionPool.<Request>Async methods are now deprecated. Instead
    you should use requests objects + ConnectionPool.Do() (#241).

    box.session.push() usage is deprecated: Future.AppendPush() and
    Future.GetIterator() methods, ResponseIterator and
    TimeoutResponseIterator types (#324).

1. https://github.com/tarantool/go-tlsdialer
2. https://github.com/tarantool/go-tarantool/blob/master/MIGRATION.md
oleg-jukovec added a commit that referenced this issue Feb 12, 2024
Overview

    There are a lot of changes in the new major version. The main ones:

    * The `go_tarantool_call_17` build tag is no longer needed, since
      by default the `CallRequest` is `Call17Request`.
    * The `go_tarantool_msgpack_v5` build tag is no longer needed,
      since only the `msgpack/v5` library is used.
    * The `go_tarantool_ssl_disable` build tag is no longer needed,
      since the connector is no longer depends on `OpenSSL` by default.
      You could use the external library go-tlsdialer[1] to create a
      connection with the `ssl` transport.
    * Required Go version is `1.20` now.
    * The `Connect` function became more flexible. It now allows
      to create a connection with cancellation and a custom `Dialer`
      implementation.
    * It is required to use `Request` implementation types with the
      `Connection.Do` method instead of `Connection.<Request>` methods.
    * The `connection_pool` package renamed to `pool`.

    See the migration guide[2] for more details.

Breaking changes

    connection_pool renamed to pool (#239).

    Use msgpack/v5 instead of msgpack.v2 (#236).

    Call/NewCallRequest = Call17/NewCall17Request (#235).

    Change encoding of the queue.Identify() UUID argument from binary
    blob to plain string. Needed for upgrade to Tarantool 3.0, where a
    binary blob is decoded to a varbinary object (#313).

    Use objects of the Decimal type instead of pointers (#238).

    Use objects of the Datetime type instead of pointers (#238).

    `connection.Connect` no longer return non-working connection
    objects (#136). This function now does not attempt to reconnect
    and tries to establish a connection only once. Function might be
    canceled via context. Context accepted as first argument.
    `pool.Connect` and `pool.Add` now accept context as the first
    argument, which user may cancel in process. If `pool.Connect` is
    canceled in progress, an error will be returned. All created
    connections will be closed.

    `iproto.Feature` type now used instead of `ProtocolFeature` (#337).

    `iproto.IPROTO_FEATURE_` constants now used instead of local
    `Feature` constants for `protocol` (#337).

    Change `crud` operations `Timeout` option type to `crud.OptFloat64`
    instead of `crud.OptUint` (#342).

    Change all `Upsert` and `Update` requests to accept
    `*tarantool.Operations`  as `ops` parameters instead of
    `interface{}` (#348).

    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 (#321).

    Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
    Add `Addr()` function instead (#321).

    Remove `Connection.ClientProtocolInfo`,
    `Connection.ServerProtocolInfo`. Add `ProtocolInfo()` function
    instead, which returns the server protocol info (#321).

    `NewWatcher` checks the actual features of the server, rather
    than relying on the features provided by the user during connection
    creation (#321).

    `pool.NewWatcher` does not create watchers for connections that do
    not support it (#321).

    Rename `pool.GetPoolInfo` to `pool.GetInfo`. Change return type to
    `map[string]ConnectionInfo` (#321).

    `Response` is now an interface (#237).

    All responses are now implementations of the `Response`
    interface (#237). `SelectResponse`, `ExecuteResponse`,
    `PrepareResponse`, `PushResponse` are part of a public API.
    `Pos()`, `MetaData()`, `SQLInfo()` methods created for them to
    get specific info. Special types of responses are used with
    special requests.

    `IsPush()` method is added to the response iterator (#237). It
    returns the information if the current response is a
    `PushResponse`. `PushCode` constant is removed.

    Method `Get` for `Future` now returns response data (#237). To get
    the actual response new `GetResponse` method has been added.
    Methods `AppendPush` and `SetResponse` accept response `Header`
    and data as their arguments.

    `Future` constructors now accept `Request` as their argument
    (#237).

    Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`,
    `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
    of a `Connector` and `Pooler` return response data instead of an
    actual responses (#237).

    `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a
    new type `pool.Instance` to determinate connection options (#356).

    `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add
    connections to the pool even it is unable to connect to it (#372).

    Required Go version from `1.13` to `1.20` (#378).

    multi subpackage is removed (#240).

    msgpack.v2 support is removed (#236).

    pool/RoundRobinStrategy is removed (#158).

    DeadlineIO is removed (#158).

    UUID_extId is removed (#158).

    IPROTO constants are removed (#158).

    Code() method from the Request interface is removed (#158).

    `Schema` field from the `Connection` struct is removed (#7).

    `OkCode` and `PushCode` constants is removed (#237).

    SSL support is removed (#301).

    `Future.Err()` method is removed (#382).

New features

    Type() method to the Request interface (#158).

    Enumeration types for RLimitAction/iterators (#158).

    IsNullable flag for Field (#302).

    Meaningful description for read/write socket errors (#129).

    Support `operation_data` in `crud.Error` (#330).

    Support `fetch_latest_metadata` option for crud requests with
    metadata (#335).

    Support `noreturn` option for data change crud requests (#335).

    Support `crud.schema` request (#336, #351).

    Support `IPROTO_WATCH_ONCE` request type for Tarantool
    version >= 3.0.0-alpha1 (#337).

    Support `yield_every` option for crud select requests (#350).

    Support `IPROTO_FEATURE_SPACE_AND_INDEX_NAMES` for Tarantool
    version >= 3.0.0-alpha1 (#338). It allows to use space and index
    names in requests instead of their IDs.

    `GetSchema` function to get the actual schema (#7).

    Support connection via an existing socket fd (#321).

    `Header` struct for the response header (#237). It can be accessed
    via `Header()` method of the `Response` interface.

   `Response` method added to the `Request` interface (#237).

   New `LogAppendPushFailed` connection log constant (#237).
   It is logged when connection fails to append a push response.

   `ErrorNo` constant that indicates that no error has occurred while
   getting the response (#237).

   `AuthDialer` type for creating a dialer with authentication (#301).

   `ProtocolDialer` type for creating a dialer with `ProtocolInfo`
   receiving and  check (#301).

   `GreetingDialer` type for creating a dialer, that fills `Greeting`
   of a connection (#301).

   New method `Pool.DoInstance` to execute a request on a target
   instance in a pool (#376).

Bugfixes

    Race condition at roundRobinStrategy.GetNextConnection() (#309).

    Incorrect decoding of an MP_DECIMAL when the `scale` value is
    negative (#314).

    Incorrect options (`after`, `batch_size` and `force_map_call`)
    setup for crud.SelectRequest (#320).

    Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
    `prefer_replica`, `balance`) setup for crud.GetRequest (#335).

    Splice update operation accepts 3 arguments instead of 5 (#348).

    Unable to use a slice of custom types as a slice of tuples or
    objects for `crud.*ManyRequest/crud.*ObjectManyRequest` (#365).

Testing

    More linters on CI (#310).

    Added an ability to mock connections for tests (#237). Added new
    types `MockDoer`, `MockRequest` to `test_helpers`.

    Fixed flaky decimal/TestSelect (#300).

    Fixed tests with crud 1.4.0 (#336).

    Fixed tests with case sensitive SQL (#341).

    Renamed `StrangerResponse` to `MockResponse` (#237).

Other

    All Connection.<Request>, Connection.<Request>Typed and
    Connection.<Request>Async methods are now deprecated. Instead you
    should use requests objects + Connection.Do() (#241).

    All ConnectionPool.<Request>, ConnectionPool.<Request>Typed and
    ConnectionPool.<Request>Async methods are now deprecated. Instead
    you should use requests objects + ConnectionPool.Do() (#241).

    box.session.push() usage is deprecated: Future.AppendPush() and
    Future.GetIterator() methods, ResponseIterator and
    TimeoutResponseIterator types (#324).

1. https://github.com/tarantool/go-tlsdialer
2. https://github.com/tarantool/go-tarantool/blob/master/MIGRATION.md
oleg-jukovec added a commit that referenced this issue Feb 12, 2024
Overview

    There are a lot of changes in the new major version. The main ones:

    * The `go_tarantool_call_17` build tag is no longer needed, since
      by default the `CallRequest` is `Call17Request`.
    * The `go_tarantool_msgpack_v5` build tag is no longer needed,
      since only the `msgpack/v5` library is used.
    * The `go_tarantool_ssl_disable` build tag is no longer needed,
      since the connector is no longer depends on `OpenSSL` by default.
      You could use the external library go-tlsdialer[1] to create a
      connection with the `ssl` transport.
    * Required Go version is `1.20` now.
    * The `Connect` function became more flexible. It now allows
      to create a connection with cancellation and a custom `Dialer`
      implementation.
    * It is required to use `Request` implementation types with the
      `Connection.Do` method instead of `Connection.<Request>` methods.
    * The `connection_pool` package renamed to `pool`.

    See the migration guide[2] for more details.

Breaking changes

    connection_pool renamed to pool (#239).

    Use msgpack/v5 instead of msgpack.v2 (#236).

    Call/NewCallRequest = Call17/NewCall17Request (#235).

    Change encoding of the queue.Identify() UUID argument from binary
    blob to plain string. Needed for upgrade to Tarantool 3.0, where a
    binary blob is decoded to a varbinary object (#313).

    Use objects of the Decimal type instead of pointers (#238).

    Use objects of the Datetime type instead of pointers (#238).

    `connection.Connect` no longer return non-working connection
    objects (#136). This function now does not attempt to reconnect
    and tries to establish a connection only once. Function might be
    canceled via context. Context accepted as first argument.
    `pool.Connect` and `pool.Add` now accept context as the first
    argument, which user may cancel in process. If `pool.Connect` is
    canceled in progress, an error will be returned. All created
    connections will be closed.

    `iproto.Feature` type now used instead of `ProtocolFeature` (#337).

    `iproto.IPROTO_FEATURE_` constants now used instead of local
    `Feature` constants for `protocol` (#337).

    Change `crud` operations `Timeout` option type to `crud.OptFloat64`
    instead of `crud.OptUint` (#342).

    Change all `Upsert` and `Update` requests to accept
    `*tarantool.Operations`  as `ops` parameters instead of
    `interface{}` (#348).

    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 (#321).

    Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
    Add `Addr()` function instead (#321).

    Remove `Connection.ClientProtocolInfo`,
    `Connection.ServerProtocolInfo`. Add `ProtocolInfo()` function
    instead, which returns the server protocol info (#321).

    `NewWatcher` checks the actual features of the server, rather
    than relying on the features provided by the user during connection
    creation (#321).

    `pool.NewWatcher` does not create watchers for connections that do
    not support it (#321).

    Rename `pool.GetPoolInfo` to `pool.GetInfo`. Change return type to
    `map[string]ConnectionInfo` (#321).

    `Response` is now an interface (#237).

    All responses are now implementations of the `Response`
    interface (#237). `SelectResponse`, `ExecuteResponse`,
    `PrepareResponse`, `PushResponse` are part of a public API.
    `Pos()`, `MetaData()`, `SQLInfo()` methods created for them to
    get specific info. Special types of responses are used with
    special requests.

    `IsPush()` method is added to the response iterator (#237). It
    returns the information if the current response is a
    `PushResponse`. `PushCode` constant is removed.

    Method `Get` for `Future` now returns response data (#237). To get
    the actual response new `GetResponse` method has been added.
    Methods `AppendPush` and `SetResponse` accept response `Header`
    and data as their arguments.

    `Future` constructors now accept `Request` as their argument
    (#237).

    Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`,
    `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
    of a `Connector` and `Pooler` return response data instead of an
    actual responses (#237).

    `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a
    new type `pool.Instance` to determinate connection options (#356).

    `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add
    connections to the pool even it is unable to connect to it (#372).

    Required Go version from `1.13` to `1.20` (#378).

    multi subpackage is removed (#240).

    msgpack.v2 support is removed (#236).

    pool/RoundRobinStrategy is removed (#158).

    DeadlineIO is removed (#158).

    UUID_extId is removed (#158).

    IPROTO constants are removed (#158).

    Code() method from the Request interface is removed (#158).

    `Schema` field from the `Connection` struct is removed (#7).

    `OkCode` and `PushCode` constants is removed (#237).

    SSL support is removed (#301).

    `Future.Err()` method is removed (#382).

New features

    Type() method to the Request interface (#158).

    Enumeration types for RLimitAction/iterators (#158).

    IsNullable flag for Field (#302).

    Meaningful description for read/write socket errors (#129).

    Support `operation_data` in `crud.Error` (#330).

    Support `fetch_latest_metadata` option for crud requests with
    metadata (#335).

    Support `noreturn` option for data change crud requests (#335).

    Support `crud.schema` request (#336, #351).

    Support `IPROTO_WATCH_ONCE` request type for Tarantool
    version >= 3.0.0-alpha1 (#337).

    Support `yield_every` option for crud select requests (#350).

    Support `IPROTO_FEATURE_SPACE_AND_INDEX_NAMES` for Tarantool
    version >= 3.0.0-alpha1 (#338). It allows to use space and index
    names in requests instead of their IDs.

    `GetSchema` function to get the actual schema (#7).

    Support connection via an existing socket fd (#321).

    `Header` struct for the response header (#237). It can be accessed
    via `Header()` method of the `Response` interface.

   `Response` method added to the `Request` interface (#237).

   New `LogAppendPushFailed` connection log constant (#237).
   It is logged when connection fails to append a push response.

   `ErrorNo` constant that indicates that no error has occurred while
   getting the response (#237).

   `AuthDialer` type for creating a dialer with authentication (#301).

   `ProtocolDialer` type for creating a dialer with `ProtocolInfo`
   receiving and  check (#301).

   `GreetingDialer` type for creating a dialer, that fills `Greeting`
   of a connection (#301).

   New method `Pool.DoInstance` to execute a request on a target
   instance in a pool (#376).

Bugfixes

    Race condition at roundRobinStrategy.GetNextConnection() (#309).

    Incorrect decoding of an MP_DECIMAL when the `scale` value is
    negative (#314).

    Incorrect options (`after`, `batch_size` and `force_map_call`)
    setup for crud.SelectRequest (#320).

    Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
    `prefer_replica`, `balance`) setup for crud.GetRequest (#335).

    Splice update operation accepts 3 arguments instead of 5 (#348).

    Unable to use a slice of custom types as a slice of tuples or
    objects for `crud.*ManyRequest/crud.*ObjectManyRequest` (#365).

Testing

    More linters on CI (#310).

    Added an ability to mock connections for tests (#237). Added new
    types `MockDoer`, `MockRequest` to `test_helpers`.

    Fixed flaky decimal/TestSelect (#300).

    Fixed tests with crud 1.4.0 (#336).

    Fixed tests with case sensitive SQL (#341).

    Renamed `StrangerResponse` to `MockResponse` (#237).

Other

    All Connection.<Request>, Connection.<Request>Typed and
    Connection.<Request>Async methods are now deprecated. Instead you
    should use requests objects + Connection.Do() (#241).

    All ConnectionPool.<Request>, ConnectionPool.<Request>Typed and
    ConnectionPool.<Request>Async methods are now deprecated. Instead
    you should use requests objects + ConnectionPool.Do() (#241).

    box.session.push() usage is deprecated: Future.AppendPush() and
    Future.GetIterator() methods, ResponseIterator and
    TimeoutResponseIterator types (#324).

1. https://github.com/tarantool/go-tlsdialer
2. https://github.com/tarantool/go-tarantool/blob/master/MIGRATION.md
oleg-jukovec added a commit that referenced this issue Feb 12, 2024
Overview

    There are a lot of changes in the new major version. The main ones:

    * The `go_tarantool_call_17` build tag is no longer needed, since
      by default the `CallRequest` is `Call17Request`.
    * The `go_tarantool_msgpack_v5` build tag is no longer needed,
      since only the `msgpack/v5` library is used.
    * The `go_tarantool_ssl_disable` build tag is no longer needed,
      since the connector is no longer depends on `OpenSSL` by default.
      You could use the external library go-tlsdialer[1] to create a
      connection with the `ssl` transport.
    * Required Go version is `1.20` now.
    * The `Connect` function became more flexible. It now allows
      to create a connection with cancellation and a custom `Dialer`
      implementation.
    * It is required to use `Request` implementation types with the
      `Connection.Do` method instead of `Connection.<Request>` methods.
    * The `connection_pool` package renamed to `pool`.

    See the migration guide[2] for more details.

Breaking changes

    connection_pool renamed to pool (#239).

    Use msgpack/v5 instead of msgpack.v2 (#236).

    Call/NewCallRequest = Call17/NewCall17Request (#235).

    Change encoding of the queue.Identify() UUID argument from binary
    blob to plain string. Needed for upgrade to Tarantool 3.0, where a
    binary blob is decoded to a varbinary object (#313).

    Use objects of the Decimal type instead of pointers (#238).

    Use objects of the Datetime type instead of pointers (#238).

    `connection.Connect` no longer return non-working connection
    objects (#136). This function now does not attempt to reconnect
    and tries to establish a connection only once. Function might be
    canceled via context. Context accepted as first argument.
    `pool.Connect` and `pool.Add` now accept context as the first
    argument, which user may cancel in process. If `pool.Connect` is
    canceled in progress, an error will be returned. All created
    connections will be closed.

    `iproto.Feature` type now used instead of `ProtocolFeature` (#337).

    `iproto.IPROTO_FEATURE_` constants now used instead of local
    `Feature` constants for `protocol` (#337).

    Change `crud` operations `Timeout` option type to `crud.OptFloat64`
    instead of `crud.OptUint` (#342).

    Change all `Upsert` and `Update` requests to accept
    `*tarantool.Operations`  as `ops` parameters instead of
    `interface{}` (#348).

    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 (#321).

    Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
    Add `Addr()` function instead (#321).

    Remove `Connection.ClientProtocolInfo`,
    `Connection.ServerProtocolInfo`. Add `ProtocolInfo()` function
    instead, which returns the server protocol info (#321).

    `NewWatcher` checks the actual features of the server, rather
    than relying on the features provided by the user during connection
    creation (#321).

    `pool.NewWatcher` does not create watchers for connections that do
    not support it (#321).

    Rename `pool.GetPoolInfo` to `pool.GetInfo`. Change return type to
    `map[string]ConnectionInfo` (#321).

    `Response` is now an interface (#237).

    All responses are now implementations of the `Response`
    interface (#237). `SelectResponse`, `ExecuteResponse`,
    `PrepareResponse`, `PushResponse` are part of a public API.
    `Pos()`, `MetaData()`, `SQLInfo()` methods created for them to
    get specific info. Special types of responses are used with
    special requests.

    `IsPush()` method is added to the response iterator (#237). It
    returns the information if the current response is a
    `PushResponse`. `PushCode` constant is removed.

    Method `Get` for `Future` now returns response data (#237). To get
    the actual response new `GetResponse` method has been added.
    Methods `AppendPush` and `SetResponse` accept response `Header`
    and data as their arguments.

    `Future` constructors now accept `Request` as their argument
    (#237).

    Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`,
    `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
    of a `Connector` and `Pooler` return response data instead of an
    actual responses (#237).

    `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a
    new type `pool.Instance` to determinate connection options (#356).

    `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add
    connections to the pool even it is unable to connect to it (#372).

    Required Go version from `1.13` to `1.20` (#378).

    multi subpackage is removed (#240).

    msgpack.v2 support is removed (#236).

    pool/RoundRobinStrategy is removed (#158).

    DeadlineIO is removed (#158).

    UUID_extId is removed (#158).

    IPROTO constants are removed (#158).

    Code() method from the Request interface is removed (#158).

    `Schema` field from the `Connection` struct is removed (#7).

    `OkCode` and `PushCode` constants is removed (#237).

    SSL support is removed (#301).

    `Future.Err()` method is removed (#382).

New features

    Type() method to the Request interface (#158).

    Enumeration types for RLimitAction/iterators (#158).

    IsNullable flag for Field (#302).

    Meaningful description for read/write socket errors (#129).

    Support `operation_data` in `crud.Error` (#330).

    Support `fetch_latest_metadata` option for crud requests with
    metadata (#335).

    Support `noreturn` option for data change crud requests (#335).

    Support `crud.schema` request (#336, #351).

    Support `IPROTO_WATCH_ONCE` request type for Tarantool
    version >= 3.0.0-alpha1 (#337).

    Support `yield_every` option for crud select requests (#350).

    Support `IPROTO_FEATURE_SPACE_AND_INDEX_NAMES` for Tarantool
    version >= 3.0.0-alpha1 (#338). It allows to use space and index
    names in requests instead of their IDs.

    `GetSchema` function to get the actual schema (#7).

    Support connection via an existing socket fd (#321).

    `Header` struct for the response header (#237). It can be accessed
    via `Header()` method of the `Response` interface.

   `Response` method added to the `Request` interface (#237).

   New `LogAppendPushFailed` connection log constant (#237).
   It is logged when connection fails to append a push response.

   `ErrorNo` constant that indicates that no error has occurred while
   getting the response (#237).

   `AuthDialer` type for creating a dialer with authentication (#301).

   `ProtocolDialer` type for creating a dialer with `ProtocolInfo`
   receiving and  check (#301).

   `GreetingDialer` type for creating a dialer, that fills `Greeting`
   of a connection (#301).

   New method `Pool.DoInstance` to execute a request on a target
   instance in a pool (#376).

Bugfixes

    Race condition at roundRobinStrategy.GetNextConnection() (#309).

    Incorrect decoding of an MP_DECIMAL when the `scale` value is
    negative (#314).

    Incorrect options (`after`, `batch_size` and `force_map_call`)
    setup for crud.SelectRequest (#320).

    Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
    `prefer_replica`, `balance`) setup for crud.GetRequest (#335).

    Splice update operation accepts 3 arguments instead of 5 (#348).

    Unable to use a slice of custom types as a slice of tuples or
    objects for `crud.*ManyRequest/crud.*ObjectManyRequest` (#365).

Testing

    More linters on CI (#310).

    Added an ability to mock connections for tests (#237). Added new
    types `MockDoer`, `MockRequest` to `test_helpers`.

    Fixed flaky decimal/TestSelect (#300).

    Fixed tests with crud 1.4.0 (#336).

    Fixed tests with case sensitive SQL (#341).

    Renamed `StrangerResponse` to `MockResponse` (#237).

Other

    All Connection.<Request>, Connection.<Request>Typed and
    Connection.<Request>Async methods are now deprecated. Instead you
    should use requests objects + Connection.Do() (#241).

    All ConnectionPool.<Request>, ConnectionPool.<Request>Typed and
    ConnectionPool.<Request>Async methods are now deprecated. Instead
    you should use requests objects + ConnectionPool.Do() (#241).

    box.session.push() usage is deprecated: Future.AppendPush() and
    Future.GetIterator() methods, ResponseIterator and
    TimeoutResponseIterator types (#324).

1. https://github.com/tarantool/go-tlsdialer
2. https://github.com/tarantool/go-tarantool/blob/master/MIGRATION.md
oleg-jukovec added a commit that referenced this issue Feb 12, 2024
Overview

    There are a lot of changes in the new major version. The main ones:

    * The `go_tarantool_call_17` build tag is no longer needed, since
      by default the `CallRequest` is `Call17Request`.
    * The `go_tarantool_msgpack_v5` build tag is no longer needed,
      since only the `msgpack/v5` library is used.
    * The `go_tarantool_ssl_disable` build tag is no longer needed,
      since the connector is no longer depends on `OpenSSL` by default.
      You could use the external library go-tlsdialer[1] to create a
      connection with the `ssl` transport.
    * Required Go version is `1.20` now.
    * The `Connect` function became more flexible. It now allows
      to create a connection with cancellation and a custom `Dialer`
      implementation.
    * It is required to use `Request` implementation types with the
      `Connection.Do` method instead of `Connection.<Request>` methods.
    * The `connection_pool` package renamed to `pool`.

    See the migration guide[2] for more details.

Breaking changes

    connection_pool renamed to pool (#239).

    Use msgpack/v5 instead of msgpack.v2 (#236).

    Call/NewCallRequest = Call17/NewCall17Request (#235).

    Change encoding of the queue.Identify() UUID argument from binary
    blob to plain string. Needed for upgrade to Tarantool 3.0, where a
    binary blob is decoded to a varbinary object (#313).

    Use objects of the Decimal type instead of pointers (#238).

    Use objects of the Datetime type instead of pointers (#238).

    `connection.Connect` no longer return non-working connection
    objects (#136). This function now does not attempt to reconnect
    and tries to establish a connection only once. Function might be
    canceled via context. Context accepted as first argument.
    `pool.Connect` and `pool.Add` now accept context as the first
    argument, which user may cancel in process. If `pool.Connect` is
    canceled in progress, an error will be returned. All created
    connections will be closed.

    `iproto.Feature` type now used instead of `ProtocolFeature` (#337).

    `iproto.IPROTO_FEATURE_` constants now used instead of local
    `Feature` constants for `protocol` (#337).

    Change `crud` operations `Timeout` option type to `crud.OptFloat64`
    instead of `crud.OptUint` (#342).

    Change all `Upsert` and `Update` requests to accept
    `*tarantool.Operations`  as `ops` parameters instead of
    `interface{}` (#348).

    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 (#321).

    Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
    Add `Addr()` function instead (#321).

    Remove `Connection.ClientProtocolInfo`,
    `Connection.ServerProtocolInfo`. Add `ProtocolInfo()` function
    instead, which returns the server protocol info (#321).

    `NewWatcher` checks the actual features of the server, rather
    than relying on the features provided by the user during connection
    creation (#321).

    `pool.NewWatcher` does not create watchers for connections that do
    not support it (#321).

    Rename `pool.GetPoolInfo` to `pool.GetInfo`. Change return type to
    `map[string]ConnectionInfo` (#321).

    `Response` is now an interface (#237).

    All responses are now implementations of the `Response`
    interface (#237). `SelectResponse`, `ExecuteResponse`,
    `PrepareResponse`, `PushResponse` are part of a public API.
    `Pos()`, `MetaData()`, `SQLInfo()` methods created for them to
    get specific info. Special types of responses are used with
    special requests.

    `IsPush()` method is added to the response iterator (#237). It
    returns the information if the current response is a
    `PushResponse`. `PushCode` constant is removed.

    Method `Get` for `Future` now returns response data (#237). To get
    the actual response new `GetResponse` method has been added.
    Methods `AppendPush` and `SetResponse` accept response `Header`
    and data as their arguments.

    `Future` constructors now accept `Request` as their argument
    (#237).

    Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`,
    `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
    of a `Connector` and `Pooler` return response data instead of an
    actual responses (#237).

    `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a
    new type `pool.Instance` to determinate connection options (#356).

    `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add
    connections to the pool even it is unable to connect to it (#372).

    Required Go version from `1.13` to `1.20` (#378).

    multi subpackage is removed (#240).

    msgpack.v2 support is removed (#236).

    pool/RoundRobinStrategy is removed (#158).

    DeadlineIO is removed (#158).

    UUID_extId is removed (#158).

    IPROTO constants are removed (#158).

    Code() method from the Request interface is removed (#158).

    `Schema` field from the `Connection` struct is removed (#7).

    `OkCode` and `PushCode` constants is removed (#237).

    SSL support is removed (#301).

    `Future.Err()` method is removed (#382).

New features

    Type() method to the Request interface (#158).

    Enumeration types for RLimitAction/iterators (#158).

    IsNullable flag for Field (#302).

    Meaningful description for read/write socket errors (#129).

    Support `operation_data` in `crud.Error` (#330).

    Support `fetch_latest_metadata` option for crud requests with
    metadata (#335).

    Support `noreturn` option for data change crud requests (#335).

    Support `crud.schema` request (#336, #351).

    Support `IPROTO_WATCH_ONCE` request type for Tarantool
    version >= 3.0.0-alpha1 (#337).

    Support `yield_every` option for crud select requests (#350).

    Support `IPROTO_FEATURE_SPACE_AND_INDEX_NAMES` for Tarantool
    version >= 3.0.0-alpha1 (#338). It allows to use space and index
    names in requests instead of their IDs.

    `GetSchema` function to get the actual schema (#7).

    Support connection via an existing socket fd (#321).

    `Header` struct for the response header (#237). It can be accessed
    via `Header()` method of the `Response` interface.

   `Response` method added to the `Request` interface (#237).

   New `LogAppendPushFailed` connection log constant (#237).
   It is logged when connection fails to append a push response.

   `ErrorNo` constant that indicates that no error has occurred while
   getting the response (#237).

   `AuthDialer` type for creating a dialer with authentication (#301).

   `ProtocolDialer` type for creating a dialer with `ProtocolInfo`
   receiving and  check (#301).

   `GreetingDialer` type for creating a dialer, that fills `Greeting`
   of a connection (#301).

   New method `Pool.DoInstance` to execute a request on a target
   instance in a pool (#376).

Bugfixes

    Race condition at roundRobinStrategy.GetNextConnection() (#309).

    Incorrect decoding of an MP_DECIMAL when the `scale` value is
    negative (#314).

    Incorrect options (`after`, `batch_size` and `force_map_call`)
    setup for crud.SelectRequest (#320).

    Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
    `prefer_replica`, `balance`) setup for crud.GetRequest (#335).

    Splice update operation accepts 3 arguments instead of 5 (#348).

    Unable to use a slice of custom types as a slice of tuples or
    objects for `crud.*ManyRequest/crud.*ObjectManyRequest` (#365).

Testing

    More linters on CI (#310).

    Added an ability to mock connections for tests (#237). Added new
    types `MockDoer`, `MockRequest` to `test_helpers`.

    Fixed flaky decimal/TestSelect (#300).

    Fixed tests with crud 1.4.0 (#336).

    Fixed tests with case sensitive SQL (#341).

    Renamed `StrangerResponse` to `MockResponse` (#237).

Other

    All Connection.<Request>, Connection.<Request>Typed and
    Connection.<Request>Async methods are now deprecated. Instead you
    should use requests objects + Connection.Do() (#241).

    All ConnectionPool.<Request>, ConnectionPool.<Request>Typed and
    ConnectionPool.<Request>Async methods are now deprecated. Instead
    you should use requests objects + ConnectionPool.Do() (#241).

    box.session.push() usage is deprecated: Future.AppendPush() and
    Future.GetIterator() methods, ResponseIterator and
    TimeoutResponseIterator types (#324).

1. https://github.com/tarantool/go-tlsdialer
2. https://github.com/tarantool/go-tarantool/blob/master/MIGRATION.md
oleg-jukovec added a commit that referenced this issue Feb 12, 2024
Overview

    There are a lot of changes in the new major version. The main ones:

    * The `go_tarantool_call_17` build tag is no longer needed, since
      by default the `CallRequest` is `Call17Request`.
    * The `go_tarantool_msgpack_v5` build tag is no longer needed,
      since only the `msgpack/v5` library is used.
    * The `go_tarantool_ssl_disable` build tag is no longer needed,
      since the connector is no longer depends on `OpenSSL` by default.
      You could use the external library go-tlsdialer[1] to create a
      connection with the `ssl` transport.
    * Required Go version is `1.20` now.
    * The `Connect` function became more flexible. It now allows
      to create a connection with cancellation and a custom `Dialer`
      implementation.
    * It is required to use `Request` implementation types with the
      `Connection.Do` method instead of `Connection.<Request>` methods.
    * The `connection_pool` package renamed to `pool`.

    See the migration guide[2] for more details.

Breaking changes

    connection_pool renamed to pool (#239).

    Use msgpack/v5 instead of msgpack.v2 (#236).

    Call/NewCallRequest = Call17/NewCall17Request (#235).

    Change encoding of the queue.Identify() UUID argument from binary
    blob to plain string. Needed for upgrade to Tarantool 3.0, where a
    binary blob is decoded to a varbinary object (#313).

    Use objects of the Decimal type instead of pointers (#238).

    Use objects of the Datetime type instead of pointers (#238).

    `connection.Connect` no longer return non-working connection
    objects (#136). This function now does not attempt to reconnect
    and tries to establish a connection only once. Function might be
    canceled via context. Context accepted as first argument.
    `pool.Connect` and `pool.Add` now accept context as the first
    argument, which user may cancel in process. If `pool.Connect` is
    canceled in progress, an error will be returned. All created
    connections will be closed.

    `iproto.Feature` type now used instead of `ProtocolFeature` (#337).

    `iproto.IPROTO_FEATURE_` constants now used instead of local
    `Feature` constants for `protocol` (#337).

    Change `crud` operations `Timeout` option type to `crud.OptFloat64`
    instead of `crud.OptUint` (#342).

    Change all `Upsert` and `Update` requests to accept
    `*tarantool.Operations`  as `ops` parameters instead of
    `interface{}` (#348).

    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 (#321).

    Remove `Connection.RemoteAddr()`, `Connection.LocalAddr()`.
    Add `Addr()` function instead (#321).

    Remove `Connection.ClientProtocolInfo`,
    `Connection.ServerProtocolInfo`. Add `ProtocolInfo()` function
    instead, which returns the server protocol info (#321).

    `NewWatcher` checks the actual features of the server, rather
    than relying on the features provided by the user during connection
    creation (#321).

    `pool.NewWatcher` does not create watchers for connections that do
    not support it (#321).

    Rename `pool.GetPoolInfo` to `pool.GetInfo`. Change return type to
    `map[string]ConnectionInfo` (#321).

    `Response` is now an interface (#237).

    All responses are now implementations of the `Response`
    interface (#237). `SelectResponse`, `ExecuteResponse`,
    `PrepareResponse`, `PushResponse` are part of a public API.
    `Pos()`, `MetaData()`, `SQLInfo()` methods created for them to
    get specific info. Special types of responses are used with
    special requests.

    `IsPush()` method is added to the response iterator (#237). It
    returns the information if the current response is a
    `PushResponse`. `PushCode` constant is removed.

    Method `Get` for `Future` now returns response data (#237). To get
    the actual response new `GetResponse` method has been added.
    Methods `AppendPush` and `SetResponse` accept response `Header`
    and data as their arguments.

    `Future` constructors now accept `Request` as their argument
    (#237).

    Operations `Ping`, `Select`, `Insert`, `Replace`, `Delete`,
    `Update`, `Upsert`, `Call`, `Call16`, `Call17`, `Eval`, `Execute`
    of a `Connector` and `Pooler` return response data instead of an
    actual responses (#237).

    `pool.Connect`, `pool.ConnetcWithOpts` and `pool.Add` use a
    new type `pool.Instance` to determinate connection options (#356).

    `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add
    connections to the pool even it is unable to connect to it (#372).

    Required Go version from `1.13` to `1.20` (#378).

    multi subpackage is removed (#240).

    msgpack.v2 support is removed (#236).

    pool/RoundRobinStrategy is removed (#158).

    DeadlineIO is removed (#158).

    UUID_extId is removed (#158).

    IPROTO constants are removed (#158).

    Code() method from the Request interface is removed (#158).

    `Schema` field from the `Connection` struct is removed (#7).

    `OkCode` and `PushCode` constants is removed (#237).

    SSL support is removed (#301).

    `Future.Err()` method is removed (#382).

New features

    Type() method to the Request interface (#158).

    Enumeration types for RLimitAction/iterators (#158).

    IsNullable flag for Field (#302).

    Meaningful description for read/write socket errors (#129).

    Support `operation_data` in `crud.Error` (#330).

    Support `fetch_latest_metadata` option for crud requests with
    metadata (#335).

    Support `noreturn` option for data change crud requests (#335).

    Support `crud.schema` request (#336, #351).

    Support `IPROTO_WATCH_ONCE` request type for Tarantool
    version >= 3.0.0-alpha1 (#337).

    Support `yield_every` option for crud select requests (#350).

    Support `IPROTO_FEATURE_SPACE_AND_INDEX_NAMES` for Tarantool
    version >= 3.0.0-alpha1 (#338). It allows to use space and index
    names in requests instead of their IDs.

    `GetSchema` function to get the actual schema (#7).

    Support connection via an existing socket fd (#321).

    `Header` struct for the response header (#237). It can be accessed
    via `Header()` method of the `Response` interface.

   `Response` method added to the `Request` interface (#237).

   New `LogAppendPushFailed` connection log constant (#237).
   It is logged when connection fails to append a push response.

   `ErrorNo` constant that indicates that no error has occurred while
   getting the response (#237).

   `AuthDialer` type for creating a dialer with authentication (#301).

   `ProtocolDialer` type for creating a dialer with `ProtocolInfo`
   receiving and  check (#301).

   `GreetingDialer` type for creating a dialer, that fills `Greeting`
   of a connection (#301).

   New method `Pool.DoInstance` to execute a request on a target
   instance in a pool (#376).

Bugfixes

    Race condition at roundRobinStrategy.GetNextConnection() (#309).

    Incorrect decoding of an MP_DECIMAL when the `scale` value is
    negative (#314).

    Incorrect options (`after`, `batch_size` and `force_map_call`)
    setup for crud.SelectRequest (#320).

    Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
    `prefer_replica`, `balance`) setup for crud.GetRequest (#335).

    Splice update operation accepts 3 arguments instead of 5 (#348).

    Unable to use a slice of custom types as a slice of tuples or
    objects for `crud.*ManyRequest/crud.*ObjectManyRequest` (#365).

Testing

    More linters on CI (#310).

    Added an ability to mock connections for tests (#237). Added new
    types `MockDoer`, `MockRequest` to `test_helpers`.

    Fixed flaky decimal/TestSelect (#300).

    Fixed tests with crud 1.4.0 (#336).

    Fixed tests with case sensitive SQL (#341).

    Renamed `StrangerResponse` to `MockResponse` (#237).

Other

    All Connection.<Request>, Connection.<Request>Typed and
    Connection.<Request>Async methods are now deprecated. Instead you
    should use requests objects + Connection.Do() (#241).

    All ConnectionPool.<Request>, ConnectionPool.<Request>Typed and
    ConnectionPool.<Request>Async methods are now deprecated. Instead
    you should use requests objects + ConnectionPool.Do() (#241).

    box.session.push() usage is deprecated: Future.AppendPush() and
    Future.GetIterator() methods, ResponseIterator and
    TimeoutResponseIterator types (#324).

1. https://github.com/tarantool/go-tlsdialer
2. https://github.com/tarantool/go-tarantool/blob/master/MIGRATION.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants