Commit graph

55 commits

Author SHA1 Message Date
0484647aae [#115] netmap: Fix type getters
* Add type instance check for nil to avoid panic by
  accessing fields.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-09-06 12:54:07 +00:00
bd588fa2e5 [#113] go.mod: Use range over int
Since Go 1.22 a `for` statement with a `range` clause is able
to iterate through integer values from zero to an upper limit.

gopatch script:
@@
var i, e expression
@@
-for i := 0; i <= e - 1; i++ {
+for i := range e {
    ...
}

@@
var i, e expression
@@
-for i := 0; i <= e; i++ {
+for i := range e + 1 {
    ...
}

@@
var i, e expression
@@
-for i := 0; i < e; i++ {
+for i := range e {
    ...
}

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
2024-09-04 15:44:59 +03:00
5e1c6a908f [#111] protogen: Emit slice of messages without a pointer
```
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
                                              │      old      │                 new                  │
                                              │    sec/op     │    sec/op     vs base                │
ObjectIDSlice/0_elements/to_grpc_message-8       3.193n ±  2%   3.242n ±  0%   +1.50% (p=0.034 n=10)
ObjectIDSlice/0_elements/from_grpc_message-8     3.197n ±  2%   3.343n ±  1%   +4.57% (p=0.000 n=10)
ObjectIDSlice/0_elements/marshal-8               5.666n ±  3%   5.642n ±  0%   -0.42% (p=0.000 n=10)
ObjectIDSlice/1_elements/to_grpc_message-8       53.10n ±  6%   29.78n ± 12%  -43.92% (p=0.000 n=10)
ObjectIDSlice/1_elements/from_grpc_message-8     28.99n ±  5%   29.77n ±  7%        ~ (p=0.165 n=10)
ObjectIDSlice/1_elements/marshal-8               49.08n ±  7%   50.72n ±  6%        ~ (p=0.218 n=10)
ObjectIDSlice/50_elements/to_grpc_message-8     1652.5n ±  7%   277.2n ±  1%  -83.22% (p=0.000 n=10)
ObjectIDSlice/50_elements/from_grpc_message-8    261.2n ± 11%   226.7n ± 15%  -13.19% (p=0.003 n=10)
ObjectIDSlice/50_elements/marshal-8              1.512µ ±  6%   1.514µ ±  6%        ~ (p=0.955 n=10)
geomean                                          52.15n         39.99n        -23.31%

                                              │      old       │                  new                   │
                                              │      B/op      │     B/op      vs base                  │
ObjectIDSlice/0_elements/to_grpc_message-8        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/0_elements/from_grpc_message-8      0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/0_elements/marshal-8                0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/1_elements/to_grpc_message-8        32.00 ± 0%       24.00 ± 0%  -25.00% (p=0.000 n=10)
ObjectIDSlice/1_elements/from_grpc_message-8      24.00 ± 0%       24.00 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/1_elements/marshal-8                48.00 ± 0%       48.00 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/50_elements/to_grpc_message-8     1.578Ki ± 0%     1.250Ki ± 0%  -20.79% (p=0.000 n=10)
ObjectIDSlice/50_elements/from_grpc_message-8   1.250Ki ± 0%     1.250Ki ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/50_elements/marshal-8             2.000Ki ± 0%     2.000Ki ± 0%        ~ (p=1.000 n=10) ¹
geomean                                                      ²                  -5.62%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                              │      old      │                 new                  │
                                              │   allocs/op   │ allocs/op   vs base                  │
ObjectIDSlice/0_elements/to_grpc_message-8       0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/0_elements/from_grpc_message-8     0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/0_elements/marshal-8               0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/1_elements/to_grpc_message-8       2.000 ± 0%     1.000 ± 0%  -50.00% (p=0.000 n=10)
ObjectIDSlice/1_elements/from_grpc_message-8     1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/1_elements/marshal-8               1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/50_elements/to_grpc_message-8     51.000 ± 0%     1.000 ± 0%  -98.04% (p=0.000 n=10)
ObjectIDSlice/50_elements/from_grpc_message-8    1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/50_elements/marshal-8              1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
geomean                                                     ²               -40.18%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-28 11:53:08 +03:00
5fece80b42 [#108] protogen: Distinguish between empty and nil messages
Refs #59

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-27 11:02:18 +03:00
adb7c602d7 [#77] protogen: Initial implementation
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-19 10:47:00 +03:00
35e7397d48 [#87] netmap: Extend enum Operation
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-08-07 16:21:50 +03:00
174773454e [#87] netmap: Regenerate to add LIKE operation for filter
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-08-06 17:20:29 +03:00
3dfa2f4fd6 [#95] *: Regenerate proto files
Remove SetExtendedEACL and AnnounceUsedSpace methods from the container
package.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-07-26 10:24:25 +03:00
491a47e7fe [#70] netmap: Regenerate protobuf for Replica
* Since EC field tags are renumerated, it is required
  to regenerate netmap grpc.
* Add a generator with EC replica to check it with
  unit-test.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-03-27 12:56:03 +03:00
1772b92182 [#69] object: Initial EC implementation
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-03-19 15:23:01 +03:00
17bed735a1 [#20] Update api version
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-08-17 11:10:12 +03:00
964c3edb3f [#51] *: Do not panic in StableSize()
After #49 it can be called on nil structures.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-08-02 10:55:10 +03:00
582d94c81c [#47] types: Fix unique flag conversion
Signed-off-by: Airat Arifullin a.arifullin@yadro.com
2023-07-19 13:03:35 +03:00
3add88d435 [#44] netmap: Fix ineffassign linter warning
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-06-29 11:26:49 +03:00
e9d67aa1b2 [#31] netmap: Add unique field marshaling for PlacementPolicy
Signed-off-by: Airat Arifullin a.arifullin@yadro.com
2023-06-14 13:02:50 +00:00
8266b31092 [#26] netmap: Add NOT and UNIQUE keywords
* Regenerate types.pb.go for netmap grpc
* Add unique flag to PlacementPolicy struct

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
2023-05-31 12:06:25 +03:00
e297616a48 [#27] *: Resolve unused linter warnings
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-05-03 14:15:56 +03:00
ff6d8db741 [#19] subnet: Drop related types and fields
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-04-18 13:29:50 +03:00
Pavel Karpy
d9347a05f0 [#21] *: Drop reputation system
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
2023-04-17 15:46:52 +03:00
9dc3753467 [#13] *: Rename __FROSTFS__ prefix to __SYSTEM__
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
2023-03-15 12:52:36 +03:00
8009022a20 [#13] *: Regenerate api
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
2023-03-15 12:52:28 +03:00
cd2e46a17c [#10] Add __FROSTFS__ system attributes
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
2023-03-13 09:59:22 +03:00
c46cd37f71 [#10] Generate api
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
2023-03-13 09:59:22 +03:00
f69d2ad83c Rename package name
Due to source code relocation from GitHub.

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
2023-03-07 13:42:36 +03:00
1351b6656d Move to frostfs-api
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2022-12-12 17:40:48 +03:00
Leonard Lyubich
5fc2644c68 [#416] session: Support new format of object session context
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-10-04 18:29:57 +04:00
Leonard Lyubich
cf868188ef [#418] netmap: Support NetmapService.NetmapSnapshot RPC
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-09-19 16:44:34 +04:00
Evgenii Stratonikov
ea7a3811bf [#415] *: Add maintenance status and node state
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-09-16 18:50:53 +04:00
Evgenii Stratonikov
1853349f22 [#415] *: Go fmt -s
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-09-16 18:50:53 +04:00
Leonard Lyubich
cdce7edc39 Release v2.13.0 - Yeonpyeongdo (연평도, 延坪島)
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-07-04 17:49:02 +03:00
Pavel Karpy
f9a91e5f33 [#404] *: Regenerate code after language fixes
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-06-21 14:08:31 +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
6f4908edc2 [#376] netmap: Make attributes a non-pointer slice
The speed of copying (which is done regulary for e.g. subnet changes)
is less, however it isn't on the hot path and the absolute time
difference is insignificant.
```
name              old time/op    new time/op    delta
NodeAttributes-8    96.2ns ± 1%   158.3ns ± 1%  +64.61%  (p=0.000 n=10+10)

name              old alloc/op   new alloc/op   delta
NodeAttributes-8     32.0B ± 0%     32.0B ± 0%     ~     (all equal)

name              old allocs/op  new allocs/op  delta
NodeAttributes-8      2.00 ± 0%      2.00 ± 0%     ~     (all equal)
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-15 12:19:49 +03:00
Evgenii Stratonikov
2f0eee96fc [#376] netmap: Replace slices of pointers with structs
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-15 12:19:49 +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
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
Pavel Karpy
3604d96f3f [#362] netmap: Add marshaling of the subnetID field of container policy
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-12-01 16:45:23 +03:00
Leonard Lyubich
d93828f465 [#356] netmap: Fix post-loop handling of zero subnet in IterateSubnets
Return any error other than `ErrRemoveSubnet` from `IterateSubnets`
during post-loop processing of zero subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-24 17:13:18 +03:00
Leonard Lyubich
50ab22c19c [#356] netmap: Improve docs and slightly optimize the code
API changes:
  * Rename `Enters` method of the `NodeSubnetInfo` to `Enabled`.
  * Declare undefined behavior of `WriteSubnetInfo` with non-unique
  attributes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-24 17:13:18 +03:00
Leonard Lyubich
abc494b2bc [#356] netmap: Simplify zero subnet processing in IterateSubnets
For now we don't need to distinguish cases of missing zero subnet's
attribute and the one with `True` value.

Remove local enum `zeroStatus` of `IterateSubnets` since we need to
distinguish between two statuses and use `bool` variable for this.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-24 17:13:18 +03:00
Leonard Lyubich
896cee4bb0 [#356] netmap: Increase test coverage of IterateSubnets
Add both `False` and `True` subnet attributes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-24 17:13:18 +03:00
Leonard Lyubich
dfb780a2b6 [#356] netmap: Document IterateSubnets behavior with duplicate keys
Node attributes must be key-unique. In current implementation
`IterateSubnets` doesn't monitor the uniqueness of keys.

Declare undefined behavior of `IterateSubnets` for non-unique attribute
keys.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-24 17:13:18 +03:00
Leonard Lyubich
4560e447e1 [#356] netmap: Fix potential double-processing of zero subnet
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-24 17:13:18 +03:00
Leonard Lyubich
051b103df3 [#356] netmap: Return missing subnets error from IterateSubnets
Each NeoFS storage node should be present in at least one subnet.

Make `netmap.IterateSubnets` function to return an error if the node by the
end of the loop does not belong to any subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-24 17:13:18 +03:00
Leonard Lyubich
348f9498bd [#356] netmap: Implement the functionality of working with subnets
NeoFS storage node can participate in a subnet group (at least one).
According to NeoFS API V2 protocol, subnets are entered and exited through
the attributes of the node. We should provide functionality for conveniently
setting and reading attributes based on the needs of the network.

Define `NodeSubnetInfo` type which groups information about the subnet
reflected in `NodeInfo`. Implement `WriteSubnetInfo` function which writes
`SubnetInfo` data to `NodeInfo`. It will be used to prepare a request for
registration on the NeoFS network. Implement `IterateSubnets` function which
allows to iterate over all subnets of the node. Moreover, it allows you to
remove a subnet from the `NodeInfo` right during iterative traversal.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-24 17:13:18 +03:00
Evgenii Stratonikov
68f28a1918 [#355] v2/refs: add subnetwork ID
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-18 15:04:15 +03:00
Evgenii Stratonikov
ad6a7999cd [#355] *: regenerate proto files
Add subnetwork ID to placement policy.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-18 15:04:15 +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