Commit graph

134 commits

Author SHA1 Message Date
Leonard Lyubich
c82dcf7e16 [#401] internal: Place randomization code in random package
Also replace seeding into `init` function.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-05-30 22:02:58 +03:00
Leonard Lyubich
02e962f727 [#401] object: Fix GetRangeResponseBody.FromGRPCMessage
Pass `SplitInfo` field of `GetRangeResponse_Body_SplitInfo` message into
`SplitInfo` decoder.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-05-30 22:02:58 +03:00
Leonard Lyubich
d35e935a9d [#401] test: Randomize value for oneof field
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-05-30 22:02:58 +03:00
Evgenii Stratonikov
94f068e462 *: remove error from StableMarshal return values
We marshal only in-memory structures, no error is expected.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-04-21 15:07:57 +03:00
Evgenii Stratonikov
84d981e88e util/proto: do not return error from primitive marshalers
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-04-21 15:07:57 +03:00
Evgenii Stratonikov
732dd51b1b [#388] *: Remove nil check from setters
I knew one day `sed` would save me an hour of manual work:
```
sed -i -n -e '
s/) Set/) Set/
p
t setter
b end
:setter
    n
    s/nil/nil/
    t hasif
    p
    b end
    :hasif
        n
        :loop
        p
        n
        s/}/}/
        t end
        b loop
        :end
' $@
goimports -w $@
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-31 11:32:04 +03:00
Evgenii Stratonikov
43fd3cfb4f [#376] status: Remove pointer from Detail slice
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-15 12:19:49 +03:00
Evgenii Stratonikov
aa1e092ca5 [#376] object: Remove pointer from slices
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-15 12:19:49 +03:00
Evgenii Stratonikov
84daaf59ef [#376] refs: Replace []*ObjectID with []ObjectID
```
ObjectIDSlice/0_elements/to_grpc_message-8       5.64ns ± 2%    5.89ns ± 4%   +4.56%  (p=0.000 n=10+10)
ObjectIDSlice/0_elements/from_grpc_message-8     6.68ns ± 3%    6.81ns ± 8%     ~     (p=0.143 n=10+10)
ObjectIDSlice/0_elements/marshal-8               7.41ns ± 3%    7.91ns ± 4%   +6.63%  (p=0.000 n=10+10)
ObjectIDSlice/1_elements/to_grpc_message-8       69.8ns ± 3%    80.5ns ± 7%  +15.39%  (p=0.000 n=10+10)
ObjectIDSlice/1_elements/from_grpc_message-8     56.4ns ± 6%    34.7ns ± 5%  -38.55%  (p=0.000 n=10+9)
ObjectIDSlice/1_elements/marshal-8               68.4ns ± 4%    67.6ns ± 4%     ~     (p=0.404 n=10+10)
ObjectIDSlice/50_elements/to_grpc_message-8      2.52µs ± 7%    2.56µs ± 4%     ~     (p=0.315 n=10+9)
ObjectIDSlice/50_elements/from_grpc_message-8    1.83µs ± 8%    0.44µs ± 1%  -75.73%  (p=0.000 n=10+8)
ObjectIDSlice/50_elements/marshal-8              2.32µs ±17%    2.22µs ± 3%     ~     (p=0.247 n=10+10)

name                                           old alloc/op   new alloc/op   delta
ObjectIDSlice/0_elements/to_grpc_message-8        0.00B          0.00B          ~     (all equal)
ObjectIDSlice/0_elements/from_grpc_message-8      0.00B          0.00B          ~     (all equal)
ObjectIDSlice/0_elements/marshal-8                0.00B          0.00B          ~     (all equal)
ObjectIDSlice/1_elements/to_grpc_message-8        72.0B ± 0%     72.0B ± 0%     ~     (all equal)
ObjectIDSlice/1_elements/from_grpc_message-8      32.0B ± 0%     24.0B ± 0%  -25.00%  (p=0.000 n=10+10)
ObjectIDSlice/1_elements/marshal-8                48.0B ± 0%     48.0B ± 0%     ~     (all equal)
ObjectIDSlice/50_elements/to_grpc_message-8      3.62kB ± 0%    3.62kB ± 0%     ~     (all equal)
ObjectIDSlice/50_elements/from_grpc_message-8    1.62kB ± 0%    1.28kB ± 0%  -20.79%  (p=0.000 n=10+10)
ObjectIDSlice/50_elements/marshal-8              2.05kB ± 0%    2.05kB ± 0%     ~     (all equal)

name                                           old allocs/op  new allocs/op  delta
ObjectIDSlice/0_elements/to_grpc_message-8         0.00           0.00          ~     (all equal)
ObjectIDSlice/0_elements/from_grpc_message-8       0.00           0.00          ~     (all equal)
ObjectIDSlice/0_elements/marshal-8                 0.00           0.00          ~     (all equal)
ObjectIDSlice/1_elements/to_grpc_message-8         2.00 ± 0%      2.00 ± 0%     ~     (all equal)
ObjectIDSlice/1_elements/from_grpc_message-8       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
ObjectIDSlice/1_elements/marshal-8                 1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ObjectIDSlice/50_elements/to_grpc_message-8        51.0 ± 0%      51.0 ± 0%     ~     (all equal)
ObjectIDSlice/50_elements/from_grpc_message-8      51.0 ± 0%       1.0 ± 0%  -98.04%  (p=0.000 n=10+10)
ObjectIDSlice/50_elements/marshal-8                1.00 ± 0%      1.00 ± 0%     ~     (all equal)
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-15 12:19:49 +03:00
Evgenii Stratonikov
fadd47f4fb [#376] object: remove pointer from Attribute slice
```
name                           old time/op    new time/op    delta
AttributesMarshal/marshal-8      4.44µs ± 9%    2.72µs ± 0%  -38.79%  (p=0.000 n=10+9)
AttributesMarshal/unmarshal-8    3.16µs ±13%    0.55µs ± 4%  -82.60%  (p=0.000 n=10+10)

name                           old alloc/op   new alloc/op   delta
AttributesMarshal/marshal-8      4.42kB ± 0%    4.42kB ± 0%     ~     (all equal)
AttributesMarshal/unmarshal-8    2.02kB ± 0%    1.79kB ± 0%  -11.11%  (p=0.000 n=10+10)

name                           old allocs/op  new allocs/op  delta
AttributesMarshal/marshal-8        51.0 ± 0%      51.0 ± 0%     ~     (all equal)
AttributesMarshal/unmarshal-8      51.0 ± 0%       1.0 ± 0%  -98.04%  (p=0.000 n=10+10)
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-09 15:23:13 +03:00
Evgenii Stratonikov
204126893e [#376] object: add benchmarks for attributes marshal/unmarshal
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-09 15:23:13 +03:00
Leonard Lyubich
fd3bf4a56b Fix linter remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-25 11:12:57 +03:00
Leonard Lyubich
99370889d1 [#371] Support recent changes in NeoFS API protocol
Support:
  * new status codes (object, container, session);
  * object `Lock` message;
  * different signature schemes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-25 10:24:07 +03:00
Pavel Karpy
1384523f62 [#372] object: Add object notification unit tests
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-22 18:19:18 +03:00
Pavel Karpy
4007aa86f4 [#372] object: Add object notification attributes
Also, add functions for parsing and setting object notifications.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-22 18:19:18 +03:00
Pavel Karpy
aabc2dd927 [#372] object: Fix filter comment
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-22 18:19:18 +03:00
Leonard Lyubich
e9a8451fb7 [#367] *: Re-compile proto files of NeoFS API protocol
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-01-14 13:17:21 +03:00
Leonard Lyubich
0f09f0dfc6 Re-compile NeoFS API proto files using updated script
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-17 15:29:33 +03:00
Leonard Lyubich
25da5d2e13 Add v2 version to go module name
Replace all elements from `v2` to root directory.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-17 15:29:33 +03:00
Alex Vanin
1f143e54bd Move api-v2 files into v2 subdir
This subdir contains generated proto files
and small wrappers.
2020-09-18 10:40:17 +03:00
Leonard Lyubich
0ee1c3653d Implement field setters on all protobuf messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-18 10:40:17 +03:00
Alex Vanin
fabdd78d63 Add pre-release jindo branch 2020-09-18 10:39:50 +03:00
Alex Vanin
0a5d0ff1a2 Remove v1 code 2020-09-18 10:39:45 +03:00
Alex Vanin
630ac612ea
Merge pull request #100 from nspcc-dev/neo3/address
Use NEO3 based address generation
2020-07-21 18:52:20 +03:00
alexvanin
1958ff8c37 Use NEO3 based address generation
With neo-go v0.90.0 there are new event subscription component
and new verification script routines based on NEO3. These features
allow to avoid using low-level neo-vm code in NeoFS and corresponding
projects.

This commit removes unused function:
- FetchPublicKeys (used in neofs indexer),
- VerificationScript (used in KeysToAddress),
- Address (used in KeysToAddress),
- ReversedScriptHashToAddress (used in neofs indexer),
- IsAddress (used in neofs indexer),
- ReverseBytes (used in neofs indexer),
- DecodeScriptHash (used in neofs indexer).

KeysToAddress changed into KeyToAddress because NeoFS won't work with
multisignature owners for now and it is not supported in neo-go library.
2020-07-20 16:43:31 +03:00
Evgeniy Kulikov
d45548c43b
Implementing proto.Clone 2020-07-03 09:17:35 +03:00
Leonard Lyubich
74e917810a service: support broken apart signable payload of the requests
In previous implementation service package provided types and functions
that wrapped signing/verification of data with session token.
This allowed us to use these functions for signing / verification of
service requests of other packages. To support the expansion of messages
with additional parts that need to be signed, you must be able to easily
expand the signed data with new parts.

To achieve the described goal, this commit makes the following changes:

  * adds GroupSignedPayloads and GroupVerifyPayloads functions;

  * renames SignedDataWithToken to RequestData, DataWithTokenSignAccumulator
    to RequestSignedData, DataWithTokenSignSource to RequestVerifyData;

  * renames SignDataWithSessionToken/VerifyAccumulatedSignaturesWithToken
    function to SignRequestData/VerifyRequestData and makes it to use
    GroupSignedPayloads/GroupVerifyPayloads internally.
2020-06-10 20:37:10 +03:00
Leonard Lyubich
96a6bb4842 object: implement SignedData() and AddSignKey() methods on IntegrityHeader 2020-05-18 16:51:59 +03:00
Leonard Lyubich
1931bd590d object: fix signed payload calculation of HeadRequest message
In previous implementation first byte of buffer for HeadRequest
signed payload was set to 1 if FullHeaders flag was set. Otherwise,
this byte remained unchanged. For correct recording of a signed payload,
it is necessary to explicitly set the first byte with the unset flag.
2020-05-18 12:58:49 +03:00
Leonard Lyubich
2c571718d0 object: add unit test of HeadRequest.ReadSignedData method 2020-05-18 12:58:49 +03:00
Leonard Lyubich
e01fb0cc62 Implement signed data calculating function from SignedDataReader 2020-05-11 17:28:44 +03:00
Leonard Lyubich
dd2f568347 object: add Token header case to CopyTo 2020-05-08 15:06:26 +03:00
Leonard Lyubich
4aac4d093d object: implement signing payload methods on SearchRequest message 2020-05-06 15:09:31 +03:00
Leonard Lyubich
84671cd4aa object: implement signing payload methods on GetRangeHashRequest message 2020-05-06 14:58:29 +03:00
Leonard Lyubich
e784206032 object: implement signing payload methods on GetRangeRequest message 2020-05-06 14:38:39 +03:00
Leonard Lyubich
fc0da3c8fc object: implement signing payload methods on DeleteRequest message 2020-05-06 14:15:07 +03:00
Leonard Lyubich
68f83f5470 object: implement signing payload methods on HeadRequest message 2020-05-06 13:56:59 +03:00
Leonard Lyubich
439221cea8 object: implement signing payload methods on GetRequest message 2020-05-06 13:33:03 +03:00
Leonard Lyubich
78f435a905 object: implement signing payload methods on PutRequest message 2020-05-06 13:16:15 +03:00
Leonard Lyubich
eb94cf7549 service: refactor MetaHeader interface 2020-05-04 14:37:14 +03:00
Leonard Lyubich
c6971d2004 service: access Token message fields through getters and setters 2020-04-28 18:40:21 +03:00
Evgeniy Kulikov
5ae4e14bfa
object: test coverage for stringify method 2020-04-28 16:39:01 +03:00
Evgeniy Kulikov
4d535876d0
object: implement Stringify for Object 2020-04-28 16:39:01 +03:00
Evgeniy Kulikov
7a7deb0b01
proto: regenerate files 2020-04-28 16:30:47 +03:00
Leonard Lyubich
4ac17201b7 Resolve update conflicts 2020-04-28 13:33:43 +03:00
Leonard Lyubich
e63d112cb2 Update to neofs-api v0.7.2 2020-04-28 12:50:52 +03:00
Evgeniy Kulikov
bedde0e33b
proto: regenerate files 2020-04-16 17:06:07 +03:00
Evgeniy Kulikov
e29cf2d3d7
Merge pull request #64 from nspcc-dev/update-to-neofs-api_v0.6.1
Update to NeoFS API v0.6.1
2020-04-16 11:47:49 +03:00
Evgeniy Kulikov
5d9feea76a
fix format 2020-04-16 11:35:12 +03:00
Evgeniy Kulikov
acfb16d363
added test case for exists object in put request 2020-04-10 11:30:45 +03:00
Leonard Lyubich
e999110be1 object: prevent potential NPE panic in PutRequest.CID method 2020-04-03 18:23:24 +03:00
alexvanin
55b75a0dae object: Add test for object request type 2020-04-02 15:05:48 +03:00
alexvanin
1e513625f1 object: Add Type() in Request interface
BasicACL have set of rules for every request type. ACL will be
processed before any request specific handlers. Therefore
we need to determine request type in generic request interface,
which is used in pre-processors of object service
implementation.
2020-04-02 15:00:27 +03:00
alexvanin
4abd71f99b object: Define RequestType for object service requests 2020-04-02 15:00:27 +03:00
Evgeniy Kulikov
b118f469d2
Migrate to new repo 2020-03-31 10:05:26 +03:00
Evgeniy Kulikov
ea0703e089
add tests case to prevent npe 2020-03-16 18:34:56 +03:00
Evgeniy Kulikov
eab0a26cc0
[NPE] check that header exists, otherwise return empty string 2020-03-16 18:34:13 +03:00
Evgeniy Kulikov
de09878df1
Response meta header 2020-02-13 18:10:46 +03:00
Evgeniy Kulikov
49cc731c8d
update proto files, regenerate pb.go 2020-02-05 16:58:06 +03:00
Evgeniy Kulikov
c0dd4fcb15
Get range response struct 2020-02-05 14:34:23 +03:00
Evgeniy Kulikov
1fe7f7b2fa
make object.GetRange to be server-side streaming RPC 2020-02-05 13:42:49 +03:00
Evgeniy Kulikov
980d777176
Merge pull request #44 from nspcc-dev/feature/add-default-filename-header
object: Add default filename user header key for third party apps
2020-02-04 13:48:09 +03:00
alexvanin
124666a142 object: Add default filename user header key for third party apps 2020-02-04 13:29:31 +03:00
Evgeniy Kulikov
d75a56f92e
Update Object.Search, stream 2020-02-03 12:36:37 +03:00
Evgeniy Kulikov
80fde665ca
code format 2020-01-30 16:38:52 +03:00
Evgeniy Kulikov
53af48372f
prepare to rename neofs-proto to neofs-api 2020-01-30 16:35:30 +03:00
Evgeniy Kulikov
9366b51ace
Fix NaN ObjectSize 2020-01-27 15:02:14 +03:00
Leonard Lyubich
5bd19fe0d2 Add Raw flag to Get and Head request bodies
Raw flag provides the ability to switch the expected representation
of the object between the physically stored and the system-wide.
The response to the request may vary when the flag is set for some
classes of objects (e.g. linking).
2020-01-21 10:22:40 +03:00
alexvanin
81cdfcc502 object: Update verify routine
Verify routine now supports public key field to check
if integrity header contains correct signature of
object header.

Verify also have strict check that integrity header is
last header in the list of headers.
2020-01-16 17:32:57 +03:00
alexvanin
f1418ef79d object: Add CreateIntegrityHeader function
CreateIntegrityHeader function allow to optimize
object put pipeline in neofs nodes.
2020-01-16 17:32:32 +03:00
alexvanin
50d3649acf object: Add public key header type
Object can contain public key header. It will be used
for object verification. This header can contain owner's
public key or be the part of x509 chain verification in
couple with verification header.
2020-01-16 17:32:27 +03:00
alexvanin
e4d761be06 object: Remove tombstone creation field in tombstone header
Tombstone header contains timestamp when tombstone was created.
This timestamp duplicates object creation timestamp in object
system header. This commit removes redundant field.
2020-01-15 17:13:05 +03:00
Evgeniy Kulikov
0fce8a6ba2
proto: publish sg lib, rewrite object 2019-12-02 19:46:15 +03:00
Evgeniy Kulikov
ac44e4bb9f
service: get rid of bytefmt
- add ByteSize type + Stringer
- add test coverage
- cleanup modules

closes #22
2019-11-26 16:14:10 +03:00
Evgeniy Kulikov
3b2ea6b8f4
Remove SendPutRequest and update MakePutRequestHeader
- SendPutRequest unused and work not like expected
- MakePutRequestHeader should not set epoch / ttl
- remove unused internal functions and consts
- update to latest neofs-crypto
2019-11-22 17:14:34 +03:00
Evgeniy Kulikov
1a9a840d17
proto: regenerate proto files 2019-11-21 16:16:39 +03:00
Evgeniy Kulikov
cc3b4d9087
proto: SearchRequest rename Version to QueryVersion 2019-11-21 16:16:20 +03:00
Evgeniy Kulikov
24e5497b1d
Update develop branch 2019-11-21 13:10:57 +03:00
Evgeniy Kulikov
e333a13557
docs: regenerate proto files 2019-11-21 10:34:38 +03:00
Evgeniy Kulikov
3d445aeb0b
docs: add deprecation notice for epoch and ttl fields 2019-11-21 10:32:07 +03:00
Evgeniy Kulikov
15b997bdb5
docs: update proto doc comments to satisfy go-doc comment 2019-11-21 10:26:01 +03:00
alexvanin
0af63c42cc docs: regenerate proto files 2019-11-20 21:43:04 +03:00
alexvanin
5aaea793da docs: add object proto documentation 2019-11-20 21:09:47 +03:00
Evgeniy Kulikov
1cf33e5ffd
initial 2019-11-18 16:34:06 +03:00