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>
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>
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>
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>
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>
* 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>
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>
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>
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>