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

[pull] master from tarantool:master #67

Merged
merged 6 commits into from
Jan 28, 2024
Merged

Conversation

pull[bot]
Copy link

@pull pull bot commented Jan 25, 2024

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

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
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
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
1.10.14 build is flacky on macOS-12 runner.
Bump to 1.10.15 hopefully helps with this issue.
@pull pull bot added the ⤵️ pull label Jan 25, 2024
TestConn_ReadWrite causes endless read/write in goroutines after
execution of the test. The patch fixes the problem.
The type Instance:
```
type Instance struct {
	// Name is an unique name of the instance.
	Name   string
	// Dialer will be used to create a connection to the instance.
	Dialer tarantool.Dialer
	// Opts will be used to specify a connection options.
	Opts   tarantool.Opts
}
```

The type allows to specify a dialer and connection options per a
pool instance. It is used in `pool.Connect`, `pool.ConnectWithOpts`
and `pool.Add` to specify an instance configuration now.

Closes #356
@kokizzu kokizzu merged commit b8d9914 into kokizzu:master Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants