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

Commits on Jan 25, 2024

  1. api: change Response type to interface

    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 authored and oleg-jukovec committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    4784b55 View commit details
    Browse the repository at this point in the history
  2. api: create different responses for different requests

    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 authored and oleg-jukovec committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    c59e514 View commit details
    Browse the repository at this point in the history
  3. api: add ability to mock connections in tests

    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 authored and oleg-jukovec committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    514b0d0 View commit details
    Browse the repository at this point in the history
  4. ci: bump 1.10 master for macOS

    1.10.14 build is flacky on macOS-12 runner.
    Bump to 1.10.15 hopefully helps with this issue.
    DerekBum authored and oleg-jukovec committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    a2ad272 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2024

  1. bugfix: fix read/write goroutine alive after tests

    TestConn_ReadWrite causes endless read/write in goroutines after
    execution of the test. The patch fixes the problem.
    oleg-jukovec committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    b6e0c4a View commit details
    Browse the repository at this point in the history
  2. pool: add Instance type

    The type Instance:
    ```
    type Instance struct {
    	// Name is an unique name of the instance.
    	Name   string
    	// Dialer will be used to create a connection to the instance.
    	Dialer tarantool.Dialer
    	// Opts will be used to specify a connection options.
    	Opts   tarantool.Opts
    }
    ```
    
    The type allows to specify a dialer and connection options per a
    pool instance. It is used in `pool.Connect`, `pool.ConnectWithOpts`
    and `pool.Add` to specify an instance configuration now.
    
    Closes #356
    oleg-jukovec committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    b8d9914 View commit details
    Browse the repository at this point in the history