Commit graph

157 commits

Author SHA1 Message Date
Evgenii Baidakov
cb4acec6a2
client: Remove MissingContext panic
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 14:30:01 +04:00
Evgenii Baidakov
e377b3b4f6
*: Remove statusRes as unused
Fixes #405

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 12:21:15 +04:00
Evgenii Baidakov
e0afe0807c
client: Fix error checking for go 1.18-19
Should be reverted/updated when minimum version of Go will be set to 1.20

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 12:19:20 +04:00
Evgenii Baidakov
2f45caf8a5
client: Remove ResolveNeoFSFailures
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 12:19:19 +04:00
Evgenii Baidakov
548f911195
client: Update documentation
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 12:19:18 +04:00
Evgenii Baidakov
149b145073
client: Extend tests for apistatuses
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 12:19:18 +04:00
Evgenii Baidakov
1d952ced4e
client: Replace apistatus type check with error check
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 10:33:09 +04:00
Evgenii Baidakov
483aff30c0
client: Remove duplicate test function
TestFromStatusV2 and TestToStatusV2 have the identical testcases and code to check them

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 10:33:09 +04:00
Evgenii Baidakov
9533a778a8
client: Move and extend status errors tests
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 10:33:08 +04:00
Evgenii Baidakov
fc0bd12101
client: Add separate error for each apistatus
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-19 10:33:08 +04:00
Evgenii Baidakov
162a15ae4b
client: Add tests for contextCall.err in session creation
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-15 07:45:14 +04:00
Evgenii Baidakov
0c7bfc2afe
client: Set contextCall.err if missed session params
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-15 07:45:06 +04:00
Roman Khimov
c97f834c6b
Accept oid.Address into client.PrmObjectGet, PrmObjectHash, PrmObjectDelete (#408) 2023-05-05 12:04:07 +03:00
Evgenii Baidakov
04ea0e8f6a
client: Accept rng object.Range into PrmObjectRange
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-05 12:17:21 +04:00
Evgenii Baidakov
3f603dc8eb
client: Accept oid.Address into PrmObjectHash, PrmObjectDelete, PrmObjectGet
close #404

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-05 12:17:12 +04:00
Evgenii Baidakov
f34c99d538
docs: Actualize interfaces in status structs
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-05 10:17:16 +04:00
Evgenii Baidakov
ca0f19c453
client: Remove IsErrXXX functions
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-05 10:17:16 +04:00
Evgenii Baidakov
f1b438a2ac
pool: Replace IsErrXXX functions with errors
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-05 10:17:15 +04:00
Evgenii Baidakov
7d2cfff825
client: Define separate errors instead of IsErrXXX functions
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-05 10:17:15 +04:00
Leonard Lyubich
153695a03d client: Provide the ability to create slicer.Slicer instance
`CreateObject` function uses `slicer.Slicer` to read data encapsulated
behind `io.Reader` and store it in the NeoFS network. Sometimes there is
a need to init data writer (`io.Writer`)` instead of providing reader.
To cover such use-cases, it's worth to expose slicer's constructor based
on client.

Add `NewDataSlicer` constructor. Use the function in `CreateObject`.

Refs #342.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
2023-04-26 21:40:01 +04:00
Leonard Lyubich
e2011832eb slicer: Allow to toggle homomorphic hashing
Homomorphic hashing of object payload is not always necessary. There is
a need to provide ability to skip calculation. It's also worth to not
calculate it by default since current implementation of Tillich-Zemor
algorithm has large resource cost.

Do not calculate homomorphic checksum in `Slicer` methods by default.
Provide option to enable the calculation. Make tests to randomize
calculation flag and assert results according to it.

Refs #342.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
2023-04-26 21:40:01 +04:00
Leonard Lyubich
0d7d03d56f client: Support static data slicing
Add `CreateObject` function which slices data stream into NeoFS objects
and saves the produced objects in the NeoFS network using `Client`.

Closes #342.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
2023-04-26 21:38:08 +04:00
Evgenii Baidakov
36b1e8442c
tests: Use dedicated function to generate signers in tests
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-04-26 15:03:55 +04:00
Evgenii Baidakov
25c0fd9b8e
client: Update coverage for signing
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-04-26 15:01:44 +04:00
Evgenii Baidakov
64c0612bdc
:* Replace ecdsa.PrivateKey with neofscrypto.Signer
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-04-26 14:59:21 +04:00
Evgenii Baidakov
570a628462
:* Replace signature package from neofs-api-go
close #219, #155

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-04-26 14:54:12 +04:00
Evgenii Baidakov
6ac961d41c
client: Set external signer for requests payload
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-04-20 14:29:58 +04:00
LeL
34213c6275
Update go version to 1.20 (#394) 2023-04-19 14:23:22 +04:00
Roman Khimov
dcdd75b751
documentation: Container create and get example (#392)
Close #385
2023-04-18 22:49:39 +03:00
Evgenii Baidakov
38a613fce5
*: replace interface{} with any keyword
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-04-18 12:28:25 +04:00
Evgenii Baidakov
d1ae4ef576
documentation: Container create and get example
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-04-17 17:39:33 +04:00
Evgenii Baidakov
dfb799783e
client: Check CID is set to eacl table in ContainerSetEACL command
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-04-17 09:40:43 +04:00
Evgenii Stratonikov
9efc4ecd70 [#367] client: Allow to override key in Object.Hash RPC
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-12-29 13:28:38 +03:00
Pavel Karpy
a690dcb159 [#369] status: Make errors return default messages
Use default messages in `Error` methods like in `ToStatusV2`.

Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
2022-12-12 11:36:58 +03:00
Leonard Lyubich
d2f3929b51 [#349] client: Use context.Background in Dial by default
Passing `nil` context to `rpc.Balance` leads to panic. To prevent panic,
we need to provide some default context in `Dial`.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
2022-10-12 17:50:55 +04:00
Leonard Lyubich
452a50e9d5 [#343] client: Accept context parameter in Dial
In previous implementation of `Client.Dial` there was no ability to
specify parent context (e.g. global application context).

Add `PrmDial.SetContext` method which accepts optional base dial
context. Use the context to open client connection or fall back to using
`context.Background()`.

Upgraded version of `github.com/nspcc-dev/neofs-api-go/v2` module
also fixes the problem when dial timeout didn't work properly.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
2022-10-07 13:24:02 +03:00
Leonard Lyubich
8e3173eacd [#270] client/netmap: Cover NetMapSnapshot with unit tests
There is a need to test each `Client` operation. In previous
implementation `Client` was based on real socket connection. This didn't
allow to test the `Client` without OS resources. In order to write
convenient and useful unit tests we need to slightly refactor the code.

Introduce `neoFSAPIServer` interface as a provider of `Client` type's
abstraction from the exact NeoFS API server. Add `netMapSnapshot` method
for initial implementation. Define core interface provider used in real
code. Set `coreServer` as an underlying `neoFSAPIServer` in
`Client.Dial`. Cover `Client.NetMapSnapshot` method with unit tests
using the opportunity to override the server.

From now client library can be tested not only with real physical
listeners but with imitations.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-09-22 10:51:07 +04:00
Leonard Lyubich
89124d442d [#312] client/netmap: Simplify NetMapSnapshot implementaiton
Make flat set of instructions similar to `ObjectDelete` operation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-09-22 10:51:07 +04:00
Leonard Lyubich
664392afc2 [#312] netmap: Support NetmapService.NetmapSnapshot RPC
Extend functionality of `NetMap` type. Add `NetMapSnapshot` operation to
`client` package.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-09-22 10:51:07 +04:00
Leonard Lyubich
f2f97f656d [#315] apistatus: Write default message in NodeUnderMaintenance.Error
Use `node is under maintenance` message in `NodeUnderMaintenance.Error`
is `message` field is unset in the status message.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-09-20 11:23:22 +04:00
Leonard Lyubich
be9a1aca90 [#315] apistatus: Support NodeUnderMaintenance in FromStatusV2
Support decoding `NodeUnderMaintenance` status errors in `FromStatusV2`
function.

From now `NodeUnderMaintenance` instance can be decoded from
`status.Status` message of NeoFS API V2 protocol.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-09-20 11:23:22 +04:00
Evgenii Stratonikov
4662d39886 [#315] client/status: Add NodeUnderMaintenance status
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-09-19 16:49:27 +04:00
Evgenii Stratonikov
f75a5feba3 [#334] client: Use parameter key in object.Get
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-09-14 11:34:56 +04:00
Evgenii Stratonikov
43a57d42dd [#331] client: Allow to set timeout for streaming operations
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-09-07 11:51:28 +04:00
Evgenii Stratonikov
ee92df3203 [#326] client: Sign message in object.GetRange'
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-08-29 14:45:50 +03:00
Evgenii Stratonikov
cf7bee3087 [#326] client: Provide pointers requests for signing
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-08-29 14:45:50 +03:00
Evgenii Stratonikov
0e4d07fb06 [#323] client: Remove xheaders length check in a common helper
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-08-26 17:34:27 +03:00
Evgenii Stratonikov
d6d6a41f5d [#323] client: Refactor object.Put
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-08-26 17:34:27 +03:00
Evgenii Stratonikov
724d30db1a [#323] client: Refactor object.Get
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-08-26 17:34:27 +03:00
Evgenii Stratonikov
1f593d0fb2 [#323] client: Refactor object.GetRange
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-08-26 17:34:27 +03:00