Commit graph

214 commits

Author SHA1 Message Date
Alex Vanin
9ceba98198 [#202] pkg/client: Fix signature check in object header getter
According to API object.Head response contains signature of
object ID rather than signature of object header itself.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-17 16:23:44 +03:00
Leonard Lyubich
0620a3b1eb [#199] sdk/client: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
00ce980d82 [#199] sdk/token: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
c0de2bf9e5 [#199] sdk/owner: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
1ff8b3fd94 [#199] sdk/object: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
3a966ee5df [#199] sdk/netmap: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
459d295788 [#199] sdk/container: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
7611c218e3 [#199] sdk/client: Verify eACL table signature in GetEACL method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
3097059f85 [#199] sdk/client: Verify header signature in GetObjectHeader method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
c6884f9823 [#199] sdk/eacl: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
2b3502d6c0 [#199] sdk/acl: Add comments for basic ACL constants
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
154e09f4e4 [#199] sdk/accounting: Rename test file package
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
79f72e10c9 [#199] sdk: Refactor string parse errors
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
fe336fd5ba [#198] sdk/client: Use XHeader type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 12:44:37 +03:00
Leonard Lyubich
5452554b58 [#198] sdk: Implement XHeader type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 12:44:37 +03:00
Leonard Lyubich
5f5e5ac5dd [#197] sdk/object: Rename getters of Attribute and Object types
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Leonard Lyubich
67bcf6eb4d [#197] sdk/object: Rename getters of Address type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Leonard Lyubich
9f0bc50e53 [#197] sdk: Rename getters of Checksum type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Leonard Lyubich
2afc684313 [#197] sdk: Rename getters of Signature type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Leonard Lyubich
2bcbd48972 [#197] sdk: Rename getters of Version type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Alex Vanin
f886d75560 [#168] pkg/object: Fix lint error on attribute receiver
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
85d4713348 [#168] session: Implement binary/JSON encoders/decoders on SessionToken
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
93df2fd765 [#168] refs: Implement binary/JSON encoders/decoders on Checksum
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
4b55b06780 [#168] refs: Implement binary/JSON encoders/decoders on Signature
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
1519a02d63 [#168] refs: Implement binary/JSON encoders/decoders on Version
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
9ec57ee9f8 [#168] refs: Implement binary/JSON encoders/decoders on OwnerID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
c0f3ac51d4 [#168] refs: Implement binary/JSON encoders/decoders on ContainerID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
7289ff6c64 [#168] refs: Implement binary/JSON encoders/decoders on ObjectID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
4ce751f13c [#168] refs: Implement binary/JSON encoders/decoders on Address
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
9325e22871 [#168] object: Implement binary/JSON encoders/decoders on Object
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
0caff85fb7 [#168] object: Implement binary/JSON encoders/decoders on Attribute
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
a684da6118 [#168] container: Implement binary/JSON encoders/decoders on Container
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
ec957be60c [#168] acl: Implement binary/JSON encoders/decoders on BearerToken
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
233756ca8f [#168] acl: Implement binary/JSON encoders/decoders on Table
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
ae68790bbd [#168] acl: Implement binary/JSON encoders/decoders on Record
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
9ddc4c1f48 [#168] acl: Implement binary/JSON encoders/decoders on Target
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
7f42156201 [#168] acl: Implement binary/JSON encoders/decoders on HeaderFilter
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
9bebc1247d [#168] accounting: Implement binary/JSON encoders/decoders on Decimal
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
52fae76533 [#168] sdk/accounting: Refactor Decimal type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich
e721734599 [#168] netmap: Implement binary and JSON encoders/decoders on Filter
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Alex Vanin
874a4b937f [#193] pkg/client: Fix error message typos
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-13 12:28:00 +03:00
Alex Vanin
d442b204ca [#193] pkg/client: Update container structure
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-13 12:28:00 +03:00
Alex Vanin
5ff7b5ba6b [#193] pkg/container: Increase test coverage
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-13 12:28:00 +03:00
Alex Vanin
f16a420bed [#193] pkg/container: Wrap container structure with SDK functions
All setters and getters should work with SDK types.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-13 12:28:00 +03:00
Alex Vanin
abed8a9156 [#191] v2: Add ObjectID filters for ACL and Object packages
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-11 10:35:34 +03:00
Alex Vanin
fe48e3ab5b [#191] pkg/object: Use root and phy filters as flags
Inverted values for `root` and `phy` filters now are not supported.
Therefore these filters works like flags. It either presented in
search query or not.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-11 10:35:34 +03:00
Alex Vanin
91eade02cd [#191] v2/object: Rename leaf filter to phy
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-11 10:35:34 +03:00
Alex Vanin
d704795dcc [#189] sdk/netmap: Define unspecified clause
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
162b0de725 [#189] sdk/client: Return NodeInfo SDK type from EndpointInfo method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
9834ed4e68 [#189] sdk/netmap: Get rid of the use of v2 types in the placement code
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
40d7c9cd93 [#189] sdk/netmap: Implement NodeInfo JSON encode/decode functions
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
8367b498d9 [#189] sdk/netmap: Implement NodeInfo type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
6347f846eb [#189] sdk/netmap: Implement NodeAttribute type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
d4f5c27d47 [#189] sdk/netmap: Implement NodeState enum
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
53697081ce [#189] sdk: Fix type conflicts after netmap package refactoring
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
9f19139999 [#189] sdk/netmap: Refactor PlacementPolicy type
Replace alias to v2 type PlacementPolicy with v2-compatible implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
6a29d9c360 [#189] sdk/netmap: Refactor Replica type
Replace alias to v2 type Replica with v2-compatible implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
eb96fffa5c [#189] sdk/netmap: Refactor Selector type
Replace alias to v2 type Selector with v2-compatible implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
fd0c10b832 [#189] sdk/netmap: Refactor Filter type
Replace alias to v2 type Filter with v2-compatible implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
8c1afc6bab [#189] sdk/netmap: Refactor Clause enum
Replace alias to v2 type Clause with v2-compatible implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
6d8612fd51 [#189] sdk/netmap: Refactor Operation enum
Replace alias to v2 type Operation with v2-compatible implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:28:50 +03:00
Leonard Lyubich
e4111ff3e7 [#190] sdk/object: Implement AddParentIDFilter method on SearchFilters
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-06 09:25:40 +03:00
Alex Vanin
3fb3cfd1a5 [#186] sdk/netmap: Use JSON placement policy converters in SDK
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-05 10:38:04 +03:00
Leonard Lyubich
2b171e1617 [#188] sdk: Implement Epoch method
Implement Epoch method on Client that receives epoch number through Netmap
.LocalNodeInfo call.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-05 09:58:21 +03:00
Leonard Lyubich
89a7a946dc [#187] sdk: Implement IsSupportedVersion function
Implement function that checks the compatibility of the specified version
with the current NeoFS revision.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-03 11:36:23 +03:00
Leonard Lyubich
ac38d13f04 [#182] sdk/object: Refactor a way to add filters by properties
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-28 14:11:49 +03:00
Leonard Lyubich
88c8c08c6b [#182] sdk/object: Implement methods for adding object search filters
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-28 14:11:49 +03:00
Leonard Lyubich
6f45f713c1 [#182] sdk/eacl: Implement convenient methods for adding object filters
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-28 14:11:49 +03:00
Leonard Lyubich
dc9fcd5d98 [#182] Rename methods to match updated field names
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-28 14:11:49 +03:00
Leonard Lyubich
7f0f42bc30 [#180] sdk/client: Set session token field in all requests
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-28 12:15:49 +03:00
Leonard Lyubich
b2ba0eef07 [#180] sdk/client: Implement methods that attach tokens to Client
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-28 12:15:49 +03:00
Leonard Lyubich
805ad54f41 [#180] sdk/client: Make defaultOptions func a Client method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-28 12:15:49 +03:00
Leonard Lyubich
ad0b01e892 [#172] Improve the readability of named attribute constants
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-22 19:15:45 +03:00
Leonard Lyubich
5494d3417f [#172] sdk/object: Define well-known application attributes
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-22 19:15:45 +03:00
Leonard Lyubich
4357430e0f [#172] sdk/container: Define well-known application attributes
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-22 19:15:45 +03:00
Alex Vanin
7b212431df [#179] sdk/token: Add function to return token issuer
With new neofs-api changes, token issuer will not be stored
in ownerID field of bearer token. We can identify owner by
public key that has been used in signature.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-22 15:41:59 +03:00
Alex Vanin
e023b6e51e [#179] sdk/client: Ease bearer token sanity check
Now owner ID field is not required to be set. According to
latest neofs-api, this field set if token was issued for
specific owner ID. If this field is not set, then any user
can use this token while it is correctly signed and has valid
lifetime.

Lifetime is also can be omitted since node interpret empty
lifetime as a lifetime with zero values.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-22 15:41:59 +03:00
Alex Vanin
2aa40b0dd3 [#177] sdk/client: Set version of new EACL table
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-20 15:35:41 +03:00
Alex Vanin
5f6720f456 [#172] v2/acl: Rename target keyList field to keys
According to new neofs-api target filed `key_list`
rename to `keys`.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-20 13:45:14 +03:00
Evgenii Stratonikov
6a69a896e5 [#174] netmap: process unspecified attribute as ID
When selector attribute is provided it should be
silently replaced by transparent ID, so each node
resides in a separate bucket.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-10-20 13:05:15 +03:00
Evgeniy Kulikov
4e6350f6d4 [#147] Work around owner package
- implement Stringer interface and Parse method for owner.ID
- increase test coverage

closes #147

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-15 11:05:37 +03:00
Evgeniy Kulikov
e2d8f408d8 [#147] Work around owner package
Add NEO3WalletSize as constant value.

closes #147

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-15 11:05:37 +03:00
Evgeniy Kulikov
20273357f6 [#147] Work around object package
- implement Stringer interface and Parse method for object.Address
- increase test coverage

closes #147

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-15 11:05:37 +03:00
Evgeniy Kulikov
f5b442fe3b [#147] Work around object package
- implement Stringer interface and Parse method for object.ID
- increase test coverage

closes #147

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-15 11:05:37 +03:00
Evgeniy Kulikov
f5388b553e [#147] Work around container package
- implement Stringer interface and Parse method for container.ID
- increase test coverage

closes #147

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-15 11:05:37 +03:00
Alex Vanin
7b3736567c [#169] sdk/client: Do not resign session token
In some cases SDK Client provided with signed and prepared
session token. In this case we don't need to change verb
or sign it.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-14 21:09:56 +03:00
Alex Vanin
d3e3889425 [#167] sdk/client: Add endpoint info getter
Adds support of new netmap service to the SDK client.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-09 09:15:34 +03:00
Alex Vanin
fa18f5ede7 [#165] pkg/owner: Add ID constructor from wallet
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-07 10:16:36 +03:00
Leonard Lyubich
cf70026c7e [#164] sdk/container: Implement Equal method on ID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-01 10:06:30 +03:00
Leonard Lyubich
1305bc750e [#164] sdk/object: Add HasParent method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-01 10:06:30 +03:00
Leonard Lyubich
2a2e4d8577 [#164] sdk/object: Implement method to reset relation fields
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-01 10:06:30 +03:00
Leonard Lyubich
f3bddc2ba5 [#164] sdk/object: Define filters to search virtual objects
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-01 10:06:30 +03:00
Leonard Lyubich
09e6093e64 [#164] sdk/object: Define filters to search root objects
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-01 10:06:30 +03:00
Leonard Lyubich
9799e5d48c [#164] sdk/object: Return nil parent if parent fields are empty
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-01 10:06:30 +03:00
Leonard Lyubich
ae81f4584e [#164] sdk/object: Add parent ID getter and setter
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-01 10:06:30 +03:00
Leonard Lyubich
420d956062 [#162] sdk/object: Detach header verification functions
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-29 15:26:41 +03:00
Leonard Lyubich
2cc58e36f8 [#160] sdk/client: Set object identifier in Head result
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-25 17:37:44 +03:00
Alex Vanin
c814cc62fa [#158] pkg/client: Ignore EOF on buffer copy in object.Put
There is a issue when user sends payload chunk to the neofs
node, but node closes connection earlier, e.g. node can return
error as soon as it checked ACL permission and denied request.

In this case client will receive EOF error and it produces
`could not send payload bytes to Put object stream` error, but
in fact there is different error.

If we ignore EOF there then `stream.CloseAndRecv()` return
correct error message later.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-09-25 15:58:40 +03:00
Leonard Lyubich
d19e5418da [#159] sdk: Define object range in object pkg
Define Range type in object package. Replace Range in client package with
the new one.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-25 15:58:24 +03:00
Leonard Lyubich
14fa89b819 [#155] sdk/object: Add Object to RawObject converter
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-22 18:07:14 +03:00