Allocate capacity instead of length of the slice to write the object payload
range since each chunk is written through `append`.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Change accepted/returned value type of `SetTrust` / `Trust` methods of
`SendIntermediateTrustPrm` structure to `reputation.PeerToPeerTrust`.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Make `Client` to be the wrapper over raw protobuf client. Provide public
method to get the underlying raw client. Change implementations of all
methods with the new approach of the RPC execution.
Additional changes:
* key replaced from `New` argument to `WithDefaultPrivateKey` option;
* `GetSelfBalance` is removed as non-viable;
* `GetEACLWithSignature` is removed, `GetEACL` returns `EACLWithSignature`;
* `AttachSessionToken` / `AttachBearerToken` are removed as non-viable;
* redundant options are removed.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Make it easier to test API clients and mock specific methods.
Also add comments on exported methods.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Allow to reuse underlying connection for requests
with different key. If no key is specified the one
provided on client creation is used.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Rename `PriceAttr` constant to `AttrPrice`. Rename `CapacityAttr` constant
to `AttrCapacity`. Add documentation to both of them.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
If CBF value is not set, then netmap package uses default CBF
value. However it modifies placement policy structure in
`GetContainerNodes()` because policy passed as a pointer.
Instead package can store CBF value in internal context and use
it without policy modification.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
Object payload transferred in chunks. Size of the
chunks may be limited by transport protocols. To
split it we use `io.CopyBuffer` with pre-allocated
buffer size of one chunk. However this function may
ignore buffer if reader or writer implements
`WriteTo` or `ReadFrom` methods. Unfortunately
`bytes.Reader` implements `WriteTo` function.
To fix this we wrap reader so wrapper implements
only `io.Reader` interface.
Related to github.com/nspcc-dev/neofs-node/issues/338
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
Make Client.GetContainer method to return an error if received container
structure does not meet NeoFS API specification.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Implement NonceUUID/SetNonceUUID methods on container structure. Change
implementation of Nonce/SetNonce methods and mark them deprecated.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
GetContainer method reads container structure by identifier from the
network. In some cases it is required to additionally check the
correspondence of the container structure to the identifier as a hash from
the binary representation. To do this, a new function
GetVerifiedContainerStructure is defined to execute the check after
receiving the container.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>