Commit graph

318 commits

Author SHA1 Message Date
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
Pavel Karpy
09f7df10ed [#111] client: Fix doc comments
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-11 11:03:14 +03:00
Pavel Karpy
cb42437e5c [#111] client: Drop client.Client interface
Return structure instead.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-11 11:03:14 +03:00
Denis Kirillov
66d71cde30 [#106] Add extra descriptions for constants
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-01-11 11:01:37 +03:00
Denis Kirillov
2d597c1be8 [#106] Use BasicACL instead of uint32
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-01-11 11:01:37 +03:00
Denis Kirillov
b5235bdf34 [#106] Add stringer and tests
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-01-11 11:01:37 +03:00
Denis Kirillov
bd110d8b41 [#106] Add basic ACL parser
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-01-11 11:01:37 +03:00
Denis Kirillov
d4d0feb59d [#106] Add public constants for well-known names
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-01-11 11:01:37 +03:00
Elizaveta Chichindaeva
1fe37df88f [#104] Add ACL constants to acl/types.go
- New non-final ACL constants for which eACL can be set
- Changed comments

Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2021-12-30 10:29:47 +03:00
Evgenii Stratonikov
3edaf9ecb6 netmap: sort buckets by HRW value
If weights for some buckets are equal, result depends on the
initial positions of buckets in slice. Thus we sort buckets by value
using hash of the first node as a have for the whole bucket.
This is ok, because buckets are already sorted by HRW.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-12-28 15:59:35 +03:00
Alex Vanin
f7582399ed [#107] client: Provide RWTimeout option
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-12-28 15:59:21 +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
a2572a23a3 [#93] Return NNS resolver
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-12-14 15:27:04 +03:00
Leonard Lyubich
a5b61c4f64 [#96] Downgrade github.com/golang/mock module version
Downgrade `gomock` dependency to `v1.5.0` in order to import latest SDK
library to `neo-go`. Later version `v1.6.0` upgrades `golang
.org/x/tools` module which break Neo Go compiler (see neo-go#2086).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-12-01 21:24:51 +03:00