Commit graph

188 commits

Author SHA1 Message Date
Denis Kirillov
34496d1693 [#137] pool: Regenerate mock
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-02-17 16:03:49 +03:00
Denis Kirillov
cf2e9ce80b [#137] Add grpc state monitor
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-02-17 16:03:49 +03:00
Denis Kirillov
6c53da4cde [#137] Use callback response to update epoch
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-02-17 15:38:47 +03:00
Denis Kirillov
a3713f0d74 [#137] Add sign default session token
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-02-17 15:38:47 +03:00
Denis Kirillov
c20bd6422f [#137] Fix tests
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-02-17 15:38:47 +03:00
Denis Kirillov
28b116a072 [#137] Add exp to CreateSessionRes
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-02-17 15:38:47 +03:00
Denis Kirillov
491d671ca3 [#137] Expire session tokens locally
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-02-17 09:18:21 +03:00
Leonard Lyubich
de4c9278ee [#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-16 23:11:49 +03:00
Leonard Lyubich
192d8fb856 [#131] client: Return io.ErrUnexpectedEOF on cut object payload
Make `ObjectReader` / `ObjectRangeReader` to track number of bytes read
and return:
  * `io.ErrUnexpectedEOF` if the stream finished by the server before
  the last byte of the payload was read.
  * an error if more object payload size bytes was read.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-16 20:14:24 +03:00
Leonard Lyubich
15fdc13aa9 [#131] client: Remove no longer needed code
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-16 19:07:54 +03:00
Leonard Lyubich
ab83219d88 [#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-16 18:19:32 +03:00
Leonard Lyubich
8e7513a0d7 [#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-15 08:36:47 +03:00
Leonard Lyubich
2a9263f49f [#131] client: Re-implement Object.Search method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-13 17:05:39 +03:00
Leonard Lyubich
e5e12b3305 [#131] client: Re-implement Object.Range method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-12 12:26:38 +03:00
Leonard Lyubich
1c3e6b12d2 [#131] pool: Fix ineffectual error assignments
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-12 12:25:58 +03:00
Leonard Lyubich
b4ac10598c [#131] client: Re-implement Object.Head method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-12 12:25:51 +03:00
Leonard Lyubich
5b2f028bf5 [#131] client: Add ID suffix to ResObjectPut.ReadStoredObject
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-11 18:16:04 +03:00
Leonard Lyubich
e9a0a10d20 [#131] pool: Refactor retry сalls
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-11 17:40:09 +03:00
Leonard Lyubich
32c6e927a0 [#131] pool: Remove redundant var from pool.PutObject
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-11 14:53:13 +03:00
Leonard Lyubich
c8855620b5 [#131] container: Set current SDK version in New
Make `container.New` function to write `version.Current` into created
container.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-11 14:53:13 +03:00
Leonard Lyubich
1f58b924c9 [#131] client: Change interface of object PUT and GET ops
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-11 14:53:13 +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
Evgenii Stratonikov
6a7ba33b59 [#99] docs: add README.md
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-01 17:10:54 +03:00
Pavel Karpy
2fff3fd9ec [#128] session: Sync comments and constructors
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-01 17:03:12 +03:00
Pavel Karpy
6d3d91f889 [#128] *: Use correct aliases for object testing
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-01 17:03:12 +03:00
Pavel Karpy
41f17d1a09 [#128] objecttest: Fix linter
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-01 17:03:12 +03:00
Pavel Karpy
fb5b56fdc9 [#128] session: Add ObjectContext
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-01 17:03:12 +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
Pavel Karpy
03560b84af [#128] token: Add getters/setters
Added methods:
- Empty() bool;
- Expiration() uint64;
- NotBeforeTime() uint64;
- IssuedAt() uint64;
- EACLTable() *eacl.Table;
- OwnerID() *owner.ID
- Signature() *signature.Signature;
- VerifySignature() error.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-01 17:03:12 +03:00
Leonard Lyubich
9414f42aa3 [#127] apistatus: Fix grammar of fromStatusV2 method docs
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-01 17:02:58 +03:00
Leonard Lyubich
0fb22361a3 [#127] apistatus: Support WRONG_MAGIC_NUMBER status
Define `WrongMagicNumber` type for which encapsulates the work with
incorrect network magic. Provide method to read/write the correct magic
(which is a status detail in NeoFS API V2 protocol).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-01 17:02:58 +03:00
Leonard Lyubich
883a26d210 [#92] client: Add docs about status returns
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-01 17:02:43 +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
Evgenii Stratonikov
f83ff628fb [#36] eacl: add eACL table to ValidationUnit
Improve SDK usability a bit:
1. Replace bearer and storage with a single eACL table. This way
   caller can implement it's own behaviour for missing eACL.
2. Remove logging. SDK library shouldn't be dependent on a specific
   logger.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-01-19 11:06:27 +03:00
Evgenii Stratonikov
8c5a596ea2 [#36] eacl: add tests for filter match
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-01-19 11:06:27 +03:00
Evgenii Stratonikov
be9bc5d612 [#36] eacl: add tests for operation match
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-01-19 11:06:27 +03:00
Evgenii Stratonikov
3a0c9e4542 [#36] eacl: add eACL checking algorithm from neofs-node
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-01-19 11:06:27 +03:00
Evgenii Stratonikov
ea5da31bd2 [#109] netmap: add 1 more test in JSON
Move `PlacementPolicy_ProcessSelectors` test. It tests how good
nodes were grouped into buckets after selection, but we can still query
full results and check them.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-01-18 13:50:48 +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
Evgenii Stratonikov
feb40146b7 [#109] netmap: describe JSON test format
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-01-18 13:06:25 +03:00
Evgenii Stratonikov
2f446c8e42 [#109] netmap: convert tests to the json format
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-01-18 13:06:25 +03:00
Leonard Lyubich
49a17a7159 [#119] client: Configure network magic
In the latest NeoFS protocol update, each request is provided with a
network magic number. We have to provide the ability to set it on
the client.

Add `WithNetworkMagic` option constructor which accepts magic number.
Write the number to meta header of the all requests.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-01-14 14:48:29 +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