Based on the applications that use pool, most of them simply
set session token duration to MaxUint64 value. It is completely
understandable, because epochs are incrementing and expiration
value will be surpassed sooner or later, unless it is MaxUint64.
As an alternative I suggest specifying duration instead of
absolute epoch values. Now apps can set duration of 100-200
epochs and pool automatically calculated expiration epoch
base on the network info.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
PutContainer method takes `container.Container` structure
as an argument. This structure already contains session
token field, so there is no need in `prmSession` because it
duplicates session token definition.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This is done to prevent import cycles when `object` package needs any other
that requires `object.ID` or `object.Address`.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Define `XPrm` type for each `X` client operation which structures
parameters. Export setters of each parameterized value. Emphasize that
some parameters are required. Make the client panic when the parameters
are incorrectly set. Get rid of vadiadic call options and `CallOption`
type. Improve documentation of client behavior.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Default session token is created for object service requests
and should not be reused in container or any other service requests.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
Define base `Status` interface. Provide the functionality to distinguish
success and failure returns. Provide functionality to transport statuses
over NeoFS API V2 protocol. Support success `OK` and failure `INTERNAL`
returns.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Another possible panic (though quite rare).
```
--- FAIL: TestTwoNodes (0.00s)
pool.go:185: Unexpected call to *pool.MockClient.EndpointInfo([context.Background.WithCancel.WithDeadline(2021-10-26 15:50:50.005585875 +0300 MSK m=+1.216577808 [-940.323µs])]) at /home/dzeta/repo/neofs-sdk-go/pool/pool.go:185 because: there are no expected calls of the method "EndpointInfo" for that receiver
pool.go:185: Unexpected call to *pool.MockClient.EndpointInfo([context.Background.WithCancel.WithDeadline(2021-10-26 15:50:50.005715623 +0300 MSK m=+1.216707547 [-1.351991ms])]) at /home/dzeta/repo/neofs-sdk-go/pool/pool.go:185 because: there are no expected calls of the method "EndpointInfo" for that receiver
```
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
We have go1.16 in go.mod and `gomock.NewController` comment indicates:
```
New in go1.14+, if you are passing a *testing.T into this function you no
longer need to call ctrl.Finish() in your test methods.
```
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Since we transformed the pool of gRPC connection into the pool of
neofs clients, we don't need to call EndpointInfo to fetch the
address of the node for the beautiful error output.
Moreover it is done incorrectly, because c.CreateSession may return
context.Cancelled error (graceful shutdown). We will reuse the same
context for the EndpointInfo call which will lead to a
timeout freeze.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>