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