Commit graph

125 commits

Author SHA1 Message Date
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
Pavel Karpy
471ed5a3ec [#95] go.mod: Update api-go/v2 package.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-12-01 16:55:01 +03:00
Evgenii Stratonikov
3d0df0d068 [#54] tests: unify test generator names
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-12-01 10:34:54 +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
Evgenii Stratonikov
279a5a1e0b [#80] netmap: process subnet in selection
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-26 15:52:08 +03:00
Evgenii Stratonikov
b49404d9b6 [#80] netmap: add NodeInfo.ExitSubnet method
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-26 15:52:08 +03:00
Leonard Lyubich
29f589b54e [#94] subnet: Add methods to check subnet owner and ID
Implement `IsOwner` and `IDEquals` functions which check the
correspondence of the fields in `Info`. Remove no longer needed
`HasOwner` method of `Info`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-26 15:51:53 +03:00
Leonard Lyubich
8175462050 [#79] Implement type for subnet information
Create `subnet` package. Define `Info` type of the subnet info. Support
encoding and transport over the NeoFS API V2 protocol. Add methods to
work with identifier and owner.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-25 13:04:24 +03:00
Leonard Lyubich
755c01264e [#79] subnet/id: Add function which resets ID to zero subnet
Add `MakeZero` function which makes `ID` instance to refer to zero
subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-25 13:04:24 +03:00
Leonard Lyubich
e7ac7f339e [#82] netmap: Add functionality for working with subnets
* Implement `NodeInfo.EnterSubnet` method which adds node's subnet.
  * Implement `NodeInfo.IterateSubnets` which behaves similar to
  eponymous function from neofs-api-go/v2.
  * Implement `BelongsToSubnet` which checks if `NodeInfo` describes the
  node belonging to a specific subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-25 13:04:24 +03:00
Leonard Lyubich
b8989e3abb [#79] Implement type for subnet ID
Create `subnet` package. Define `ID` type of subnet identifiers.
Implement encoding and support NeoFS API V2 protocol. Provide method to
init instance from integer. Implement function which checks if `ID`
instance refers to zero subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-25 13:04:24 +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
87cbd4b701 [#83] pkg: Upgrade NeoFS API protocol version to 2.11
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-23 13:03:40 +03:00
Leonard Lyubich
bf78cddf69 [#83] pkg/client: Support status returns
Make all `Client` methods to return structured values and error. Parse v2
status messages in all RPC and provide status getter from all result
structures. Returns status failures as status result instead of error.

Interface changes:
  * all methods return `<method>Res` structure;
  * rename some methods to be more clear;
  * unify TZ and SHA256 objecy payload hashing in single method.

Behavior changes:
  * client doesn't verify object header structure received via Object.Head.
    If the caller was tied to verification, now it must do it explicitly.

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
fc18ca2cb3 [#87] owner: add compatibility test
Test values were generated with the previous version of SDK.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-22 15:40:13 +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
Evgenii Stratonikov
d821f18b7d [#88] nns: temporarily remove nns resolver
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-22 15:40:13 +03:00
Denis Kirillov
02f328a03c [#11] Add dns, nns resolver
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-22 10:40:21 +03:00
Evgenii Stratonikov
ca01b83adf [#78] owner: check id for validity
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-17 10:12:23 +03:00
Leonard Lyubich
df6a622c20 [#77] client: Do not change eACL version in SetEACL
Client must not change version of the eACL table to be saved.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-15 14:04:27 +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
4855154b35 [#62] client: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 18:29:19 +03:00
Evgenii Stratonikov
6c55c0fd4b [#61] token: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 10:37:42 +03:00
Evgenii Stratonikov
49a24e4b3e [#53] session: refactor missed Marshal declarations
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 10:31:57 +03:00
Evgenii Stratonikov
7627f8376a [#60] container: rename NewOption and make code more consistent
In all other places we use `Option` as `func`, there is no need in
additional indirection.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 10:31:57 +03:00
Evgenii Stratonikov
73686827d3 [#60] container: move package from neofs-api-go
Also, remove deprecated methods and types.

Close #60.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 10:31:57 +03:00
Evgenii Stratonikov
8d313dbd5d [#58] eacl: move package from neofs-api-go
Also, remove deprecated methods.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 18:12:53 +03:00
Evgenii Stratonikov
f05ff3901f [#57] storagegroup: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 12:31:54 +03:00
Evgenii Stratonikov
74a5254819 [#59] audit/test: reuse version generator
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 12:30:58 +03:00
Evgenii Stratonikov
db784a5758 [#59] audit: move package from neofs-api-go
Close #59.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 12:30:58 +03:00
Evgenii Stratonikov
26c59bfbb3 [#42] netmap: remove deprecated methods
Missed this from #51.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 10:01:43 +03:00
Evgenii Stratonikov
76d9835766 [#69] netmap: fix typo in comment
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 10:00:21 +03:00
Evgenii Stratonikov
d6b72453fc [#64] object/test: reuse checksum and signature generators
These were missing from #53.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 09:57:37 +03:00
Evgenii Stratonikov
39d3317ef6 [#64] object: move package from neofs-api-go
Also, remove deprecated method.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 09:57:37 +03:00
Evgenii Stratonikov
bdb99877f6 [#55] reputation: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 09:54:09 +03:00
Evgenii Stratonikov
ff54fb7647 [#53] session: move XHeader from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-08 12:39:45 +03:00