Commit graph

55 commits

Author SHA1 Message Date
Denis Kirillov
61f9c3392b [#159] Add object context to session tokens
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-03-03 15:08:47 +03:00
Evgenii Stratonikov
07817fb403 [#148] client: Allow to iterate over search results
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-28 10:19:35 +03:00
Evgenii Stratonikov
fa670ab57a *: Fix linter warnings
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-24 18:49:55 +03:00
Leonard Lyubich
29c057272c [#147] pool: Limit buffer length by 3MB in PutObject
In previous implementation we wrote up to 4KB payload chunk per-call.
This led to sending a large number of messages with a large
amount of payload.

Increase buffer length limit to 3MB.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-22 09:09:22 +03:00
Denis Kirillov
5386694a1a [#142] Drop retry for container operations
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-02-21 16:48:28 +03:00
Leonard Lyubich
66bc59da5c [#146] pool: Set private key in object HEAD/DELETE
Use call private key parameterized in `HeadObject` / `DeleteObject`
methods of `Pool` as corresponding key for `ObjectHead` / `ObjectDelete`
methods of `Client`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-21 15:21:37 +03:00
Leonard Lyubich
69ffface78 [#131] client: Name all methods and types the same way
Inherit name format of object operations in all other ones.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
998bae3f1c [#131] pool: Sign session token before caching in newPool
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
37f0cde78d [#131] client: Remove SetEACLPrm.SetSessionToken
From now session token for `SetEACL` operation should be written into
eACL table structure (similar to `PutContainer`).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
d90fe8fbab [#131] client: Remove no longer needed code
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
1130c1f5a6 [#131] pool: Limit session lifetime in openDefaultSession method
Call `createSessionTokenForDuration` function for session opening in
`pool.openDefaultSession` method in order to limit session lifetime
according to pool configuration (`SessionExpirationDuration`).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
28b49419ab [#131] client: Re-implement Object Delete and Hash methods
Also remove unused methods of `pool.Client` and `pool.Pool`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
fb3501752d [#131] client: Re-implement Object.Search method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
ff4febff6f [#131] client: Re-implement Object.Range method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
7de81cd585 [#131] pool: Fix ineffectual error assignments
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
caf31a928c [#131] client: Re-implement Object.Head method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
8d734d1020 [#131] client: Add ID suffix to ResObjectPut.ReadStoredObject
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
b508f3b71e [#131] pool: Refactor retry сalls
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
d5ce5d63b4 [#131] pool: Remove redundant var from pool.PutObject
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
2624347d9b [#131] client: Change interface of object PUT and GET ops
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Alex Vanin
40aaaafc73 [#126] pool: Do not resend object Put requests
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-02-11 14:21:59 +03:00
Alex Vanin
de4eedcd61 [#126] pool: Store access time in the session token cache
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-02-11 14:21:59 +03:00
Alex Vanin
ac66db59e0 [#130] pool: Set default session token lifetime before initial requests
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-02-10 16:20:06 +03:00
Alex Vanin
b6abb02ace [#130] pool: Add default session token duration
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-02-09 10:10:00 +03:00
Alex Vanin
bfff21965d [#130] pool: Process expired session tokens as invalid
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-02-09 10:10:00 +03:00
Alex Vanin
a86c08b3ee [#130] pool: Replace expiration value with expiration duration
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>
2022-02-09 10:10:00 +03:00
Alex Vanin
2a72f180dc [#133] client: Don't accept session token params in PutContainer
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>
2022-02-08 10:42:58 +03:00
Pavel Karpy
e8eac3997c [#128] object: Move ID and Address in subpkg
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>
2022-02-01 17:03:12 +03:00
Leonard Lyubich
213d20e3fb [#92] client: Accept structured parameters in non-object operations
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>
2022-02-01 17:02:43 +03:00
Evgenii Stratonikov
596774ce5b [#103] owner: remove NEO3Wallet type
Allow to use public keys and N3 wallet accounts instead.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-01-21 11:01:44 +03:00
Denis Kirillov
dd91fbd6ef [#118] Use correct owner in session token
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-01-18 13:21:40 +03:00
Pavel Karpy
7f31621106 [#114] pool: Use "simple" error handling in pool
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-13 15:37:43 +03:00
Pavel Karpy
b50bff53e7 [#111] pool: Adopt new client.New signature
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-11 11:03:14 +03:00
Alex Vanin
2fd5802c48 [#105] pool: Add balance command
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-12-17 15:11:23 +03:00
Alex Vanin
b1770ecb92 [#70] pool: Ignore default session token in non object service requests
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>
2021-12-16 19:14:45 +03:00
Denis Kirillov
2806d90089 [#93] Remove golang.org/x/crypto dependency
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-12-14 15:27:04 +03:00
Denis Kirillov
fa7c01bd0b [#74] Fix some tests
For some tests enough empty results.

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-26 16:17:45 +03:00
Denis Kirillov
618eeb8172 [#74] Add priority to nodes
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-26 16:17:45 +03:00
Leonard Lyubich
d9317cbea1 [#83] pool: Temporary skip tests with mocked client
After update of `client.Client` interface it can't be mocked.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-23 13:03:40 +03:00
Leonard Lyubich
639ab1e443 [#83] pool: Support changes of client.Client interface
Handle status results and return status failures in `error` return.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-23 13:03:40 +03:00
Leonard Lyubich
9dcff95a29 [#83] client: Implement status library
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>
2021-11-23 13:03:40 +03:00
Evgenii Stratonikov
a2d342e928 [#87] go.mod: remove neo-go dependency
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-22 15:40:13 +03:00
Denis Kirillov
e2c740ae8d [#38] Refactoring
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Denis Kirillov
818f38b811 [#38] Replace gcache with golang-lru
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Denis Kirillov
1d546711e5 [#38] Add retrying when session token error
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Denis Kirillov
e08e3d6c00 [#38] Add session cache tests
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Denis Kirillov
c651a714fd [#38] Add session token cache
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Evgenii Stratonikov
10b78e74af [#62] pool: replace neofs-api-go imports with neofs-sdk-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 18:29:19 +03:00
Evgenii Stratonikov
46353456f1 [#48] pool/test: add missing EXPECT calls
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>
2021-11-01 17:51:21 +03:00
Evgenii Stratonikov
f3f8ce01d3 [#48] pool/test: add go:generate line for mocks generation
We also don't use mocks for `Pool`.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:51:21 +03:00