Commit graph

233 commits

Author SHA1 Message Date
Leonard Lyubich
b557aa0e2d [#131] client: Add docs to io.Reader implementations
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-18 17:01:08 +03:00
Leonard Lyubich
85db22eea4 [#131] client: Fix typo in Delete method docs
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
a0cbc3d8be [#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-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
eee9a72a4e [#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-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
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
Pavel Karpy
ecb441639e [#114] client: Fix comments according to new option
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-13 15:37:43 +03:00
Pavel Karpy
2a6fe47e5e [#114] client: Add WithNeoFSErrorParsing option
This option make client parse all NeoFS error statuses and return them as
errors from method calls (not as part of result structure). This is done
for applications that want to handle errors as it is customary in golang.
Default behaviour (construction client without new option) has not been
changed.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-13 15:37:43 +03:00
Pavel Karpy
13d72efd60 [#111] client: Add comments to Client and New
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-11 11:03:14 +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
Pavel Karpy
543291f8c5 [#111] client: Add comments to client's public methods
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-11 11:03:14 +03:00