Commit graph

116 commits

Author SHA1 Message Date
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
Evgenii Stratonikov
ee47683848 [#53] session: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-08 12:39:45 +03:00
Evgenii Stratonikov
1feafcbcbf [#53] util: move signature package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-08 12:39:45 +03:00
Evgenii Stratonikov
bd554c94d8 [#44] checksum: move package from neofs-api-go
Also remove `Checksum` from functions and constants names.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:52:41 +03:00
Evgenii Stratonikov
ecc3d0fcf1 [#44] version: move package from neofs-api-go
Also remove `Version` from constructors and rename `SDKVersion` to
`Current`.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:52:41 +03:00
Evgenii Stratonikov
1ac6b819c5 [#44] signature: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:52:41 +03:00
Evgenii Stratonikov
372468c320 [#41] container: move id from neofs-api-go
Change `Marshal` signature to `Marshal() ([]byte, error)`.
Dependency update in SDK itself should be done after moving client
as `pool` package has some dependent function signatures.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:52:27 +03:00
Evgenii Stratonikov
ee42623a3e [#43] owner: move package from neofs-api-go
Also remove neofs-crypto dependency.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:51:55 +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