Compare commits

...

93 commits

Author SHA1 Message Date
c11f50efec
[#112] container: Remove GetExtendedACL
All checks were successful
DCO action / DCO (pull_request) Successful in 45s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m5s
Tests and linters / Tests (1.23) (pull_request) Successful in 1m6s
Tests and linters / Lint (pull_request) Successful in 1m12s
Tests and linters / Tests with -race (pull_request) Successful in 1m20s
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2024-09-02 14:10:49 +03:00
9c5e32a183
[#106] test: Generate correct data for tests
All checks were successful
DCO action / DCO (pull_request) Successful in 42s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m2s
Tests and linters / Tests (1.23) (pull_request) Successful in 1m1s
Tests and linters / Lint (pull_request) Successful in 1m6s
Tests and linters / Tests with -race (pull_request) Successful in 1m14s
Some tests are using invalid data that do not meet the requirements of the
FrostFS protocol, e.g.
- Container/Object IDs aren't 32 bytes long
- Signature key and sign have invalid length
- Split IDs aren't valid UUIDv4
and etc.

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2024-08-30 13:37:29 +03:00
5e1c6a908f [#111] protogen: Emit slice of messages without a pointer
All checks were successful
DCO action / DCO (pull_request) Successful in 41s
Tests and linters / Tests (1.22) (pull_request) Successful in 55s
Tests and linters / Tests (1.23) (pull_request) Successful in 57s
Tests and linters / Tests with -race (pull_request) Successful in 1m8s
Tests and linters / Lint (pull_request) Successful in 2m12s
```
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
a2025376fc [#111] proto/test: Add repeated message test
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-28 11:53:08 +03:00
eba18f6e67 [#110] object: Add getter and setter for PatchResponseBody
All checks were successful
DCO action / DCO (pull_request) Successful in 1m19s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m21s
Tests and linters / Tests (1.23) (pull_request) Successful in 1m28s
Tests and linters / Tests with -race (pull_request) Successful in 1m48s
Tests and linters / Lint (pull_request) Successful in 2m34s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-08-27 13:46:00 +03:00
ca33fc4adb [#109] rpc/message: Remove incorrect copypaste
All checks were successful
DCO action / DCO (pull_request) Successful in 1m22s
Tests and linters / Tests (1.23) (pull_request) Successful in 1m18s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m21s
Tests and linters / Tests with -race (pull_request) Successful in 1m36s
Tests and linters / Lint (pull_request) Successful in 2m33s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-27 11:36:08 +03:00
5fece80b42 [#108] protogen: Distinguish between empty and nil messages
All checks were successful
DCO action / DCO (pull_request) Successful in 39s
Tests and linters / Tests (1.22) (pull_request) Successful in 59s
Tests and linters / Tests (1.23) (pull_request) Successful in 57s
Tests and linters / Tests with -race (pull_request) Successful in 1m9s
Tests and linters / Lint (pull_request) Successful in 2m12s
Refs #59

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-27 11:02:18 +03:00
11e194d274 [#108] rpc/message: Add compatibility tests for marshaling
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-27 11:02:18 +03:00
9e82a5a31a [#107] Regenerate proto files
All checks were successful
Tests and linters / Tests (1.23) (pull_request) Successful in 1m1s
Tests and linters / Tests with -race (pull_request) Successful in 1m32s
Tests and linters / Tests (1.22) (pull_request) Successful in 45s
Tests and linters / Lint (pull_request) Successful in 1m56s
DCO action / DCO (pull_request) Successful in 28s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-26 14:36:19 +03:00
981dc785f3 [#107] proto/test: Add oneof test
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-26 14:36:19 +03:00
866db105ed [#107] protogen: Unify oneof getters with default protoc plugin
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-26 14:36:19 +03:00
937a53683a [#107] protogen: Fix oneof JSON marshaling
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-26 14:36:19 +03:00
4a00ef946f [#107] protogen: Fix oneof getter scalar default value
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-26 14:36:19 +03:00
f484ce6b0b [#107] Makefile: Generate standard protobuf bindings for tests
It was removed accidentally during transition.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-26 14:36:19 +03:00
61f6f0f4a2 [#107] proto/test: Regenerate *.pb.go
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-26 14:36:19 +03:00
c1b5f46f98 [#107] protogen: Remove unused parameter
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-26 14:36:19 +03:00
33653962b7 [#1316] go.mod: Bump go version to 1.22
All checks were successful
DCO action / DCO (pull_request) Successful in 42s
Tests and linters / Tests (1.22) (pull_request) Successful in 49s
Tests and linters / Tests (1.23) (pull_request) Successful in 1m6s
Tests and linters / Tests with -race (pull_request) Successful in 1m8s
Tests and linters / Lint (pull_request) Successful in 3m6s
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
2024-08-21 17:22:56 +03:00
a43110e363 [#77] Makefile: Mark protogen as .PHONY
All checks were successful
Tests and linters / Tests (1.19) (pull_request) Successful in 48s
Tests and linters / Tests (1.20) (pull_request) Successful in 49s
Tests and linters / Tests with -race (pull_request) Successful in 1m5s
DCO action / DCO (pull_request) Successful in 33s
Tests and linters / Lint (pull_request) Successful in 50s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-19 10:47:00 +03:00
7be31eb847 [#77] protogen: Add tests for JSON format
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-19 10:47:00 +03:00
adb7c602d7 [#77] protogen: Initial implementation
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-19 10:47:00 +03:00
a28ceb251a [#77] util/proto: Optimize int32 marshaling
This is the approach used in easyproto
52d3ac4744/writer.go (L203)

It allows to occupy slightly less space for negative numbers.
The format is still protobuf, although, technically, this is a breaking
change for our stable marshaling format.
However, we don't use int32 at all and all enums have positive values,
so nothing is broken.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-16 17:11:13 +03:00
d112a28d38 [#104] object: Add getters for PatchRequestBodyPatch
All checks were successful
DCO action / DCO (pull_request) Successful in 1m8s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m12s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m17s
Tests and linters / Lint (pull_request) Successful in 1m28s
Tests and linters / Tests with -race (pull_request) Successful in 1m35s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-08-13 18:51:51 +03:00
47a48969b0 [#103] proto: Test end-to-end scenario
All checks were successful
DCO action / DCO (pull_request) Successful in 1m27s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m36s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m43s
Tests and linters / Lint (pull_request) Successful in 1m51s
Tests and linters / Tests with -race (pull_request) Successful in 2m6s
Test the generated code, do not write yet another marshaling routine in
tests.

Before:
```
ok      git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto      0.003s  coverage: 55.6% of statements
```

After:
```
ok      git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto      0.003s  coverage: 80.0% of statements
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-09 11:18:17 +03:00
19247e8941 [#103] protogen: Handle uint32 type
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-09 11:18:17 +03:00
ff4f31b6f3 [#103] protogen: Handle files in all packages
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-09 11:18:17 +03:00
a0a9b765f3 [#101] Fix make test
All checks were successful
DCO action / DCO (pull_request) Successful in 43s
Tests and linters / Tests (1.19) (pull_request) Successful in 34s
Tests and linters / Tests (1.20) (pull_request) Successful in 38s
Tests and linters / Lint (pull_request) Successful in 57s
Tests and linters / Tests with -race (pull_request) Successful in 1m5s
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-08-09 09:35:25 +03:00
280d052cef [#101] Remove usage of folder vendor
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-08-08 17:38:49 +03:00
35e7397d48 [#87] netmap: Extend enum Operation
All checks were successful
DCO action / DCO (pull_request) Successful in 39s
Tests and linters / Tests (1.19) (pull_request) Successful in 44s
Tests and linters / Tests (1.20) (pull_request) Successful in 51s
Tests and linters / Tests with -race (pull_request) Successful in 1m17s
Tests and linters / Lint (pull_request) Successful in 1m59s
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
b72aa14bab [#87] proto: Process files with protoc version 27.2
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-08-06 17:20:29 +03:00
42e50c9633 [#87] Makefile: Add target protoc-install
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-08-06 17:20:21 +03:00
611355510c [#87] go.mod: Update google.golang.org/grpc to v1.63.2
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-08-06 16:57:57 +03:00
ebaf78c8fa [#100] session: Introduce ObjectPatch verb
All checks were successful
DCO action / DCO (pull_request) Successful in 39s
Tests and linters / Tests (1.19) (pull_request) Successful in 51s
Tests and linters / Tests (1.20) (pull_request) Successful in 52s
Tests and linters / Lint (pull_request) Successful in 1m3s
Tests and linters / Tests with -race (pull_request) Successful in 1m7s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-08-06 12:31:11 +03:00
1473fa588f [#98] rpc: Accept interface in place of ClientConn
All checks were successful
Tests and linters / Tests (1.19) (pull_request) Successful in 48s
DCO action / DCO (pull_request) Successful in 44s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m2s
Tests and linters / Tests with -race (pull_request) Successful in 1m9s
Tests and linters / Lint (pull_request) Successful in 1m29s
gRPC client load-balancing API is ugly as f:
1. It is configured by pre-registering a balancer and the providing JSON
   configuration.
2. It doesn't allow different credentials for different endpoints
   (consider using "insecure" localhost and external endpoint).
3. To support frostfs usecase we also need to implement a resolver,
   which has its own difficulties.
4. https://github.com/grpc/grpc-go/issues/239#issuecomment-264548415

Using interface in place of grpc.ClientConn allows us to provide custom
implentation for it (load-balancing, circuit breaker etc.).

Refs TrueCloudLab/frostfs-node#1268

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-01 08:50:24 +03:00
c27b978770 [#97] signature: Add Patch messages to serviceMessageBody
All checks were successful
DCO action / DCO (pull_request) Successful in 54s
Tests and linters / Tests (1.20) (pull_request) Successful in 50s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m0s
Tests and linters / Lint (pull_request) Successful in 1m3s
Tests and linters / Tests with -race (pull_request) Successful in 1m5s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-07-30 17:52:54 +03:00
8609f29a60 [#97] object: Refactor Patch related structs
* Add getters and setters for related types;
* Fix unit-tests.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-07-30 17:52:49 +03:00
8ce8cd6ec2 [#96] .golangci.yml: Fix deprecated config options
All checks were successful
DCO action / DCO (pull_request) Successful in 55s
Tests and linters / Tests (1.19) (pull_request) Successful in 52s
Tests and linters / Tests (1.20) (pull_request) Successful in 54s
Tests and linters / Tests with -race (pull_request) Successful in 1m18s
Tests and linters / Lint (pull_request) Successful in 2m35s
```
WARN [config_reader] The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`.
WARN [config_reader] The configuration option `output.format` is deprecated, please use `output.formats`
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-07-29 15:45:01 +03:00
8580b49c8d [#94] rpc: Introduce ObjectService.Patch method
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-07-29 08:55:14 +00:00
9b90d139c5 [#94] object: Generate protobufs for Patch method
* Generate protobufs for patch method;
* Create marshalers, unmarshalers, converters for gererated types;
* Add unit-tests.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-07-29 08:55:14 +00:00
3dfa2f4fd6 [#95] *: Regenerate proto files
All checks were successful
DCO action / DCO (pull_request) Successful in 1m0s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m22s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m25s
Tests and linters / Lint (pull_request) Successful in 1m32s
Tests and linters / Tests with -race (pull_request) Successful in 2m20s
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
f517e39491 [#91] protogen: Support unpacked repeated uint64 fields
All checks were successful
DCO action / DCO (pull_request) Successful in 1m18s
Tests and linters / Lint (pull_request) Successful in 1m31s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m39s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m45s
Tests and linters / Tests with -race (pull_request) Successful in 2m21s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-07-16 14:39:20 +03:00
3639563d80 [#90] apemanager: Run gofumpt
All checks were successful
DCO action / DCO (pull_request) Successful in 1m43s
Tests and linters / Lint (pull_request) Successful in 3m2s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m57s
Tests and linters / Tests (1.20) (pull_request) Successful in 3m0s
Tests and linters / Tests with -race (pull_request) Successful in 3m41s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-07-15 16:40:21 +03:00
610c450a65 [#90] proto/test: Fix go vet warnings
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-07-15 16:40:21 +03:00
3f92d7bfb0 [#90] proto/test: Fix proto file formatting
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-07-15 16:40:21 +03:00
dafc9e5476 [#86] status: Regenerate common status
All checks were successful
DCO action / DCO (pull_request) Successful in 1m35s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m38s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m54s
Tests and linters / Tests with -race (pull_request) Successful in 2m16s
Tests and linters / Lint (pull_request) Successful in 6m8s
* INVALID_ARGUMENT is a new common status constant.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-06-24 11:55:48 +03:00
2f6d3209e1 [#84] object: Regenerate EC-header type
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-05-30 15:28:26 +00:00
9e825239ac [#85] acl: Regenerate protobufs for Bearer token
All checks were successful
DCO action / DCO (pull_request) Successful in 57s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m31s
Tests and linters / Lint (pull_request) Successful in 1m42s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m41s
Tests and linters / Tests with -race (pull_request) Successful in 2m17s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-05-29 19:45:44 +03:00
9789b79b1d [#85] apemanager: Generate protobufs for ape package
* Regenerate protobufs as APE specific type are defined
  as separate package;
* Move `ape` package related utils methods from `apemanager`.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-05-29 14:15:49 +03:00
0803bc6ded [#83] object: Regenerate protobufs for ECHeader
All checks were successful
Tests and linters / Tests (1.19) (pull_request) Successful in 11m59s
Tests and linters / Tests (1.20) (pull_request) Successful in 12m5s
DCO action / DCO (pull_request) Successful in 12m27s
Tests and linters / Tests with -race (pull_request) Successful in 12m25s
Tests and linters / Lint (pull_request) Successful in 12m52s
* Fix marshalers and converters;
* Fix unit-tests.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-05-16 16:31:03 +03:00
4fe42ac4ad [#82] object: Add FilterHeaderECParent filter for v2
All checks were successful
DCO action / DCO (pull_request) Successful in 1m0s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m20s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m30s
Tests and linters / Lint (pull_request) Successful in 1m53s
Tests and linters / Tests with -race (pull_request) Successful in 1m49s
* `FilterHeaderECParent` is used by `Object.Search`

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-05-13 17:03:55 +03:00
063ce11c24 [#82] object: Erase field Signature from ECHeader v2 type
All checks were successful
DCO action / DCO (pull_request) Successful in 1m17s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m45s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m58s
Tests and linters / Lint (pull_request) Successful in 2m6s
Tests and linters / Tests with -race (pull_request) Successful in 2m9s
* The field `Signature` is not used and should be factored out.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-05-08 15:09:16 +03:00
bc7b49eed2 [#82] object: Introduce new fields for EC header
* Regenerate protobufs as frostfs-api introduced `parent_split_id` and
  `parent_split_index` fields.
* Fix marshaller and converter for EC header.
* Extend v2 type `ECHeader` with `ParentSplitID` and `ParentSplitIndex` fields.
* Fix message_test for `Object`. Also generate EC headers and check it.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-05-08 15:09:12 +03:00
b171364079 [#81] rpc: Fix apemanager rpc service name
All checks were successful
DCO action / DCO (pull_request) Successful in 1m4s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m10s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m27s
Tests and linters / Lint (pull_request) Successful in 1m44s
Tests and linters / Tests with -race (pull_request) Successful in 1m48s
* Introduce `frostfsServiceNamePrefix` for rpc interface
  since `apemanager` uses `frostfs` root instead `neo.fs`.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-05-06 14:46:54 +03:00
0fe6b9adbb [#76] Make setter names more consistent
All checks were successful
DCO action / DCO (pull_request) Successful in 1m2s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m33s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m38s
Tests and linters / Lint (pull_request) Successful in 1m46s
Tests and linters / Tests with -race (pull_request) Successful in 1m44s
This will make the transition to a new codegen more seamless.
1. Setter should be named as the field itself.
2. Setter should accept 1 parameter.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-05-03 08:52:04 +03:00
fa8f92d662 [#75] audit: Remove deprecated service
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-05-02 11:54:35 +00:00
387b850e5e [#74] apemanager: Generate protobufs for apemanager service
* Generate protobufs.
* Make marshallers, unmarshallers, json-encoders etc.
* Create message encoding/decoding unit-tests.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-05-02 11:53:26 +00:00
67c6f305b2 [#79] object: Implement Range\RangeHash requests for EC object
All checks were successful
DCO action / DCO (pull_request) Successful in 1m16s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m37s
Tests and linters / Lint (pull_request) Successful in 1m56s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m9s
Tests and linters / Tests with -race (pull_request) Successful in 2m2s
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-04-27 23:04:46 +03:00
df9b65324a [#73] object: Implement Get\Head requests for EC object
All checks were successful
DCO action / DCO (pull_request) Successful in 45s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m13s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m27s
Tests and linters / Lint (pull_request) Successful in 1m35s
Tests and linters / Tests with -race (pull_request) Successful in 1m58s
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-04-22 18:14:50 +03:00
4a330a5706 [#72] session: Unify unmarshaling code
All checks were successful
DCO action / DCO (pull_request) Successful in 1m1s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m24s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m32s
Tests and linters / Lint (pull_request) Successful in 1m43s
Tests and linters / Tests with -race (pull_request) Successful in 2m1s
gopatch:
```
@@
var err, msg, data, t, protojson identifier
var obj expression
@@
+import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
-import protojson "google.golang.org/protobuf/encoding/protojson"

-msg := obj
-if err := protojson.Unmarshal(data, msg); err != nil {
-return err
-}
-return t.FromGRPCMessage(msg)
+return message.UnmarshalJSON(t, data, obj)

@@
var err, msg, data, t, goproto identifier
var obj expression
@@
+import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
-import goproto "google.golang.org/protobuf/proto"

-msg := obj
-if err := goproto.Unmarshal(data, msg); err != nil {
-return err
-}
-return t.FromGRPCMessage(msg)
+return message.Unmarshal(t, data, obj)
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-04-20 14:19:19 +03:00
491a47e7fe [#70] netmap: Regenerate protobuf for Replica
All checks were successful
DCO action / DCO (pull_request) Successful in 1m3s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m32s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m28s
Tests and linters / Lint (pull_request) Successful in 1m38s
Tests and linters / Tests with -race (pull_request) Successful in 2m0s
* 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
6e9d385f3c [#71] container: Introduce CONTAINER_ACCESS_DENIED status
All checks were successful
DCO action / DCO (pull_request) Successful in 1m19s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m56s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m2s
Tests and linters / Lint (pull_request) Successful in 2m12s
Tests and linters / Tests with -race (pull_request) Successful in 2m28s
* Regenerate protobufs for object and container service to
  use a new frostfs-api status CONTAINER_ACCESS_DENIED.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-03-26 18:55:05 +03:00
1772b92182 [#69] object: Initial EC implementation
All checks were successful
DCO action / DCO (pull_request) Successful in 1m7s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m37s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m33s
Tests and linters / Lint (pull_request) Successful in 1m46s
Tests and linters / Tests with -race (pull_request) Successful in 1m45s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-03-19 15:23:01 +03:00
a85146250b [#68] Makefile: Use gofumpt for formatting
All checks were successful
DCO action / DCO (pull_request) Successful in 1m17s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m22s
Tests and linters / Lint (pull_request) Successful in 2m51s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m48s
Tests and linters / Tests with -race (pull_request) Successful in 2m40s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-03-14 10:31:58 +03:00
ea6e390c7b [#68] pre-commit: Add unit test hook
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-03-14 10:31:58 +03:00
4d35da7c77 [#68] Makefile: Allow to override testflags
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-03-14 10:31:58 +03:00
a7bcad6aa9 [#68] Makefile: Drop GO111MODULE usages
It is ignored since go1.17.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-03-14 10:31:58 +03:00
6fb9cae479 [#68] pre-commit: Update golangci-lint to 1.56.2
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-03-14 10:31:58 +03:00
f69ad7ade0 [#68] pre-commit: Remove gitlint
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-03-14 10:31:58 +03:00
c1c7b344b9 [#67] go.mod: Bump protobuf version
All checks were successful
DCO action / DCO (pull_request) Successful in 6m8s
Tests and linters / Tests (1.19) (pull_request) Successful in 6m16s
Tests and linters / Tests (1.20) (pull_request) Successful in 6m27s
Tests and linters / Tests with -race (pull_request) Successful in 6m40s
Tests and linters / Lint (pull_request) Successful in 7m0s
Found by vulncheck:
Vulnerability #1: GO-2024-2611
    Infinite loop in JSON unmarshaling in google.golang.org/protobuf
  More info: https://pkg.go.dev/vuln/GO-2024-2611
  Module: google.golang.org/protobuf
    Found in: google.golang.org/protobuf@v1.32.0
    Fixed in: google.golang.org/protobuf@v1.33.0

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-03-06 13:18:14 +03:00
634e24aba7 [#65] object: Fix SetMarshalData for PutSingle request
All checks were successful
DCO action / DCO (pull_request) Successful in 1m11s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m25s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m33s
Tests and linters / Tests with -race (pull_request) Successful in 1m56s
Tests and linters / Lint (pull_request) Successful in 1m14s
Allow to reset marshal data

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-02-15 15:44:01 +03:00
2a124b95bc [#64] object: Allow to reset marshal data
All checks were successful
DCO action / DCO (pull_request) Successful in 58s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m24s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m32s
Tests and linters / Lint (pull_request) Successful in 1m43s
Tests and linters / Tests with -race (pull_request) Successful in 2m5s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-02-15 14:47:28 +03:00
d60ce83e42 [#63] .forgejo: Update dco-go to v3
All checks were successful
DCO action / DCO (pull_request) Successful in 5m9s
Tests and linters / Tests (1.20) (pull_request) Successful in 7m17s
Tests and linters / Tests with -race (pull_request) Successful in 8m39s
Tests and linters / Tests (1.19) (pull_request) Successful in 10m2s
Tests and linters / Lint (pull_request) Successful in 12m37s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-01-26 12:19:53 +03:00
72885aae83 [#62] signature: Refactor BufferPool
All checks were successful
Tests and linters / Tests (1.19) (pull_request) Successful in 7m46s
DCO action / DCO (pull_request) Successful in 8m16s
Tests and linters / Tests (1.20) (pull_request) Successful in 9m24s
Tests and linters / Tests with -race (pull_request) Successful in 9m25s
Tests and linters / Lint (pull_request) Successful in 9m49s
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2024-01-12 18:09:28 +03:00
b46e8cfbda [#59] util: Rename stableMarshaler
All checks were successful
DCO action / DCO (pull_request) Successful in 1m23s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m46s
Tests and linters / Lint (pull_request) Successful in 1m59s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m7s
Tests and linters / Tests with -race (pull_request) Successful in 2m22s
It should be with a single `l`, see `json.Marshaler`.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-11-21 15:28:03 +03:00
9cc2095446 [#59] util: Restore backwards compatibility in NestedStructureMarshal()
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-11-21 15:27:57 +03:00
498877e378 [#58] makefile: Disable test results caching
All checks were successful
DCO action / DCO (pull_request) Successful in 59s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m38s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m37s
Tests and linters / Tests with -race (pull_request) Successful in 1m52s
Tests and linters / Lint (pull_request) Successful in 2m13s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-10-31 13:47:48 +03:00
f50872f1bc [#58] object: Allow to set marshal data
Now it is possible set marshaled data to reduce memory
allocations.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-10-31 13:47:48 +03:00
309aa4ac78 Release v2.16.0
All checks were successful
DCO action / DCO (pull_request) Successful in 52s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m24s
Tests and linters / Tests with -race (pull_request) Successful in 1m28s
Tests and linters / Tests (1.20) (pull_request) Successful in 6m25s
Tests and linters / Lint (pull_request) Successful in 7m11s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-09-14 13:20:13 +03:00
17bed735a1 [#20] Update api version
All checks were successful
DCO action / DCO (pull_request) Successful in 1m14s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m39s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m42s
Tests and linters / Lint (pull_request) Successful in 1m57s
Tests and linters / Tests with -race (pull_request) Successful in 2m5s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-08-17 11:10:12 +03:00
022f818735 [#20] Remove storage groups
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-08-17 11:10:08 +03:00
d989c8d2a3 [#54] *: Fix linter warnings
All checks were successful
DCO action / DCO (pull_request) Successful in 2m25s
Tests and linters / Tests (1.20) (pull_request) Successful in 3m19s
Tests and linters / Tests with -race (pull_request) Successful in 4m42s
Tests and linters / Tests (1.19) (pull_request) Successful in 5m29s
Tests and linters / Lint (pull_request) Successful in 5m53s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-08-11 15:21:27 +03:00
0671f42ee1 [#54] .forgejo: Add DCO action
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-08-11 15:21:27 +03:00
9a7b47d769 [#50] util: Use protowire for util/proto helpers
* Use methods to calculate size

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
2023-08-10 16:40:53 +00:00
67b18d3550 [#53] Bump min go version to go1.20
Some checks failed
Tests and linters / Lint (pull_request) Failing after 4s
Tests and linters / Tests (1.19) (pull_request) Failing after 3s
Tests and linters / Tests (1.20) (pull_request) Failing after 2s
Tests and linters / Tests with -race (pull_request) Failing after 2s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-08-09 09:55:51 +03:00
964c3edb3f [#51] *: Do not panic in StableSize()
All checks were successful
Tests and linters / Lint (pull_request) Successful in 2m0s
Tests and linters / Tests (1.19) (pull_request) Successful in 3m27s
Tests and linters / Tests with -race (pull_request) Successful in 1m44s
Tests and linters / Tests (1.20) (pull_request) Successful in 3m29s
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
3072090c77 [#51] protogen: Do not panic in StableSize()
All checks were successful
Tests and linters / Lint (pull_request) Successful in 1m56s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m7s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m37s
Tests and linters / Tests with -race (pull_request) Successful in 1m44s
Refs TrueCloudLab/frostfs-node#554 .

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-08-02 10:47:14 +03:00
7a5ee927c8 [#49] util/proto: Do not allocate in StringSize()
All checks were successful
Tests and linters / Tests (1.19) (pull_request) Successful in 1m1s
Tests and linters / Lint (pull_request) Successful in 2m10s
Tests and linters / Tests with -race (pull_request) Successful in 2m18s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m52s
It was not catched by the test because most of the time the function is
inlined. However, I've seen it allocating with pprof in one of the
earlier builds.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-07-26 18:52:59 +03:00
7133a01ccf [#49] message/test: Add test for zero-alloc StableSize()
All checks were successful
Tests and linters / Tests (1.19) (pull_request) Successful in 54s
Tests and linters / Lint (pull_request) Successful in 1m44s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m28s
Tests and linters / Tests with -race (pull_request) Successful in 4m46s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-07-26 18:32:17 +03:00
43ad0f114c [#49] session: Make StableSize() zero-alloc
For this to work, it is necessary that `NestedStructureSize` is a generic function.
Otherwise, we would allocate to put it in the interface.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-07-26 18:31:31 +03:00
6e92d7d5de [#49] util/proto: Make NestedStructure* generic
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-07-26 18:31:23 +03:00
849de02bc3 [#49] util/proto: Calculate repeated field size without allocations
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-07-26 18:31:23 +03:00
59c8421597 [#49] util/proto: Use StableSize() to determine if the struct is empty
`reflect` is not necessary here, and checking `StableSize` is what we
_want_ anyway.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-07-26 18:31:00 +03:00
582d94c81c [#47] types: Fix unique flag conversion
All checks were successful
Tests and linters / Tests (1.19) (pull_request) Successful in 1m26s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m6s
Tests and linters / Tests with -race (pull_request) Successful in 2m23s
Tests and linters / Lint (pull_request) Successful in 9m12s
Signed-off-by: Airat Arifullin a.arifullin@yadro.com
2023-07-19 13:03:35 +03:00
199 changed files with 7568 additions and 5757 deletions

View file

@ -0,0 +1,21 @@
name: DCO action
on: [pull_request]
jobs:
dco:
name: DCO
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.23'
- name: Run commit format checker
uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3
with:
from: 'origin/${{ github.event.pull_request.base.ref }}'

View file

@ -11,7 +11,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.23'
cache: true
- name: golangci-lint
@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_versions: [ '1.19', '1.20' ]
go_versions: [ '1.22', '1.23' ]
fail-fast: false
steps:
- uses: actions/checkout@v3
@ -47,7 +47,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.23'
cache: true
- name: Run tests

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
.idea
bin
temp
/vendor/

View file

@ -1,10 +0,0 @@
[general]
fail-without-commits=true
contrib=CC1
[title-match-regex]
regex=^\[\#[0-9Xx]+\]\s
[ignore-by-title]
regex=^Release(.*)
ignore=title-match-regex

View file

@ -9,13 +9,11 @@ run:
# include test files or not, default is true
tests: false
skip-files:
- (^|.*/)grpc/(.*)
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: tab
formats:
- format: tab
# all available settings of specific linters
linters-settings:
@ -67,6 +65,9 @@ linters:
fast: false
issues:
exclude-files:
- (^|.*/)grpc/(.*)
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: v2 # ignore stutters in universal structures due to protobuf compatibility

View file

@ -18,13 +18,25 @@ repos:
- id: end-of-file-fixer
exclude: ".key$"
- repo: local
hooks:
- id: gofumpt
name: gofumpt
entry: make fumpt
pass_filenames: false
types: [go]
language: system
- repo: local
hooks:
- id: go-unit-tests
name: go unit tests
entry: make test GOFLAGS=''
pass_filenames: false
types: [go]
language: system
- repo: https://github.com/golangci/golangci-lint
rev: v1.51.2
rev: v1.56.2
hooks:
- id: golangci-lint
- repo: https://github.com/jorisroovers/gitlint
rev: v0.18.0
hooks:
- id: gitlint
stages: [commit-msg]

View file

@ -2,11 +2,23 @@
## [Unreleased]
### Added
### Fixed
### Changed
### Removed
### Updated
## [2.16.0] - 2023-09-14 - Academy of Sciences Glacier
### Added
- Add impersonate flag to bearer token (#17)
- `NOT` and `UNIQUE` keywords to the placement policy (#26)
- `PutSingle` RPC (#45)
### Fixed
### Changed
- `StableSize()` is optimized and no does no allocations (#49)
- Marshaling code now uses `protowire` package (#50)
### Removed
- Reputation system (#21)

View file

@ -2,61 +2,95 @@
SHELL = bash
VERSION ?= $(shell git describe --tags --match "v*" --abbrev=8 --dirty --always)
PROTOC_VERSION ?= 27.2
PROTOC_GEN_GO_VERSION ?= $(shell go list -f '{{.Version}}' -m google.golang.org/protobuf)
PROTOC_OS_VERSION=osx-x86_64
ifeq ($(shell uname), Linux)
PROTOC_OS_VERSION=linux-x86_64
endif
.PHONY: dep fmts fmt imports protoc test lint version help
BIN = bin
PROTOBUF_DIR ?= $(abspath $(BIN))/protobuf
PROTOC_DIR ?= $(PROTOBUF_DIR)/protoc-v$(PROTOC_VERSION)
PROTOC_GEN_GO_DIR ?= $(PROTOBUF_DIR)/protoc-gen-go-$(PROTOC_GEN_GO_VERSION)
.PHONY: dep fmts fumpt imports protoc test lint version help $(BIN)/protogen protoc-test
# Pull go dependencies
dep:
@printf "⇒ Tidy requirements : "
CGO_ENABLED=0 \
GO111MODULE=on \
go mod tidy -v && echo OK
@printf "⇒ Download requirements: "
CGO_ENABLED=0 \
GO111MODULE=on \
go mod download && echo OK
@printf "⇒ Install test requirements: "
CGO_ENABLED=0 \
GO111MODULE=on \
go test ./... && echo OK
# Run all code formatters
fmts: fmt imports
# Reformat code
fmt:
@echo "⇒ Processing gofmt check"
@for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \
GO111MODULE=on gofmt -s -w $$f; \
done
fmts: fumpt imports
# Reformat imports
imports:
@echo "⇒ Processing goimports check"
@for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \
GO111MODULE=on goimports -w $$f; \
@for f in `find . -type f -name '*.go' -not -name '*.pb.go' -prune`; do \
goimports -w $$f; \
done
# Run gofumpt
fumpt:
@echo "⇒ Processing gofumpt check"
@gofumpt -l -w .
# Install protoc
protoc-install:
@rm -rf $(PROTOBUF_DIR)
@mkdir -p $(PROTOBUF_DIR)
@echo "⇒ Installing protoc... "
@wget -q -O $(PROTOBUF_DIR)/protoc-$(PROTOC_VERSION).zip 'https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-$(PROTOC_OS_VERSION).zip'
@unzip -q -o $(PROTOBUF_DIR)/protoc-$(PROTOC_VERSION).zip -d $(PROTOC_DIR)
@rm $(PROTOBUF_DIR)/protoc-$(PROTOC_VERSION).zip
@echo "⇒ Installing protoc-gen-go..."
@GOBIN=$(PROTOC_GEN_GO_DIR) go install -v google.golang.org/protobuf/...@$(PROTOC_GEN_GO_VERSION)
# Regenerate code for proto files
protoc:
@GOPRIVATE=github.com/TrueCloudLab go mod vendor
# Install specific version for protobuf lib
@go list -f '{{.Path}}/...@{{.Version}}' -m google.golang.org/protobuf | xargs go install -v
@if [ ! -d "$(PROTOC_DIR)" ] || [ ! -d "$(PROTOC_GEN_GO_DIR)" ]; then \
make protoc-install; \
fi
# Protoc generate
@for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \
@for f in `find . -type f -name '*.proto' -not -path './bin/*' -not -path './util/proto/test/*'`; do \
echo "⇒ Processing $$f "; \
protoc \
--proto_path=.:./vendor:/usr/local/include \
--go_out=. --go_opt=paths=source_relative \
$(PROTOC_DIR)/bin/protoc \
--proto_path=.:$(PROTOC_DIR)/include:/usr/local/include \
--plugin=protoc-gen-go-frostfs=$(abspath ./bin/protogen) \
--go-frostfs_out=fuzz=true:. \
--go-frostfs_opt=paths=source_relative \
--go-grpc_opt=require_unimplemented_servers=false \
--go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \
done
rm -rf vendor
$(BIN)/protogen:
@go build -v -trimpath \
-o $(BIN)/protogen \
./util/protogen
protoc-test: protoc $(BIN)/protogen
@$(PROTOC_DIR)/bin/protoc \
--go_out=. --go_opt=paths=source_relative \
--plugin=protoc-gen-go-frostfs=$(abspath $(BIN)/protogen) \
--go-frostfs_opt=Mutil/proto/test/test.proto=git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test/custom \
--go-frostfs_opt=module=git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 \
--go-frostfs_out=. --go-frostfs_opt=paths=import \
./util/proto/test/test.proto
# Run Unit Test with go test
test: GOFLAGS ?= "-count=1"
test:
@echo "⇒ Running go test"
@GO111MODULE=on go test ./...
@GOFLAGS="$(GOFLAGS)" go test ./...
# Run linters
lint:

View file

@ -1,46 +0,0 @@
package accounting
import (
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
// SetOwnerId sets identifier of the account owner.
func (m *BalanceRequest_Body) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetBody sets body of the request.
func (m *BalanceRequest) SetBody(v *BalanceRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *BalanceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetBalance sets balance value of the response.
func (m *BalanceResponse_Body) SetBalance(v *Decimal) {
m.Balance = v
}
// SetBody sets body of the response.
func (m *BalanceResponse) SetBody(v *BalanceResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *BalanceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}

Binary file not shown.

BIN
accounting/grpc/service_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,45 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
func DoFuzzProtoBalanceRequest(data []byte) int {
msg := new(BalanceRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONBalanceRequest(data []byte) int {
msg := new(BalanceRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoBalanceResponse(data []byte) int {
msg := new(BalanceResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONBalanceResponse(data []byte) int {
msg := new(BalanceResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,31 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
import (
testing "testing"
)
func FuzzProtoBalanceRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoBalanceRequest(data)
})
}
func FuzzJSONBalanceRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONBalanceRequest(data)
})
}
func FuzzProtoBalanceResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoBalanceResponse(data)
})
}
func FuzzJSONBalanceResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONBalanceResponse(data)
})
}

Binary file not shown.

View file

@ -1,11 +0,0 @@
package accounting
// SetValue sets value of the decimal number.
func (m *Decimal) SetValue(v int64) {
m.Value = v
}
// SetPrecision sets precision of the decimal number.
func (m *Decimal) SetPrecision(v uint32) {
m.Precision = v
}

Binary file not shown.

BIN
accounting/grpc/types_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,26 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
func DoFuzzProtoDecimal(data []byte) int {
msg := new(Decimal)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDecimal(data []byte) int {
msg := new(Decimal)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,21 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
import (
testing "testing"
)
func FuzzProtoDecimal(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDecimal(data)
})
}
func FuzzJSONDecimal(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDecimal(data)
})
}

View file

@ -2,6 +2,8 @@ package acl
import (
acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
apeGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
@ -164,7 +166,7 @@ func (f *HeaderFilter) ToGRPCMessage() grpc.Message {
m.SetKey(f.key)
m.SetValue(f.value)
m.SetHeader(HeaderTypeToGRPCField(f.hdrType))
m.SetHeaderType(HeaderTypeToGRPCField(f.hdrType))
m.SetMatchType(MatchTypeToGRPCField(f.matchType))
}
@ -185,28 +187,26 @@ func (f *HeaderFilter) FromGRPCMessage(m grpc.Message) error {
return nil
}
func HeaderFiltersToGRPC(fs []HeaderFilter) (res []*acl.EACLRecord_Filter) {
func HeaderFiltersToGRPC(fs []HeaderFilter) (res []acl.EACLRecord_Filter) {
if fs != nil {
res = make([]*acl.EACLRecord_Filter, 0, len(fs))
res = make([]acl.EACLRecord_Filter, 0, len(fs))
for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter))
res = append(res, *fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter))
}
}
return
}
func HeaderFiltersFromGRPC(fs []*acl.EACLRecord_Filter) (res []HeaderFilter, err error) {
func HeaderFiltersFromGRPC(fs []acl.EACLRecord_Filter) (res []HeaderFilter, err error) {
if fs != nil {
res = make([]HeaderFilter, len(fs))
for i := range fs {
if fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
}
}
@ -239,28 +239,26 @@ func (t *Target) FromGRPCMessage(m grpc.Message) error {
return nil
}
func TargetsToGRPC(ts []Target) (res []*acl.EACLRecord_Target) {
func TargetsToGRPC(ts []Target) (res []acl.EACLRecord_Target) {
if ts != nil {
res = make([]*acl.EACLRecord_Target, 0, len(ts))
res = make([]acl.EACLRecord_Target, 0, len(ts))
for i := range ts {
res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord_Target))
res = append(res, *ts[i].ToGRPCMessage().(*acl.EACLRecord_Target))
}
}
return
}
func TargetsFromGRPC(fs []*acl.EACLRecord_Target) (res []Target, err error) {
func TargetsFromGRPC(fs []acl.EACLRecord_Target) (res []Target, err error) {
if fs != nil {
res = make([]Target, len(fs))
for i := range fs {
if fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
}
}
@ -307,28 +305,26 @@ func (r *Record) FromGRPCMessage(m grpc.Message) error {
return nil
}
func RecordsToGRPC(ts []Record) (res []*acl.EACLRecord) {
func RecordsToGRPC(ts []Record) (res []acl.EACLRecord) {
if ts != nil {
res = make([]*acl.EACLRecord, 0, len(ts))
res = make([]acl.EACLRecord, 0, len(ts))
for i := range ts {
res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord))
res = append(res, *ts[i].ToGRPCMessage().(*acl.EACLRecord))
}
}
return
}
func RecordsFromGRPC(fs []*acl.EACLRecord) (res []Record, err error) {
func RecordsFromGRPC(fs []acl.EACLRecord) (res []Record, err error) {
if fs != nil {
res = make([]Record, len(fs))
for i := range fs {
if fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
}
}
@ -418,6 +414,54 @@ func (l *TokenLifetime) FromGRPCMessage(m grpc.Message) error {
return nil
}
func (c *APEOverride) ToGRPCMessage() grpc.Message {
var m *acl.BearerToken_Body_APEOverride
if c != nil {
m = new(acl.BearerToken_Body_APEOverride)
m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
if len(c.chains) > 0 {
apeChains := make([]apeGRPC.Chain, len(c.chains))
for i := range c.chains {
apeChains[i] = *c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
}
m.SetChains(apeChains)
}
}
return m
}
func (c *APEOverride) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*acl.BearerToken_Body_APEOverride)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
if targetGRPC := v.GetTarget(); targetGRPC != nil {
if c.target == nil {
c.target = new(ape.ChainTarget)
}
if err := c.target.FromGRPCMessage(v.GetTarget()); err != nil {
return err
}
}
if apeChains := v.GetChains(); len(apeChains) > 0 {
c.chains = make([]*ape.Chain, len(apeChains))
for i := range apeChains {
c.chains[i] = new(ape.Chain)
if err := c.chains[i].FromGRPCMessage(&apeChains[i]); err != nil {
return err
}
}
}
return nil
}
func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message {
var m *acl.BearerToken_Body
@ -427,7 +471,8 @@ func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message {
m.SetOwnerId(bt.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID))
m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime))
m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable))
m.SetImpersonate(bt.impersonate)
m.SetAllowImpersonate(bt.impersonate)
m.SetApeOverride(bt.apeOverride.ToGRPCMessage().(*acl.BearerToken_Body_APEOverride))
}
return m
@ -477,7 +522,19 @@ func (bt *BearerTokenBody) FromGRPCMessage(m grpc.Message) error {
bt.eacl = new(Table)
}
err = bt.eacl.FromGRPCMessage(eacl)
if err = bt.eacl.FromGRPCMessage(eacl); err != nil {
return err
}
}
if apeOverrideGRPC := v.GetApeOverride(); apeOverrideGRPC != nil {
if bt.apeOverride == nil {
bt.apeOverride = new(APEOverride)
}
err = bt.apeOverride.FromGRPCMessage(apeOverrideGRPC)
if err != nil {
return err
}
}
bt.impersonate = v.GetAllowImpersonate()

View file

@ -1,180 +0,0 @@
package acl
import (
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
)
// SetVersion sets version of EACL rules in table.
func (m *EACLTable) SetVersion(v *refs.Version) {
m.Version = v
}
// SetContainerId sets container identifier of the eACL table.
func (m *EACLTable) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetRecords sets record list of the eACL table.
func (m *EACLTable) SetRecords(v []*EACLRecord) {
m.Records = v
}
// SetOperation sets operation of the eACL record.
func (m *EACLRecord) SetOperation(v Operation) {
m.Operation = v
}
// SetAction sets action of the eACL record.
func (m *EACLRecord) SetAction(v Action) {
m.Action = v
}
// SetFilters sets filter list of the eACL record.
func (m *EACLRecord) SetFilters(v []*EACLRecord_Filter) {
m.Filters = v
}
// SetTargets sets target list of the eACL record.
func (m *EACLRecord) SetTargets(v []*EACLRecord_Target) {
m.Targets = v
}
// SetHeader sets header type of the eACL filter.
func (m *EACLRecord_Filter) SetHeader(v HeaderType) {
m.HeaderType = v
}
// SetMatchType sets match type of the eACL filter.
func (m *EACLRecord_Filter) SetMatchType(v MatchType) {
m.MatchType = v
}
// SetKey sets key of the eACL filter.
func (m *EACLRecord_Filter) SetKey(v string) {
m.Key = v
}
// SetValue sets value of the eACL filter.
func (m *EACLRecord_Filter) SetValue(v string) {
m.Value = v
}
// SetRole sets target group of the eACL target.
func (m *EACLRecord_Target) SetRole(v Role) {
m.Role = v
}
// SetKeys of the eACL target.
func (m *EACLRecord_Target) SetKeys(v [][]byte) {
m.Keys = v
}
// SetEaclTable sets eACL table of the bearer token.
func (m *BearerToken_Body) SetEaclTable(v *EACLTable) {
m.EaclTable = v
}
// SetOwnerId sets identifier of the bearer token owner.
func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetLifetime sets lifetime of the bearer token.
func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) {
m.Lifetime = v
}
// SetImpersonate allows impersonate.
func (m *BearerToken_Body) SetImpersonate(v bool) {
m.AllowImpersonate = v
}
// SetBody sets bearer token body.
func (m *BearerToken) SetBody(v *BearerToken_Body) {
m.Body = v
}
// SetSignature sets bearer token signature.
func (m *BearerToken) SetSignature(v *refs.Signature) {
m.Signature = v
}
// SetExp sets epoch number of the token expiration.
func (m *BearerToken_Body_TokenLifetime) SetExp(v uint64) {
m.Exp = v
}
// SetNbf sets starting epoch number of the token.
func (m *BearerToken_Body_TokenLifetime) SetNbf(v uint64) {
m.Nbf = v
}
// SetIat sets the number of the epoch in which the token was issued.
func (m *BearerToken_Body_TokenLifetime) SetIat(v uint64) {
m.Iat = v
}
// FromString parses Action from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Action) FromString(s string) bool {
i, ok := Action_value[s]
if ok {
*x = Action(i)
}
return ok
}
// FromString parses Role from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Role) FromString(s string) bool {
i, ok := Role_value[s]
if ok {
*x = Role(i)
}
return ok
}
// FromString parses Operation from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
i, ok := Operation_value[s]
if ok {
*x = Operation(i)
}
return ok
}
// FromString parses MatchType from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *MatchType) FromString(s string) bool {
i, ok := MatchType_value[s]
if ok {
*x = MatchType(i)
}
return ok
}
// FromString parses HeaderType from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *HeaderType) FromString(s string) bool {
i, ok := HeaderType_value[s]
if ok {
*x = HeaderType(i)
}
return ok
}

BIN
acl/grpc/types.pb.go generated

Binary file not shown.

BIN
acl/grpc/types_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,64 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package acl
func DoFuzzProtoEACLRecord(data []byte) int {
msg := new(EACLRecord)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONEACLRecord(data []byte) int {
msg := new(EACLRecord)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoEACLTable(data []byte) int {
msg := new(EACLTable)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONEACLTable(data []byte) int {
msg := new(EACLTable)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoBearerToken(data []byte) int {
msg := new(BearerToken)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONBearerToken(data []byte) int {
msg := new(BearerToken)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,41 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package acl
import (
testing "testing"
)
func FuzzProtoEACLRecord(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoEACLRecord(data)
})
}
func FuzzJSONEACLRecord(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONEACLRecord(data)
})
}
func FuzzProtoEACLTable(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoEACLTable(data)
})
}
func FuzzJSONEACLTable(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONEACLTable(data)
})
}
func FuzzProtoBearerToken(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoBearerToken(data)
})
}
func FuzzJSONBearerToken(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONBearerToken(data)
})
}

View file

@ -21,6 +21,14 @@ func (t *Target) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(t, data, new(acl.EACLRecord_Target))
}
func (a *APEOverride) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(a)
}
func (a *APEOverride) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(a, data, new(acl.BearerToken_Body_APEOverride))
}
func (r *Record) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(r)
}

View file

@ -28,10 +28,14 @@ const (
lifetimeNotValidBeforeField = 2
lifetimeIssuedAtField = 3
bearerTokenBodyACLField = 1
bearerTokenBodyOwnerField = 2
bearerTokenBodyLifetimeField = 3
bearerTokenBodyImpersonate = 4
tokenAPEChainsTargetField = 1
tokenAPEChainsChainsField = 2
bearerTokenBodyACLField = 1
bearerTokenBodyOwnerField = 2
bearerTokenBodyLifetimeField = 3
bearerTokenBodyImpersonate = 4
bearerTokenTokenAPEChainsField = 5
bearerTokenBodyField = 1
bearerTokenSignatureField = 2
@ -239,6 +243,42 @@ func (l *TokenLifetime) Unmarshal(data []byte) error {
return message.Unmarshal(l, data, new(acl.BearerToken_Body_TokenLifetime))
}
func (c *APEOverride) StableMarshal(buf []byte) []byte {
if c == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, c.StableSize())
}
var offset int
offset += protoutil.NestedStructureMarshal(tokenAPEChainsTargetField, buf[offset:], c.target)
for i := range c.chains {
offset += protoutil.NestedStructureMarshal(tokenAPEChainsChainsField, buf[offset:], c.chains[i])
}
return buf
}
func (c *APEOverride) StableSize() (size int) {
if c == nil {
return 0
}
size += protoutil.NestedStructureSize(tokenAPEChainsTargetField, c.target)
for i := range c.chains {
size += protoutil.NestedStructureSize(tokenAPEChainsChainsField, c.chains[i])
}
return size
}
func (c *APEOverride) Unmarshal(data []byte) error {
return message.Unmarshal(c, data, new(acl.BearerToken_Body_APEOverride))
}
func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte {
if bt == nil {
return []byte{}
@ -253,7 +293,8 @@ func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte {
offset += protoutil.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl)
offset += protoutil.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID)
offset += protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime)
protoutil.BoolMarshal(bearerTokenBodyImpersonate, buf[offset:], bt.impersonate)
offset += protoutil.BoolMarshal(bearerTokenBodyImpersonate, buf[offset:], bt.impersonate)
protoutil.NestedStructureMarshal(bearerTokenTokenAPEChainsField, buf[offset:], bt.apeOverride)
return buf
}
@ -267,6 +308,7 @@ func (bt *BearerTokenBody) StableSize() (size int) {
size += protoutil.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID)
size += protoutil.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime)
size += protoutil.BoolSize(bearerTokenBodyImpersonate, bt.impersonate)
size += protoutil.NestedStructureSize(bearerTokenTokenAPEChainsField, bt.apeOverride)
return size
}

View file

@ -2,6 +2,7 @@ package acltest
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test"
accountingtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
)
@ -22,8 +23,20 @@ func GenerateBearerTokenBody(empty bool) *acl.BearerTokenBody {
if !empty {
m.SetOwnerID(accountingtest.GenerateOwnerID(false))
m.SetEACL(GenerateTable(false))
m.SetLifetime(GenerateTokenLifetime(false))
m.SetAPEOverride(GenerateAPEOverride(empty))
}
return m
}
func GenerateAPEOverride(empty bool) *acl.APEOverride {
var m *acl.APEOverride
if !empty {
m = new(acl.APEOverride)
m.SetTarget(apetest.GenerateChainTarget(empty))
m.SetChains(apetest.GenerateRawChains(false, 3))
}
return m

View file

@ -1,6 +1,9 @@
package acl
import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
)
// HeaderFilter is a unified structure of FilterInfo
// message from proto definition.
@ -46,6 +49,12 @@ type TokenLifetime struct {
exp, nbf, iat uint64
}
type APEOverride struct {
target *ape.ChainTarget
chains []*ape.Chain
}
type BearerTokenBody struct {
eacl *Table
@ -53,6 +62,8 @@ type BearerTokenBody struct {
lifetime *TokenLifetime
apeOverride *APEOverride
impersonate bool
}
@ -318,6 +329,34 @@ func (bt *BearerTokenBody) SetEACL(v *Table) {
bt.eacl = v
}
func (t *APEOverride) GetTarget() *ape.ChainTarget {
return t.target
}
func (t *APEOverride) GetChains() []*ape.Chain {
return t.chains
}
func (t *APEOverride) SetTarget(v *ape.ChainTarget) {
t.target = v
}
func (t *APEOverride) SetChains(v []*ape.Chain) {
t.chains = v
}
func (bt *BearerTokenBody) GetAPEOverride() *APEOverride {
if bt != nil {
return bt.apeOverride
}
return nil
}
func (bt *BearerTokenBody) SetAPEOverride(v *APEOverride) {
bt.apeOverride = v
}
func (bt *BearerTokenBody) GetOwnerID() *refs.OwnerID {
if bt != nil {
return bt.ownerID

132
ape/convert.go Normal file
View file

@ -0,0 +1,132 @@
package ape
import (
"fmt"
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
)
func TargetTypeToGRPCField(typ TargetType) ape.TargetType {
switch typ {
case TargetTypeNamespace:
return ape.TargetType_NAMESPACE
case TargetTypeContainer:
return ape.TargetType_CONTAINER
case TargetTypeUser:
return ape.TargetType_USER
case TargetTypeGroup:
return ape.TargetType_GROUP
default:
return ape.TargetType_UNDEFINED
}
}
func TargetTypeFromGRPCField(typ ape.TargetType) TargetType {
switch typ {
case ape.TargetType_NAMESPACE:
return TargetTypeNamespace
case ape.TargetType_CONTAINER:
return TargetTypeContainer
case ape.TargetType_USER:
return TargetTypeUser
case ape.TargetType_GROUP:
return TargetTypeGroup
default:
return TargetTypeUndefined
}
}
func TargetTypeToGRPC(typ TargetType) ape.TargetType {
return ape.TargetType(typ)
}
func TargetTypeFromGRPC(typ ape.TargetType) TargetType {
return TargetType(typ)
}
func (v2 *ChainTarget) ToGRPCMessage() grpc.Message {
var mgrpc *ape.ChainTarget
if v2 != nil {
mgrpc = new(ape.ChainTarget)
mgrpc.SetType(TargetTypeToGRPC(v2.GetTargetType()))
mgrpc.SetName(v2.GetName())
}
return mgrpc
}
func (v2 *ChainTarget) FromGRPCMessage(m grpc.Message) error {
mgrpc, ok := m.(*ape.ChainTarget)
if !ok {
return message.NewUnexpectedMessageType(m, mgrpc)
}
v2.SetTargetType(TargetTypeFromGRPC(mgrpc.GetType()))
v2.SetName(mgrpc.GetName())
return nil
}
func (v2 *ChainRaw) ToGRPCMessage() grpc.Message {
var mgrpc *ape.Chain_Raw
if v2 != nil {
mgrpc = new(ape.Chain_Raw)
mgrpc.SetRaw(v2.GetRaw())
}
return mgrpc
}
func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error {
mgrpc, ok := m.(*ape.Chain_Raw)
if !ok {
return message.NewUnexpectedMessageType(m, mgrpc)
}
v2.SetRaw(mgrpc.GetRaw())
return nil
}
func (v2 *Chain) ToGRPCMessage() grpc.Message {
var mgrpc *ape.Chain
if v2 != nil {
mgrpc = new(ape.Chain)
switch chainKind := v2.GetKind().(type) {
default:
panic(fmt.Sprintf("unsupported chain kind: %T", chainKind))
case *ChainRaw:
mgrpc.SetKind(chainKind.ToGRPCMessage().(*ape.Chain_Raw))
}
}
return mgrpc
}
func (v2 *Chain) FromGRPCMessage(m grpc.Message) error {
mgrpc, ok := m.(*ape.Chain)
if !ok {
return message.NewUnexpectedMessageType(m, mgrpc)
}
switch chainKind := mgrpc.GetKind().(type) {
default:
return fmt.Errorf("unsupported chain kind: %T", chainKind)
case *ape.Chain_Raw:
chainRaw := new(ChainRaw)
if err := chainRaw.FromGRPCMessage(chainKind); err != nil {
return err
}
v2.SetKind(chainRaw)
}
return nil
}

BIN
ape/grpc/types_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,45 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package ape
func DoFuzzProtoChainTarget(data []byte) int {
msg := new(ChainTarget)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONChainTarget(data []byte) int {
msg := new(ChainTarget)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoChain(data []byte) int {
msg := new(Chain)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONChain(data []byte) int {
msg := new(Chain)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,31 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package ape
import (
testing "testing"
)
func FuzzProtoChainTarget(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoChainTarget(data)
})
}
func FuzzJSONChainTarget(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONChainTarget(data)
})
}
func FuzzProtoChain(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoChain(data)
})
}
func FuzzJSONChain(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONChain(data)
})
}

14
ape/json.go Normal file
View file

@ -0,0 +1,14 @@
package ape
import (
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
)
func (t *ChainTarget) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(t)
}
func (t *ChainTarget) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(t, data, new(ape.ChainTarget))
}

92
ape/marshal.go Normal file
View file

@ -0,0 +1,92 @@
package ape
import (
"fmt"
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
)
const (
chainTargetTargetTypeField = 1
chainTargetNameField = 2
chainRawField = 1
)
func (t *ChainTarget) StableSize() (size int) {
if t == nil {
return 0
}
size += proto.EnumSize(chainTargetTargetTypeField, int32(t.targeType))
size += proto.StringSize(chainTargetNameField, t.name)
return size
}
func (t *ChainTarget) StableMarshal(buf []byte) []byte {
if t == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, t.StableSize())
}
var offset int
offset += proto.EnumMarshal(chainTargetTargetTypeField, buf[offset:], int32(t.targeType))
proto.StringMarshal(chainTargetNameField, buf[offset:], t.name)
return buf
}
func (t *ChainTarget) Unmarshal(data []byte) error {
return message.Unmarshal(t, data, new(ape.ChainTarget))
}
func (c *Chain) StableSize() (size int) {
if c == nil {
return 0
}
switch v := c.GetKind().(type) {
case *ChainRaw:
if v != nil {
size += proto.BytesSize(chainRawField, v.GetRaw())
}
default:
panic(fmt.Sprintf("unsupported chain kind: %T", v))
}
return size
}
func (c *Chain) StableMarshal(buf []byte) []byte {
if c == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, c.StableSize())
}
var offset int
switch v := c.GetKind().(type) {
case *ChainRaw:
if v != nil {
proto.BytesMarshal(chainRawField, buf[offset:], v.GetRaw())
}
default:
panic(fmt.Sprintf("unsupported chain kind: %T", v))
}
return buf
}
func (c *Chain) Unmarshal(data []byte) error {
return message.Unmarshal(c, data, new(ape.Chain))
}

View file

@ -1,15 +1,15 @@
package audit_test
package ape_test
import (
"testing"
audittest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/test"
apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test"
)
func TestMessageConvert(t *testing.T) {
messagetest.TestRPCMessage(t,
func(empty bool) message.Message { return audittest.GenerateDataAuditResult(empty) },
func(empty bool) message.Message { return apetest.GenerateChainTarget(empty) },
)
}

18
ape/string.go Normal file
View file

@ -0,0 +1,18 @@
package ape
import (
apegrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
)
func (tt TargetType) String() string {
return TargetTypeToGRPCField(tt).String()
}
func (tt *TargetType) FromString(s string) bool {
i, ok := apegrpc.TargetType_value[s]
if ok {
*tt = TargetType(i)
}
return ok
}

71
ape/test/generate.go Normal file
View file

@ -0,0 +1,71 @@
package test
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
)
func GenerateRawChains(empty bool, n int) []*ape.Chain {
if empty {
return []*ape.Chain{}
}
res := make([]*ape.Chain, n)
for i := range res {
res[i] = GenerateRawChain(empty)
}
return res
}
func GenerateRawChain(empty bool) *ape.Chain {
chRaw := new(ape.ChainRaw)
if empty {
chRaw.SetRaw([]byte("{}"))
} else {
chRaw.SetRaw([]byte(`{
"ID": "",
"Rules": [
{
"Status": "Allow",
"Actions": {
"Inverted": false,
"Names": [
"GetObject"
]
},
"Resources": {
"Inverted": false,
"Names": [
"native:object/*"
]
},
"Any": false,
"Condition": [
{
"Op": "StringEquals",
"Object": "Resource",
"Key": "Department",
"Value": "HR"
}
]
}
],
"MatchType": "DenyPriority"
}`))
}
ch := new(ape.Chain)
ch.SetKind(chRaw)
return ch
}
func GenerateChainTarget(empty bool) *ape.ChainTarget {
m := new(ape.ChainTarget)
if !empty {
m.SetTargetType(ape.TargetTypeContainer)
m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R")
}
return m
}

71
ape/types.go Normal file
View file

@ -0,0 +1,71 @@
package ape
type TargetType uint32
const (
TargetTypeUndefined TargetType = iota
TargetTypeNamespace
TargetTypeContainer
TargetTypeUser
TargetTypeGroup
)
type ChainTarget struct {
targeType TargetType
name string
}
func (ct *ChainTarget) SetTargetType(targeType TargetType) {
ct.targeType = targeType
}
func (ct *ChainTarget) SetName(name string) {
ct.name = name
}
func (ct *ChainTarget) GetTargetType() TargetType {
if ct != nil {
return ct.targeType
}
return 0
}
func (ct *ChainTarget) GetName() string {
if ct != nil {
return ct.name
}
return ""
}
type chainKind interface {
isChainKind()
}
type Chain struct {
kind chainKind
}
func (c *Chain) SetKind(kind chainKind) {
c.kind = kind
}
func (c *Chain) GetKind() chainKind {
return c.kind
}
type ChainRaw struct {
Raw []byte
}
func (*ChainRaw) isChainKind() {}
func (c *ChainRaw) SetRaw(raw []byte) {
c.Raw = raw
}
func (c *ChainRaw) GetRaw() []byte {
return c.Raw
}

358
apemanager/convert.go Normal file
View file

@ -0,0 +1,358 @@
package apemanager
import (
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
apeGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
)
func (reqBody *AddChainRequestBody) ToGRPCMessage() grpc.Message {
var reqBodygrpc *apemanager.AddChainRequest_Body
if reqBody != nil {
reqBodygrpc = new(apemanager.AddChainRequest_Body)
reqBodygrpc.SetTarget(reqBody.GetTarget().ToGRPCMessage().(*apeGRPC.ChainTarget))
reqBodygrpc.SetChain(reqBody.GetChain().ToGRPCMessage().(*apeGRPC.Chain))
}
return reqBodygrpc
}
func (reqBody *AddChainRequestBody) FromGRPCMessage(m grpc.Message) error {
reqBodygrpc, ok := m.(*apemanager.AddChainRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, reqBodygrpc)
}
if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil {
reqBody.target = new(ape.ChainTarget)
if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil {
return err
}
}
if chaingrpc := reqBodygrpc.GetChain(); chaingrpc != nil {
reqBody.chain = new(ape.Chain)
if err := reqBody.GetChain().FromGRPCMessage(chaingrpc); err != nil {
return err
}
}
return nil
}
func (req *AddChainRequest) ToGRPCMessage() grpc.Message {
var reqgrpc *apemanager.AddChainRequest
if req != nil {
reqgrpc = new(apemanager.AddChainRequest)
reqgrpc.SetBody(req.GetBody().ToGRPCMessage().(*apemanager.AddChainRequest_Body))
req.RequestHeaders.ToMessage(reqgrpc)
}
return reqgrpc
}
func (req *AddChainRequest) FromGRPCMessage(m grpc.Message) error {
reqgrpc, ok := m.(*apemanager.AddChainRequest)
if !ok {
return message.NewUnexpectedMessageType(m, reqgrpc)
}
if reqBodygrpc := reqgrpc.GetBody(); reqBodygrpc != nil {
req.body = new(AddChainRequestBody)
if err := req.body.FromGRPCMessage(reqBodygrpc); err != nil {
return err
}
}
return req.RequestHeaders.FromMessage(reqgrpc)
}
func (respBody *AddChainResponseBody) ToGRPCMessage() grpc.Message {
var respBodygrpc *apemanager.AddChainResponse_Body
if respBody != nil {
respBodygrpc = new(apemanager.AddChainResponse_Body)
respBodygrpc.SetChainId(respBody.GetChainID())
}
return respBodygrpc
}
func (respBody *AddChainResponseBody) FromGRPCMessage(m grpc.Message) error {
respBodygrpc, ok := m.(*apemanager.AddChainResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, respBodygrpc)
}
respBody.SetChainID(respBodygrpc.GetChainId())
return nil
}
func (resp *AddChainResponse) ToGRPCMessage() grpc.Message {
var respgrpc *apemanager.AddChainResponse
if resp != nil {
respgrpc = new(apemanager.AddChainResponse)
respgrpc.SetBody(resp.body.ToGRPCMessage().(*apemanager.AddChainResponse_Body))
resp.ResponseHeaders.ToMessage(respgrpc)
}
return respgrpc
}
func (resp *AddChainResponse) FromGRPCMessage(m grpc.Message) error {
respgrpc, ok := m.(*apemanager.AddChainResponse)
if !ok {
return message.NewUnexpectedMessageType(m, respgrpc)
}
if respBodygrpc := respgrpc.GetBody(); respBodygrpc != nil {
resp.body = new(AddChainResponseBody)
if err := resp.body.FromGRPCMessage(respBodygrpc); err != nil {
return err
}
}
return resp.ResponseHeaders.FromMessage(respgrpc)
}
func (reqBody *RemoveChainRequestBody) ToGRPCMessage() grpc.Message {
var reqBodygrpc *apemanager.RemoveChainRequest_Body
if reqBody != nil {
reqBodygrpc = new(apemanager.RemoveChainRequest_Body)
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
reqBodygrpc.SetChainId(reqBody.GetChainID())
}
return reqBodygrpc
}
func (reqBody *RemoveChainRequestBody) FromGRPCMessage(m grpc.Message) error {
reqBodygrpc, ok := m.(*apemanager.RemoveChainRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, reqBodygrpc)
}
if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil {
reqBody.target = new(ape.ChainTarget)
if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil {
return err
}
}
reqBody.SetChainID(reqBodygrpc.GetChainId())
return nil
}
func (req *RemoveChainRequest) ToGRPCMessage() grpc.Message {
var reqgrpc *apemanager.RemoveChainRequest
if req != nil {
reqgrpc = new(apemanager.RemoveChainRequest)
reqgrpc.SetBody(req.body.ToGRPCMessage().(*apemanager.RemoveChainRequest_Body))
req.RequestHeaders.ToMessage(reqgrpc)
}
return reqgrpc
}
func (req *RemoveChainRequest) FromGRPCMessage(m grpc.Message) error {
reqgrpc, ok := m.(*apemanager.RemoveChainRequest)
if !ok {
return message.NewUnexpectedMessageType(m, reqgrpc)
}
if reqBodygrpc := reqgrpc.GetBody(); reqBodygrpc != nil {
req.body = new(RemoveChainRequestBody)
if err := req.body.FromGRPCMessage(reqBodygrpc); err != nil {
return err
}
}
return req.RequestHeaders.FromMessage(reqgrpc)
}
func (respBody *RemoveChainResponseBody) ToGRPCMessage() grpc.Message {
var respBodygrpc *apemanager.RemoveChainResponse_Body
if respBody != nil {
respBodygrpc = new(apemanager.RemoveChainResponse_Body)
}
return respBodygrpc
}
func (respBody *RemoveChainResponseBody) FromGRPCMessage(m grpc.Message) error {
respBodygrpc, ok := m.(*apemanager.RemoveChainResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, respBodygrpc)
}
return nil
}
func (resp *RemoveChainResponse) ToGRPCMessage() grpc.Message {
var respgrpc *apemanager.RemoveChainResponse
if resp != nil {
respgrpc = new(apemanager.RemoveChainResponse)
respgrpc.SetBody(resp.body.ToGRPCMessage().(*apemanager.RemoveChainResponse_Body))
resp.ResponseHeaders.ToMessage(respgrpc)
}
return respgrpc
}
func (resp *RemoveChainResponse) FromGRPCMessage(m grpc.Message) error {
respgrpc, ok := m.(*apemanager.RemoveChainResponse)
if !ok {
return message.NewUnexpectedMessageType(m, respgrpc)
}
if respBodygrpc := respgrpc.GetBody(); respBodygrpc != nil {
resp.body = new(RemoveChainResponseBody)
if err := resp.body.FromGRPCMessage(respBodygrpc); err != nil {
return err
}
}
return resp.ResponseHeaders.FromMessage(respgrpc)
}
func (reqBody *ListChainsRequestBody) ToGRPCMessage() grpc.Message {
var reqBodygrpc *apemanager.ListChainsRequest_Body
if reqBody != nil {
reqBodygrpc = new(apemanager.ListChainsRequest_Body)
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
}
return reqBodygrpc
}
func (reqBody *ListChainsRequestBody) FromGRPCMessage(m grpc.Message) error {
reqBodygrpc, ok := m.(*apemanager.ListChainsRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, reqBodygrpc)
}
if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil {
reqBody.target = new(ape.ChainTarget)
if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil {
return err
}
}
return nil
}
func (req *ListChainsRequest) ToGRPCMessage() grpc.Message {
var reqgrpc *apemanager.ListChainsRequest
if req != nil {
reqgrpc = new(apemanager.ListChainsRequest)
reqgrpc.SetBody(req.body.ToGRPCMessage().(*apemanager.ListChainsRequest_Body))
req.RequestHeaders.ToMessage(reqgrpc)
}
return reqgrpc
}
func (req *ListChainsRequest) FromGRPCMessage(m grpc.Message) error {
reqgrpc, ok := m.(*apemanager.ListChainsRequest)
if !ok {
return message.NewUnexpectedMessageType(m, reqgrpc)
}
if reqBodygrpc := reqgrpc.GetBody(); reqBodygrpc != nil {
req.body = new(ListChainsRequestBody)
if err := req.body.FromGRPCMessage(reqBodygrpc); err != nil {
return err
}
}
return req.RequestHeaders.FromMessage(reqgrpc)
}
func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message {
var respBodygrpc *apemanager.ListChainsResponse_Body
if respBody != nil {
respBodygrpc = new(apemanager.ListChainsResponse_Body)
chainsgrpc := make([]apeGRPC.Chain, 0, len(respBody.GetChains()))
for _, chain := range respBody.GetChains() {
chainsgrpc = append(chainsgrpc, *chain.ToGRPCMessage().(*apeGRPC.Chain))
}
respBodygrpc.SetChains(chainsgrpc)
}
return respBodygrpc
}
func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error {
respBodygrpc, ok := m.(*apemanager.ListChainsResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, respBodygrpc)
}
chains := make([]*ape.Chain, 0, len(respBodygrpc.GetChains()))
for _, chaingrpc := range respBodygrpc.GetChains() {
chain := new(ape.Chain)
if err := chain.FromGRPCMessage(&chaingrpc); err != nil {
return err
}
chains = append(chains, chain)
}
respBody.SetChains(chains)
return nil
}
func (resp *ListChainsResponse) ToGRPCMessage() grpc.Message {
var respgrpc *apemanager.ListChainsResponse
if resp != nil {
respgrpc = new(apemanager.ListChainsResponse)
respgrpc.SetBody(resp.body.ToGRPCMessage().(*apemanager.ListChainsResponse_Body))
resp.ResponseHeaders.ToMessage(respgrpc)
}
return respgrpc
}
func (resp *ListChainsResponse) FromGRPCMessage(m grpc.Message) error {
respgrpc, ok := m.(*apemanager.ListChainsResponse)
if !ok {
return message.NewUnexpectedMessageType(m, respgrpc)
}
if respBodygrpc := respgrpc.GetBody(); respBodygrpc != nil {
resp.body = new(ListChainsResponseBody)
if err := resp.body.FromGRPCMessage(respBodygrpc); err != nil {
return err
}
}
return resp.ResponseHeaders.FromMessage(respgrpc)
}

BIN
apemanager/grpc/service_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,121 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package apemanager
func DoFuzzProtoAddChainRequest(data []byte) int {
msg := new(AddChainRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONAddChainRequest(data []byte) int {
msg := new(AddChainRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoAddChainResponse(data []byte) int {
msg := new(AddChainResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONAddChainResponse(data []byte) int {
msg := new(AddChainResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoRemoveChainRequest(data []byte) int {
msg := new(RemoveChainRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONRemoveChainRequest(data []byte) int {
msg := new(RemoveChainRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoRemoveChainResponse(data []byte) int {
msg := new(RemoveChainResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONRemoveChainResponse(data []byte) int {
msg := new(RemoveChainResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListChainsRequest(data []byte) int {
msg := new(ListChainsRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListChainsRequest(data []byte) int {
msg := new(ListChainsRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListChainsResponse(data []byte) int {
msg := new(ListChainsResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListChainsResponse(data []byte) int {
msg := new(ListChainsResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,71 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package apemanager
import (
testing "testing"
)
func FuzzProtoAddChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoAddChainRequest(data)
})
}
func FuzzJSONAddChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONAddChainRequest(data)
})
}
func FuzzProtoAddChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoAddChainResponse(data)
})
}
func FuzzJSONAddChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONAddChainResponse(data)
})
}
func FuzzProtoRemoveChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoRemoveChainRequest(data)
})
}
func FuzzJSONRemoveChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONRemoveChainRequest(data)
})
}
func FuzzProtoRemoveChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoRemoveChainResponse(data)
})
}
func FuzzJSONRemoveChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONRemoveChainResponse(data)
})
}
func FuzzProtoListChainsRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListChainsRequest(data)
})
}
func FuzzJSONListChainsRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListChainsRequest(data)
})
}
func FuzzProtoListChainsResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListChainsResponse(data)
})
}
func FuzzJSONListChainsResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListChainsResponse(data)
})
}

BIN
apemanager/grpc/service_grpc.pb.go generated Normal file

Binary file not shown.

205
apemanager/marshal.go Normal file
View file

@ -0,0 +1,205 @@
package apemanager
import (
apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
)
const (
addChainReqBodyTargetField = 1
addChainReqBodyChainField = 2
addChainRespBodyChainIDField = 1
removeChainReqBodyTargetField = 1
removeChainReqBodyChainField = 2
/*
Fields for RemoveResponseBody are missed since RemoveResponseBody is empty.
*/
listChainsReqBodyTargetField = 1
listChainsRespBodyChainsField = 1
)
func (rb *AddChainRequestBody) StableSize() (size int) {
if rb == nil {
return 0
}
size += proto.NestedStructureSize(addChainReqBodyTargetField, rb.target)
size += proto.NestedStructureSize(addChainReqBodyChainField, rb.chain)
return size
}
func (rb *AddChainRequestBody) StableMarshal(buf []byte) []byte {
if rb == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, rb.StableSize())
}
var offset int
offset += proto.NestedStructureMarshal(addChainReqBodyTargetField, buf[offset:], rb.target)
proto.NestedStructureMarshal(addChainReqBodyChainField, buf[offset:], rb.chain)
return buf
}
func (rb *AddChainRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(rb, data, new(apemanager.AddChainRequest_Body))
}
func (rb *AddChainResponseBody) StableSize() (size int) {
if rb == nil {
return 0
}
size += proto.BytesSize(addChainRespBodyChainIDField, rb.chainID)
return size
}
func (rb *AddChainResponseBody) StableMarshal(buf []byte) []byte {
if rb == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, rb.StableSize())
}
var offset int
proto.BytesMarshal(addChainRespBodyChainIDField, buf[offset:], rb.chainID)
return buf
}
func (rb *AddChainResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(rb, data, new(apemanager.AddChainResponse_Body))
}
func (rb *RemoveChainRequestBody) StableSize() (size int) {
if rb == nil {
return 0
}
size += proto.NestedStructureSize(addChainReqBodyTargetField, rb.target)
size += proto.BytesSize(addChainReqBodyChainField, rb.chainID)
return size
}
func (rb *RemoveChainRequestBody) StableMarshal(buf []byte) []byte {
if rb == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, rb.StableSize())
}
var offset int
offset += proto.NestedStructureMarshal(removeChainReqBodyTargetField, buf[offset:], rb.target)
proto.BytesMarshal(removeChainReqBodyChainField, buf[offset:], rb.chainID)
return buf
}
func (rb *RemoveChainRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(rb, data, new(apemanager.RemoveChainRequest_Body))
}
func (rb *RemoveChainResponseBody) StableSize() (size int) {
if rb == nil {
return 0
}
return size
}
func (rb *RemoveChainResponseBody) StableMarshal(buf []byte) []byte {
if rb == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, rb.StableSize())
}
return buf
}
func (rb *RemoveChainResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(rb, data, new(apemanager.RemoveChainResponse_Body))
}
func (rb *ListChainsRequestBody) StableSize() (size int) {
if rb == nil {
return 0
}
size += proto.NestedStructureSize(listChainsReqBodyTargetField, rb.target)
return size
}
func (rb *ListChainsRequestBody) StableMarshal(buf []byte) []byte {
if rb == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, rb.StableSize())
}
var offset int
proto.NestedStructureMarshal(addChainReqBodyTargetField, buf[offset:], rb.target)
return buf
}
func (rb *ListChainsRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(rb, data, new(apemanager.ListChainsRequest_Body))
}
func (rb *ListChainsResponseBody) StableSize() (size int) {
if rb == nil {
return 0
}
for _, chain := range rb.GetChains() {
size += proto.NestedStructureSize(listChainsRespBodyChainsField, chain)
}
return size
}
func (rb *ListChainsResponseBody) StableMarshal(buf []byte) []byte {
if rb == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, rb.StableSize())
}
var offset int
for _, chain := range rb.GetChains() {
offset += proto.NestedStructureMarshal(listChainsRespBodyChainsField, buf[offset:], chain)
}
return buf
}
func (rb *ListChainsResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(rb, data, new(apemanager.ListChainsResponse_Body))
}

View file

@ -0,0 +1,26 @@
package apemanager_test
import (
"testing"
apemanagertest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/test"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test"
)
func TestMessageConvert(t *testing.T) {
messagetest.TestRPCMessage(t,
func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequestBody(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequest(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateAddChainResponseBody(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateAddChainResponse(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainRequestBody(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainRequest(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainResponseBody(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainResponse(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateListChainsRequestBody(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateListChainsRequest(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateListChainsResponseBody(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateListChainsResponse(empty) },
)
}

76
apemanager/status.go Normal file
View file

@ -0,0 +1,76 @@
package apemanager
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status"
statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/grpc"
)
// LocalizeFailStatus checks if passed global status.Code is related to ape manager failure and:
//
// then localizes the code and returns true,
// else leaves the code unchanged and returns false.
//
// Arg must be non-nil.
func LocalizeFailStatus(c *status.Code) bool {
return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_APE_MANAGER))
}
// GlobalizeFail globalizes local code of ape manager failure.
//
// Arg must be non-nil.
func GlobalizeFail(c *status.Code) {
c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_APE_MANAGER))
}
const (
// StatusAPEManagerAccessDenied is a local status.Code value for
// ACCESS_DENIED ape manager failure.
StatusAPEManagerAccessDenied status.Code = iota
)
const (
// detailAccessDeniedDesc is a StatusAccessDenied detail ID for
// human-readable description.
detailAccessDeniedDesc = iota
)
// WriteAccessDeniedDesc writes human-readable description of StatusAccessDenied
// into status.Status as a detail. The status must not be nil.
//
// Existing details are expected to be ID-unique, otherwise undefined behavior.
func WriteAccessDeniedDesc(st *status.Status, desc string) {
var found bool
st.IterateDetails(func(d *status.Detail) bool {
if d.ID() == detailAccessDeniedDesc {
found = true
d.SetValue([]byte(desc))
}
return found
})
if !found {
var d status.Detail
d.SetID(detailAccessDeniedDesc)
d.SetValue([]byte(desc))
st.AppendDetails(d)
}
}
// ReadAccessDeniedDesc looks up for status detail with human-readable description
// of StatusAccessDenied. Returns empty string if detail is missing.
func ReadAccessDeniedDesc(st status.Status) (desc string) {
st.IterateDetails(func(d *status.Detail) bool {
if d.ID() == detailAccessDeniedDesc {
desc = string(d.Value())
return true
}
return false
})
return
}

30
apemanager/status_test.go Normal file
View file

@ -0,0 +1,30 @@
package apemanager_test
import (
"testing"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status"
statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test"
"github.com/stretchr/testify/require"
)
func TestStatusCodes(t *testing.T) {
statustest.TestCodes(t, apemanager.LocalizeFailStatus, apemanager.GlobalizeFail,
apemanager.StatusAPEManagerAccessDenied, 5120,
)
}
func TestAccessDeniedDesc(t *testing.T) {
var st status.Status
require.Empty(t, apemanager.ReadAccessDeniedDesc(st))
const desc = "some description"
apemanager.WriteAccessDeniedDesc(&st, desc)
require.Equal(t, desc, apemanager.ReadAccessDeniedDesc(st))
apemanager.WriteAccessDeniedDesc(&st, desc+"1")
require.Equal(t, desc+"1", apemanager.ReadAccessDeniedDesc(st))
}

143
apemanager/test/generate.go Normal file
View file

@ -0,0 +1,143 @@
package apemanagertest
import (
apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager"
sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test"
)
func generateChainID(empty bool) []byte {
if empty {
return []byte{}
}
return []byte("616c6c6f774f626a476574436e72")
}
func GenerateAddChainRequestBody(empty bool) *apemanager.AddChainRequestBody {
m := new(apemanager.AddChainRequestBody)
if !empty {
m.SetTarget(apetest.GenerateChainTarget(empty))
m.SetChain(apetest.GenerateRawChain(empty))
}
return m
}
func GenerateAddChainRequest(empty bool) *apemanager.AddChainRequest {
m := new(apemanager.AddChainRequest)
if !empty {
m.SetBody(GenerateAddChainRequestBody(empty))
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
}
return m
}
func GenerateAddChainResponseBody(empty bool) *apemanager.AddChainResponseBody {
m := new(apemanager.AddChainResponseBody)
if !empty {
m.SetChainID(generateChainID(empty))
}
return m
}
func GenerateAddChainResponse(empty bool) *apemanager.AddChainResponse {
m := new(apemanager.AddChainResponse)
if !empty {
m.SetBody(GenerateAddChainResponseBody(empty))
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
}
return m
}
func GenerateRemoveChainRequestBody(empty bool) *apemanager.RemoveChainRequestBody {
m := new(apemanager.RemoveChainRequestBody)
if !empty {
m.SetChainID(generateChainID(empty))
m.SetTarget(apetest.GenerateChainTarget(empty))
}
return m
}
func GenerateRemoveChainRequest(empty bool) *apemanager.RemoveChainRequest {
m := new(apemanager.RemoveChainRequest)
if !empty {
m.SetBody(GenerateRemoveChainRequestBody(empty))
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
}
return m
}
func GenerateRemoveChainResponseBody(_ bool) *apemanager.RemoveChainResponseBody {
return new(apemanager.RemoveChainResponseBody)
}
func GenerateRemoveChainResponse(empty bool) *apemanager.RemoveChainResponse {
m := new(apemanager.RemoveChainResponse)
if !empty {
m.SetBody(GenerateRemoveChainResponseBody(empty))
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
}
return m
}
func GenerateListChainsRequestBody(empty bool) *apemanager.ListChainsRequestBody {
m := new(apemanager.ListChainsRequestBody)
if !empty {
m.SetTarget(apetest.GenerateChainTarget(empty))
}
return m
}
func GenerateListChainsRequest(empty bool) *apemanager.ListChainsRequest {
m := new(apemanager.ListChainsRequest)
if !empty {
m.SetBody(GenerateListChainsRequestBody(empty))
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
}
return m
}
func GenerateListChainsResponseBody(empty bool) *apemanager.ListChainsResponseBody {
m := new(apemanager.ListChainsResponseBody)
if !empty {
m.SetChains(apetest.GenerateRawChains(empty, 10))
}
return m
}
func GenerateListChainsResponse(empty bool) *apemanager.ListChainsResponse {
m := new(apemanager.ListChainsResponse)
if !empty {
m.SetBody(GenerateListChainsResponseBody(empty))
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
}
return m
}

174
apemanager/types.go Normal file
View file

@ -0,0 +1,174 @@
package apemanager
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
)
type AddChainRequest struct {
body *AddChainRequestBody
session.RequestHeaders
}
func (r *AddChainRequest) SetBody(body *AddChainRequestBody) {
r.body = body
}
func (r *AddChainRequest) GetBody() *AddChainRequestBody {
return r.body
}
type AddChainRequestBody struct {
target *ape.ChainTarget
chain *ape.Chain
}
func (rb *AddChainRequestBody) SetTarget(target *ape.ChainTarget) {
rb.target = target
}
func (rb *AddChainRequestBody) GetTarget() *ape.ChainTarget {
return rb.target
}
func (rb *AddChainRequestBody) SetChain(chain *ape.Chain) {
rb.chain = chain
}
func (rb *AddChainRequestBody) GetChain() *ape.Chain {
return rb.chain
}
type AddChainResponse struct {
body *AddChainResponseBody
session.ResponseHeaders
}
func (r *AddChainResponse) SetBody(body *AddChainResponseBody) {
r.body = body
}
func (r *AddChainResponse) GetBody() *AddChainResponseBody {
return r.body
}
type AddChainResponseBody struct {
chainID []byte
}
func (rb *AddChainResponseBody) SetChainID(chainID []byte) {
rb.chainID = chainID
}
func (rb *AddChainResponseBody) GetChainID() []byte {
return rb.chainID
}
type RemoveChainRequest struct {
body *RemoveChainRequestBody
session.RequestHeaders
}
func (r *RemoveChainRequest) SetBody(body *RemoveChainRequestBody) {
r.body = body
}
func (r *RemoveChainRequest) GetBody() *RemoveChainRequestBody {
return r.body
}
type RemoveChainRequestBody struct {
target *ape.ChainTarget
chainID []byte
}
func (rb *RemoveChainRequestBody) SetTarget(target *ape.ChainTarget) {
rb.target = target
}
func (rb *RemoveChainRequestBody) GetTarget() *ape.ChainTarget {
return rb.target
}
func (rb *RemoveChainRequestBody) SetChainID(chainID []byte) {
rb.chainID = chainID
}
func (rb *RemoveChainRequestBody) GetChainID() []byte {
return rb.chainID
}
type RemoveChainResponse struct {
body *RemoveChainResponseBody
session.ResponseHeaders
}
type RemoveChainResponseBody struct{}
func (r *RemoveChainResponse) SetBody(body *RemoveChainResponseBody) {
r.body = body
}
func (r *RemoveChainResponse) GetBody() *RemoveChainResponseBody {
return r.body
}
type ListChainsRequest struct {
body *ListChainsRequestBody
session.RequestHeaders
}
func (r *ListChainsRequest) SetBody(body *ListChainsRequestBody) {
r.body = body
}
func (r *ListChainsRequest) GetBody() *ListChainsRequestBody {
return r.body
}
type ListChainsRequestBody struct {
target *ape.ChainTarget
}
func (rb *ListChainsRequestBody) SetTarget(target *ape.ChainTarget) {
rb.target = target
}
func (rb *ListChainsRequestBody) GetTarget() *ape.ChainTarget {
return rb.target
}
type ListChainsResponse struct {
body *ListChainsResponseBody
session.ResponseHeaders
}
func (r *ListChainsResponse) SetBody(body *ListChainsResponseBody) {
r.body = body
}
func (r *ListChainsResponse) GetBody() *ListChainsResponseBody {
return r.body
}
type ListChainsResponseBody struct {
chains []*ape.Chain
session.RequestHeaders
}
func (r *ListChainsResponseBody) SetChains(chains []*ape.Chain) {
r.chains = chains
}
func (r *ListChainsResponseBody) GetChains() []*ape.Chain {
return r.chains
}

View file

@ -1,94 +0,0 @@
package audit
import (
audit "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
)
func (a *DataAuditResult) ToGRPCMessage() grpc.Message {
var m *audit.DataAuditResult
if a != nil {
m = new(audit.DataAuditResult)
m.SetAuditEpoch(a.auditEpoch)
m.SetPublicKey(a.pubKey)
m.SetContainerId(a.cid.ToGRPCMessage().(*refsGRPC.ContainerID))
m.SetComplete(a.complete)
m.SetVersion(a.version.ToGRPCMessage().(*refsGRPC.Version))
m.SetPassNodes(a.passNodes)
m.SetFailNodes(a.failNodes)
m.SetRetries(a.retries)
m.SetRequests(a.requests)
m.SetHit(a.hit)
m.SetMiss(a.miss)
m.SetFail(a.fail)
m.SetPassSg(refs.ObjectIDListToGRPCMessage(a.passSG))
m.SetFailSg(refs.ObjectIDListToGRPCMessage(a.failSG))
}
return m
}
func (a *DataAuditResult) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*audit.DataAuditResult)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
cid := v.GetContainerId()
if cid == nil {
a.cid = nil
} else {
if a.cid == nil {
a.cid = new(refs.ContainerID)
}
err = a.cid.FromGRPCMessage(cid)
if err != nil {
return err
}
}
version := v.GetVersion()
if version == nil {
a.version = nil
} else {
if a.version == nil {
a.version = new(refs.Version)
}
err = a.version.FromGRPCMessage(version)
if err != nil {
return err
}
}
a.passSG, err = refs.ObjectIDListFromGRPCMessage(v.GetPassSg())
if err != nil {
return err
}
a.failSG, err = refs.ObjectIDListFromGRPCMessage(v.GetFailSg())
if err != nil {
return err
}
a.auditEpoch = v.GetAuditEpoch()
a.pubKey = v.GetPublicKey()
a.complete = v.GetComplete()
a.passNodes = v.GetPassNodes()
a.failNodes = v.GetFailNodes()
a.retries = v.GetRetries()
a.requests = v.GetRequests()
a.hit = v.GetHit()
a.miss = v.GetMiss()
a.fail = v.GetFail()
return err
}

View file

@ -1,75 +0,0 @@
package audit
import (
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
)
// SetVersion is a Version field setter.
func (x *DataAuditResult) SetVersion(v *refs.Version) {
x.Version = v
}
// SetAuditEpoch is an AuditEpoch field setter.
func (x *DataAuditResult) SetAuditEpoch(v uint64) {
x.AuditEpoch = v
}
// SetContainerId is a ContainerId field setter.
func (x *DataAuditResult) SetContainerId(v *refs.ContainerID) {
x.ContainerId = v
}
// SetPublicKey is a PublicKey field setter.
func (x *DataAuditResult) SetPublicKey(v []byte) {
x.PublicKey = v
}
// SetComplete is a Complete field setter.
func (x *DataAuditResult) SetComplete(v bool) {
x.Complete = v
}
// SetRequests is a Requests field setter.
func (x *DataAuditResult) SetRequests(v uint32) {
x.Requests = v
}
// SetRetries is a Retries field setter.
func (x *DataAuditResult) SetRetries(v uint32) {
x.Retries = v
}
// SetPassSg is a PassSg field setter.
func (x *DataAuditResult) SetPassSg(v []*refs.ObjectID) {
x.PassSg = v
}
// SetFailSg is a FailSg field setter.
func (x *DataAuditResult) SetFailSg(v []*refs.ObjectID) {
x.FailSg = v
}
// SetHit is a Hit field setter.
func (x *DataAuditResult) SetHit(v uint32) {
x.Hit = v
}
// SetMiss is a Miss field setter.
func (x *DataAuditResult) SetMiss(v uint32) {
x.Miss = v
}
// SetFail is a Fail field setter.
func (x *DataAuditResult) SetFail(v uint32) {
x.Fail = v
}
// SetPassNodes is a PassNodes field setter.
func (x *DataAuditResult) SetPassNodes(v [][]byte) {
x.PassNodes = v
}
// SetFailNodes is a FailNodes field setter.
func (x *DataAuditResult) SetFailNodes(v [][]byte) {
x.FailNodes = v
}

BIN
audit/grpc/types.pb.go generated

Binary file not shown.

View file

@ -1,14 +0,0 @@
package audit
import (
audit "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
)
func (a *DataAuditResult) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(a)
}
func (a *DataAuditResult) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(a, data, new(audit.DataAuditResult))
}

View file

@ -1,88 +0,0 @@
package audit
import (
audit "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
)
const (
_ = iota
versionFNum
auditEpochFNum
cidFNum
pubKeyFNum
completeFNum
requestsFNum
retriesFNum
passSGFNum
failSGFNum
hitFNum
missFNum
failFNum
passNodesFNum
failNodesFNum
)
// StableMarshal marshals unified DataAuditResult structure into a protobuf
// binary format without field order shuffle.
func (a *DataAuditResult) StableMarshal(buf []byte) []byte {
if a == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, a.StableSize())
}
var offset int
offset += proto.NestedStructureMarshal(versionFNum, buf[offset:], a.version)
offset += proto.Fixed64Marshal(auditEpochFNum, buf[offset:], a.auditEpoch)
offset += proto.NestedStructureMarshal(cidFNum, buf[offset:], a.cid)
offset += proto.BytesMarshal(pubKeyFNum, buf[offset:], a.pubKey)
offset += proto.BoolMarshal(completeFNum, buf[offset:], a.complete)
offset += proto.UInt32Marshal(requestsFNum, buf[offset:], a.requests)
offset += proto.UInt32Marshal(retriesFNum, buf[offset:], a.retries)
offset += refs.ObjectIDNestedListMarshal(passSGFNum, buf[offset:], a.passSG)
offset += refs.ObjectIDNestedListMarshal(failSGFNum, buf[offset:], a.failSG)
offset += proto.UInt32Marshal(hitFNum, buf[offset:], a.hit)
offset += proto.UInt32Marshal(missFNum, buf[offset:], a.miss)
offset += proto.UInt32Marshal(failFNum, buf[offset:], a.fail)
offset += proto.RepeatedBytesMarshal(passNodesFNum, buf[offset:], a.passNodes)
proto.RepeatedBytesMarshal(failNodesFNum, buf[offset:], a.failNodes)
return buf
}
// StableSize returns byte length of DataAuditResult structure
// marshaled by StableMarshal function.
func (a *DataAuditResult) StableSize() (size int) {
if a == nil {
return 0
}
size += proto.NestedStructureSize(versionFNum, a.version)
size += proto.Fixed64Size(auditEpochFNum, a.auditEpoch)
size += proto.NestedStructureSize(cidFNum, a.cid)
size += proto.BytesSize(pubKeyFNum, a.pubKey)
size += proto.BoolSize(completeFNum, a.complete)
size += proto.UInt32Size(requestsFNum, a.requests)
size += proto.UInt32Size(retriesFNum, a.retries)
size += refs.ObjectIDNestedListSize(passSGFNum, a.passSG)
size += refs.ObjectIDNestedListSize(failSGFNum, a.failSG)
size += proto.UInt32Size(hitFNum, a.hit)
size += proto.UInt32Size(missFNum, a.miss)
size += proto.UInt32Size(failFNum, a.fail)
size += proto.RepeatedBytesSize(passNodesFNum, a.passNodes)
size += proto.RepeatedBytesSize(failNodesFNum, a.failNodes)
return size
}
// Unmarshal unmarshals DataAuditResult structure from its protobuf
// binary representation.
func (a *DataAuditResult) Unmarshal(data []byte) error {
return message.Unmarshal(a, data, new(audit.DataAuditResult))
}

View file

@ -1,29 +0,0 @@
package audittest
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/audit"
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
)
func GenerateDataAuditResult(empty bool) *audit.DataAuditResult {
m := new(audit.DataAuditResult)
if !empty {
m.SetPublicKey([]byte{1, 2, 3})
m.SetAuditEpoch(13)
m.SetHit(100)
m.SetMiss(200)
m.SetFail(300)
m.SetComplete(true)
m.SetPassNodes([][]byte{{1}, {2}})
m.SetFailNodes([][]byte{{3}, {4}})
m.SetRequests(666)
m.SetRetries(777)
m.SetVersion(refstest.GenerateVersion(false))
m.SetContainerID(refstest.GenerateContainerID(false))
m.SetPassSG(refstest.GenerateObjectIDs(false))
m.SetFailSG(refstest.GenerateObjectIDs(false))
}
return m
}

View file

@ -1,243 +0,0 @@
package audit
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
)
// DataAuditResult is a unified structure of
// DataAuditResult message from proto definition.
type DataAuditResult struct {
version *refs.Version
auditEpoch uint64
requests, retries uint32
hit, miss, fail uint32
cid *refs.ContainerID
pubKey []byte
passSG, failSG []refs.ObjectID
failNodes, passNodes [][]byte
complete bool
}
// GetVersion returns version of Data Audit structure.
func (a *DataAuditResult) GetVersion() *refs.Version {
if a != nil {
return a.version
}
return nil
}
// SetVersion sets version of Data Audit structure.
func (a *DataAuditResult) SetVersion(v *refs.Version) {
a.version = v
}
// GetAuditEpoch returns epoch number when the Data Audit was conducted.
func (a *DataAuditResult) GetAuditEpoch() uint64 {
if a != nil {
return a.auditEpoch
}
return 0
}
// SetAuditEpoch sets epoch number when the Data Audit was conducted.
func (a *DataAuditResult) SetAuditEpoch(v uint64) {
a.auditEpoch = v
}
// GetContainerID returns container under audit.
func (a *DataAuditResult) GetContainerID() *refs.ContainerID {
if a != nil {
return a.cid
}
return nil
}
// SetContainerID sets container under audit.
func (a *DataAuditResult) SetContainerID(v *refs.ContainerID) {
a.cid = v
}
// GetPublicKey returns public key of the auditing InnerRing node in a binary format.
func (a *DataAuditResult) GetPublicKey() []byte {
if a != nil {
return a.pubKey
}
return nil
}
// SetPublicKey sets public key of the auditing InnerRing node in a binary format.
func (a *DataAuditResult) SetPublicKey(v []byte) {
a.pubKey = v
}
// GetPassSG returns list of Storage Groups that passed audit PoR stage.
func (a *DataAuditResult) GetPassSG() []refs.ObjectID {
if a != nil {
return a.passSG
}
return nil
}
// SetPassSG sets list of Storage Groups that passed audit PoR stage.
func (a *DataAuditResult) SetPassSG(v []refs.ObjectID) {
a.passSG = v
}
// GetFailSG returns list of Storage Groups that failed audit PoR stage.
func (a *DataAuditResult) GetFailSG() []refs.ObjectID {
if a != nil {
return a.failSG
}
return nil
}
// SetFailSG sets list of Storage Groups that failed audit PoR stage.
func (a *DataAuditResult) SetFailSG(v []refs.ObjectID) {
a.failSG = v
}
// GetRequests returns number of requests made by PoR audit check to get
// all headers of the objects inside storage groups.
func (a *DataAuditResult) GetRequests() uint32 {
if a != nil {
return a.requests
}
return 0
}
// SetRequests sets number of requests made by PoR audit check to get
// all headers of the objects inside storage groups.
func (a *DataAuditResult) SetRequests(v uint32) {
a.requests = v
}
// GetRetries returns number of retries made by PoR audit check to get
// all headers of the objects inside storage groups.
func (a *DataAuditResult) GetRetries() uint32 {
if a != nil {
return a.retries
}
return 0
}
// SetRetries sets number of retries made by PoR audit check to get
// all headers of the objects inside storage groups.
func (a *DataAuditResult) SetRetries(v uint32) {
a.retries = v
}
// GetHit returns number of sampled objects under audit placed
// in an optimal way according to the containers placement policy
// when checking PoP.
func (a *DataAuditResult) GetHit() uint32 {
if a != nil {
return a.hit
}
return 0
}
// SetHit sets number of sampled objects under audit placed
// in an optimal way according to the containers placement policy
// when checking PoP.
func (a *DataAuditResult) SetHit(v uint32) {
a.hit = v
}
// GetMiss returns number of sampled objects under audit placed
// in suboptimal way according to the containers placement policy,
// but still at a satisfactory level when checking PoP.
func (a *DataAuditResult) GetMiss() uint32 {
if a != nil {
return a.miss
}
return 0
}
// SetMiss sets number of sampled objects under audit placed
// in suboptimal way according to the containers placement policy,
// but still at a satisfactory level when checking PoP.
func (a *DataAuditResult) SetMiss(v uint32) {
a.miss = v
}
// GetFail returns number of sampled objects under audit stored
// in a way not confirming placement policy or not found at all
// when checking PoP.
func (a *DataAuditResult) GetFail() uint32 {
if a != nil {
return a.fail
}
return 0
}
// SetFail sets number of sampled objects under audit stored
// in a way not confirming placement policy or not found at all
// when checking PoP.
func (a *DataAuditResult) SetFail(v uint32) {
a.fail = v
}
// GetPassNodes returns list of storage node public keys that
// passed at least one PDP.
func (a *DataAuditResult) GetPassNodes() [][]byte {
if a != nil {
return a.passNodes
}
return nil
}
// SetPassNodes sets list of storage node public keys that
// passed at least one PDP.
func (a *DataAuditResult) SetPassNodes(v [][]byte) {
a.passNodes = v
}
// GetFailNodes returns list of storage node public keys that
// failed at least one PDP.
func (a *DataAuditResult) GetFailNodes() [][]byte {
if a != nil {
return a.failNodes
}
return nil
}
// SetFailNodes sets list of storage node public keys that
// failed at least one PDP.
func (a *DataAuditResult) SetFailNodes(v [][]byte) {
a.failNodes = v
}
// GetComplete returns boolean completion statement of audit result.
func (a *DataAuditResult) GetComplete() bool {
if a != nil {
return a.complete
}
return false // bool default
}
// SetComplete sets boolean completion statement of audit result.
func (a *DataAuditResult) SetComplete(v bool) {
a.complete = v
}

View file

@ -1,8 +1,6 @@
package container
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
aclGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc"
container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
netmapGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
@ -39,28 +37,26 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil
}
func AttributesToGRPC(xs []Attribute) (res []*container.Container_Attribute) {
func AttributesToGRPC(xs []Attribute) (res []container.Container_Attribute) {
if xs != nil {
res = make([]*container.Container_Attribute, 0, len(xs))
res = make([]container.Container_Attribute, 0, len(xs))
for i := range xs {
res = append(res, xs[i].ToGRPCMessage().(*container.Container_Attribute))
res = append(res, *xs[i].ToGRPCMessage().(*container.Container_Attribute))
}
}
return
}
func AttributesFromGRPC(xs []*container.Container_Attribute) (res []Attribute, err error) {
func AttributesFromGRPC(xs []container.Container_Attribute) (res []Attribute, err error) {
if xs != nil {
res = make([]Attribute, len(xs))
for i := range xs {
if xs[i] != nil {
err = res[i].FromGRPCMessage(xs[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&xs[i])
if err != nil {
return
}
}
}
@ -766,515 +762,3 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error {
return r.ResponseHeaders.FromMessage(v)
}
func (r *SetExtendedACLRequestBody) ToGRPCMessage() grpc.Message {
var m *container.SetExtendedACLRequest_Body
if r != nil {
m = new(container.SetExtendedACLRequest_Body)
m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable))
m.SetSignature(toSignatureRFC6979(r.sig))
}
return m
}
func (r *SetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.SetExtendedACLRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
eacl := v.GetEacl()
if eacl == nil {
r.eacl = nil
} else {
if r.eacl == nil {
r.eacl = new(acl.Table)
}
err = r.eacl.FromGRPCMessage(eacl)
if err != nil {
return err
}
}
sig := v.GetSignature()
if sig == nil {
r.sig = nil
} else {
if r.sig == nil {
r.sig = new(refs.Signature)
}
r.sig.SetKey(sig.GetKey())
r.sig.SetSign(sig.GetSign())
}
return err
}
func (r *SetExtendedACLRequest) ToGRPCMessage() grpc.Message {
var m *container.SetExtendedACLRequest
if r != nil {
m = new(container.SetExtendedACLRequest)
m.SetBody(r.body.ToGRPCMessage().(*container.SetExtendedACLRequest_Body))
r.RequestHeaders.ToMessage(m)
}
return m
}
func (r *SetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.SetExtendedACLRequest)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(SetExtendedACLRequestBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.RequestHeaders.FromMessage(v)
}
func (r *SetExtendedACLResponseBody) ToGRPCMessage() grpc.Message {
var m *container.SetExtendedACLResponse_Body
if r != nil {
m = new(container.SetExtendedACLResponse_Body)
}
return m
}
func (r *SetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.SetExtendedACLResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
return nil
}
func (r *SetExtendedACLResponse) ToGRPCMessage() grpc.Message {
var m *container.SetExtendedACLResponse
if r != nil {
m = new(container.SetExtendedACLResponse)
m.SetBody(r.body.ToGRPCMessage().(*container.SetExtendedACLResponse_Body))
r.ResponseHeaders.ToMessage(m)
}
return m
}
func (r *SetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.SetExtendedACLResponse)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(SetExtendedACLResponseBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.ResponseHeaders.FromMessage(v)
}
func (r *GetExtendedACLRequestBody) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLRequest_Body
if r != nil {
m = new(container.GetExtendedACLRequest_Body)
m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID))
}
return m
}
func (r *GetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
cid := v.GetContainerId()
if cid == nil {
r.cid = nil
} else {
if r.cid == nil {
r.cid = new(refs.ContainerID)
}
err = r.cid.FromGRPCMessage(cid)
}
return err
}
func (r *GetExtendedACLRequest) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLRequest
if r != nil {
m = new(container.GetExtendedACLRequest)
m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLRequest_Body))
r.RequestHeaders.ToMessage(m)
}
return m
}
func (r *GetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLRequest)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(GetExtendedACLRequestBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.RequestHeaders.FromMessage(v)
}
func (r *GetExtendedACLResponseBody) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLResponse_Body
if r != nil {
m = new(container.GetExtendedACLResponse_Body)
m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable))
m.SetSignature(toSignatureRFC6979(r.sig))
m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken))
}
return m
}
func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
eacl := v.GetEacl()
if eacl == nil {
r.eacl = nil
} else {
if r.eacl == nil {
r.eacl = new(acl.Table)
}
err = r.eacl.FromGRPCMessage(eacl)
if err != nil {
return err
}
}
sig := v.GetSignature()
if sig == nil {
r.sig = nil
} else {
if r.sig == nil {
r.sig = new(refs.Signature)
}
r.sig.SetKey(sig.GetKey())
r.sig.SetSign(sig.GetSign())
}
token := v.GetSessionToken()
if token == nil {
r.token = nil
} else {
if r.token == nil {
r.token = new(session.Token)
}
err = r.token.FromGRPCMessage(token)
}
return err
}
func (r *GetExtendedACLResponse) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLResponse
if r != nil {
m = new(container.GetExtendedACLResponse)
m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLResponse_Body))
r.ResponseHeaders.ToMessage(m)
}
return m
}
func (r *GetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLResponse)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(GetExtendedACLResponseBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.ResponseHeaders.FromMessage(v)
}
func (a *UsedSpaceAnnouncement) ToGRPCMessage() grpc.Message {
var m *container.AnnounceUsedSpaceRequest_Body_Announcement
if a != nil {
m = new(container.AnnounceUsedSpaceRequest_Body_Announcement)
m.SetContainerId(a.cid.ToGRPCMessage().(*refsGRPC.ContainerID))
m.SetEpoch(a.epoch)
m.SetUsedSpace(a.usedSpace)
}
return m
}
func (a *UsedSpaceAnnouncement) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.AnnounceUsedSpaceRequest_Body_Announcement)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
cid := v.GetContainerId()
if cid == nil {
a.cid = nil
} else {
if a.cid == nil {
a.cid = new(refs.ContainerID)
}
err = a.cid.FromGRPCMessage(cid)
if err != nil {
return err
}
}
a.epoch = v.GetEpoch()
a.usedSpace = v.GetUsedSpace()
return nil
}
func UsedSpaceAnnouncementsToGRPCMessage(
ids []UsedSpaceAnnouncement,
) (res []*container.AnnounceUsedSpaceRequest_Body_Announcement) {
if ids != nil {
res = make([]*container.AnnounceUsedSpaceRequest_Body_Announcement, 0, len(ids))
for i := range ids {
res = append(res, ids[i].ToGRPCMessage().(*container.AnnounceUsedSpaceRequest_Body_Announcement))
}
}
return
}
func UsedSpaceAnnouncementssFromGRPCMessage(
asV2 []*container.AnnounceUsedSpaceRequest_Body_Announcement,
) (res []UsedSpaceAnnouncement, err error) {
if asV2 != nil {
res = make([]UsedSpaceAnnouncement, len(asV2))
for i := range asV2 {
if asV2[i] != nil {
err = res[i].FromGRPCMessage(asV2[i])
if err != nil {
return
}
}
}
}
return
}
func (r *AnnounceUsedSpaceRequestBody) ToGRPCMessage() grpc.Message {
var m *container.AnnounceUsedSpaceRequest_Body
if r != nil {
m = new(container.AnnounceUsedSpaceRequest_Body)
m.SetAnnouncements(UsedSpaceAnnouncementsToGRPCMessage(r.announcements))
}
return m
}
func (r *AnnounceUsedSpaceRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.AnnounceUsedSpaceRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
r.announcements, err = UsedSpaceAnnouncementssFromGRPCMessage(v.GetAnnouncements())
return err
}
func (r *AnnounceUsedSpaceRequest) ToGRPCMessage() grpc.Message {
var m *container.AnnounceUsedSpaceRequest
if r != nil {
m = new(container.AnnounceUsedSpaceRequest)
m.SetBody(r.body.ToGRPCMessage().(*container.AnnounceUsedSpaceRequest_Body))
r.RequestHeaders.ToMessage(m)
}
return m
}
func (r *AnnounceUsedSpaceRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.AnnounceUsedSpaceRequest)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(AnnounceUsedSpaceRequestBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.RequestHeaders.FromMessage(v)
}
func (r *AnnounceUsedSpaceResponseBody) ToGRPCMessage() grpc.Message {
var m *container.AnnounceUsedSpaceResponse_Body
if r != nil {
m = new(container.AnnounceUsedSpaceResponse_Body)
}
return m
}
func (r *AnnounceUsedSpaceResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.AnnounceUsedSpaceResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
return nil
}
func (r *AnnounceUsedSpaceResponse) ToGRPCMessage() grpc.Message {
var m *container.AnnounceUsedSpaceResponse
if r != nil {
m = new(container.AnnounceUsedSpaceResponse)
m.SetBody(r.body.ToGRPCMessage().(*container.AnnounceUsedSpaceResponse_Body))
r.ResponseHeaders.ToMessage(m)
}
return m
}
func (r *AnnounceUsedSpaceResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.AnnounceUsedSpaceResponse)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(AnnounceUsedSpaceResponseBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.ResponseHeaders.FromMessage(v)
}

View file

@ -1,324 +0,0 @@
package container
import (
acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc"
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
// SetContainer sets container of the request.
func (m *PutRequest_Body) SetContainer(v *Container) {
m.Container = v
}
// SetSignature sets signature of the container structure.
func (m *PutRequest_Body) SetSignature(v *refs.SignatureRFC6979) {
m.Signature = v
}
// SetBody sets body of the request.
func (m *PutRequest) SetBody(v *PutRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerId sets identifier of the container.
func (m *PutResponse_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetBody sets body of the response.
func (m *PutResponse) SetBody(v *PutResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerId sets identifier of the container.
func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetSignature sets signature of the container identifier.
func (m *DeleteRequest_Body) SetSignature(v *refs.SignatureRFC6979) {
m.Signature = v
}
// SetBody sets body of the request.
func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetBody sets body of the response.
func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerId sets identifier of the container.
func (m *GetRequest_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetBody sets body of the request.
func (m *GetRequest) SetBody(v *GetRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetContainer sets the container structure.
func (m *GetResponse_Body) SetContainer(v *Container) {
m.Container = v
}
// SetSessionToken sets token of the session within which requested
// container was created.
func (m *GetResponse_Body) SetSessionToken(v *session.SessionToken) {
m.SessionToken = v
}
// SetSignature sets signature of the container structure.
func (m *GetResponse_Body) SetSignature(v *refs.SignatureRFC6979) {
m.Signature = v
}
// SetBody sets body of the response.
func (m *GetResponse) SetBody(v *GetResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetOwnerId sets identifier of the container owner.
func (m *ListRequest_Body) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetBody sets body of the request.
func (m *ListRequest) SetBody(v *ListRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *ListRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *ListRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerIds sets list of the container identifiers.
func (m *ListResponse_Body) SetContainerIds(v []*refs.ContainerID) {
m.ContainerIds = v
}
// SetBody sets body of the response.
func (m *ListResponse) SetBody(v *ListResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *ListResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *ListResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetEacl sets eACL table structure.
func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) {
m.Eacl = v
}
// SetSignature sets signature of the eACL table structure.
func (m *SetExtendedACLRequest_Body) SetSignature(v *refs.SignatureRFC6979) {
m.Signature = v
}
// SetBody sets body of the request.
func (m *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *SetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *SetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetBody sets body of the response.
func (m *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *SetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *SetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerId sets identifier of the container.
func (m *GetExtendedACLRequest_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetBody sets body of the request.
func (m *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetEacl sets eACL table structure.
func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) {
m.Eacl = v
}
// SetSignature sets signature of the eACL table structure.
func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.SignatureRFC6979) {
m.Signature = v
}
// SetSessionToken sets token of the session within which requested
// eACl table was set.
func (m *GetExtendedACLResponse_Body) SetSessionToken(v *session.SessionToken) {
m.SessionToken = v
}
// SetBody sets body of the response.
func (m *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetEpoch sets epoch of the size estimation.
func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetEpoch(v uint64) {
m.Epoch = v
}
// SetContainerId sets identifier of the container.
func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetUsedSpace sets used space value of the container.
func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetUsedSpace(v uint64) {
m.UsedSpace = v
}
// SetAnnouncements sets list of announcement for shared containers between nodes.
func (m *AnnounceUsedSpaceRequest_Body) SetAnnouncements(v []*AnnounceUsedSpaceRequest_Body_Announcement) {
m.Announcements = v
}
// SetBody sets body of the request.
func (m *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *AnnounceUsedSpaceRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *AnnounceUsedSpaceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetBody sets body of the response.
func (m *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *AnnounceUsedSpaceResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *AnnounceUsedSpaceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}

Binary file not shown.

BIN
container/grpc/service_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,159 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
func DoFuzzProtoPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListRequest(data []byte) int {
msg := new(ListRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListRequest(data []byte) int {
msg := new(ListRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListResponse(data []byte) int {
msg := new(ListResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListResponse(data []byte) int {
msg := new(ListResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,91 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
import (
testing "testing"
)
func FuzzProtoPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutRequest(data)
})
}
func FuzzJSONPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutRequest(data)
})
}
func FuzzProtoPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutResponse(data)
})
}
func FuzzJSONPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutResponse(data)
})
}
func FuzzProtoDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteRequest(data)
})
}
func FuzzJSONDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteRequest(data)
})
}
func FuzzProtoDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteResponse(data)
})
}
func FuzzJSONDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteResponse(data)
})
}
func FuzzProtoGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRequest(data)
})
}
func FuzzJSONGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRequest(data)
})
}
func FuzzProtoGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetResponse(data)
})
}
func FuzzJSONGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetResponse(data)
})
}
func FuzzProtoListRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListRequest(data)
})
}
func FuzzJSONListRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListRequest(data)
})
}
func FuzzProtoListResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListResponse(data)
})
}
func FuzzJSONListResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListResponse(data)
})
}

Binary file not shown.

View file

@ -1,46 +0,0 @@
package container
import (
netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
)
// SetKey sets key to the container attribute.
func (m *Container_Attribute) SetKey(v string) {
m.Key = v
}
// SetValue sets value of the container attribute.
func (m *Container_Attribute) SetValue(v string) {
m.Value = v
}
// SetOwnerId sets identifier of the container owner,
func (m *Container) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetNonce sets nonce of the container structure.
func (m *Container) SetNonce(v []byte) {
m.Nonce = v
}
// SetBasicAcl sets basic ACL of the container.
func (m *Container) SetBasicAcl(v uint32) {
m.BasicAcl = v
}
// SetAttributes sets list of the container attributes.
func (m *Container) SetAttributes(v []*Container_Attribute) {
m.Attributes = v
}
// SetPlacementPolicy sets placement policy of the container.
func (m *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) {
m.PlacementPolicy = v
}
// SetVersion sets version of the container.
func (m *Container) SetVersion(v *refs.Version) {
m.Version = v
}

Binary file not shown.

BIN
container/grpc/types_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,26 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
func DoFuzzProtoContainer(data []byte) int {
msg := new(Container)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONContainer(data []byte) int {
msg := new(Container)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,21 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
import (
testing "testing"
)
func FuzzProtoContainer(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoContainer(data)
})
}
func FuzzJSONContainer(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONContainer(data)
})
}

View file

@ -34,21 +34,6 @@ const (
listReqBodyOwnerField = 1
listRespBodyIDsField = 1
setEACLReqBodyTableField = 1
setEACLReqBodySignatureField = 2
getEACLReqBodyIDField = 1
getEACLRespBodyTableField = 1
getEACLRespBodySignatureField = 2
getEACLRespBodyTokenField = 3
usedSpaceAnnounceEpochField = 1
usedSpaceAnnounceCIDField = 2
usedSpaceAnnounceUsedSpaceField = 3
usedSpaceReqBodyAnnouncementsField = 1
)
func (a *Attribute) StableMarshal(buf []byte) []byte {
@ -358,189 +343,3 @@ func (r *ListResponseBody) StableSize() (size int) {
func (r *ListResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.ListResponse_Body))
}
func (r *SetExtendedACLRequestBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
var offset int
offset += protoutil.NestedStructureMarshal(setEACLReqBodyTableField, buf[offset:], r.eacl)
protoutil.NestedStructureMarshal(setEACLReqBodySignatureField, buf[offset:], r.sig)
return buf
}
func (r *SetExtendedACLRequestBody) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.NestedStructureSize(setEACLReqBodyTableField, r.eacl)
size += protoutil.NestedStructureSize(setEACLReqBodySignatureField, r.sig)
return size
}
func (r *SetExtendedACLRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.SetExtendedACLRequest_Body))
}
func (r *SetExtendedACLResponseBody) StableMarshal(_ []byte) []byte {
return nil
}
func (r *SetExtendedACLResponseBody) StableSize() (size int) {
return 0
}
func (r *SetExtendedACLResponseBody) Unmarshal([]byte) error {
return nil
}
func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
protoutil.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid)
return buf
}
func (r *GetExtendedACLRequestBody) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.NestedStructureSize(getEACLReqBodyIDField, r.cid)
return size
}
func (r *GetExtendedACLRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.GetExtendedACLRequest_Body))
}
func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
var offset int
offset += protoutil.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl)
offset += protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig)
protoutil.NestedStructureMarshal(getEACLRespBodyTokenField, buf[offset:], r.token)
return buf
}
func (r *GetExtendedACLResponseBody) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.NestedStructureSize(getEACLRespBodyTableField, r.eacl)
size += protoutil.NestedStructureSize(getEACLRespBodySignatureField, r.sig)
size += protoutil.NestedStructureSize(getEACLRespBodyTokenField, r.token)
return size
}
func (r *GetExtendedACLResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.GetExtendedACLResponse_Body))
}
func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) []byte {
if a == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, a.StableSize())
}
var offset int
offset += protoutil.UInt64Marshal(usedSpaceAnnounceEpochField, buf[offset:], a.epoch)
offset += protoutil.NestedStructureMarshal(usedSpaceAnnounceCIDField, buf[offset:], a.cid)
protoutil.UInt64Marshal(usedSpaceAnnounceUsedSpaceField, buf[offset:], a.usedSpace)
return buf
}
func (a *UsedSpaceAnnouncement) StableSize() (size int) {
if a == nil {
return 0
}
size += protoutil.UInt64Size(usedSpaceAnnounceEpochField, a.epoch)
size += protoutil.NestedStructureSize(usedSpaceAnnounceCIDField, a.cid)
size += protoutil.UInt64Size(usedSpaceAnnounceUsedSpaceField, a.usedSpace)
return size
}
func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error {
return message.Unmarshal(a, data, new(container.AnnounceUsedSpaceRequest_Body_Announcement))
}
func (r *AnnounceUsedSpaceRequestBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
var offset int
for i := range r.announcements {
offset += protoutil.NestedStructureMarshal(usedSpaceReqBodyAnnouncementsField, buf[offset:], &r.announcements[i])
}
return buf
}
func (r *AnnounceUsedSpaceRequestBody) StableSize() (size int) {
if r == nil {
return 0
}
for i := range r.announcements {
size += protoutil.NestedStructureSize(usedSpaceReqBodyAnnouncementsField, &r.announcements[i])
}
return size
}
func (r *AnnounceUsedSpaceRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.AnnounceUsedSpaceRequest_Body))
}
func (r *AnnounceUsedSpaceResponseBody) StableMarshal(_ []byte) []byte {
return nil
}
func (r *AnnounceUsedSpaceResponseBody) StableSize() (size int) {
return 0
}
func (r *AnnounceUsedSpaceResponseBody) Unmarshal([]byte) error {
return nil
}

View file

@ -28,20 +28,9 @@ func TestMessageConvert(t *testing.T) {
func(empty bool) message.Message { return containertest.GenerateListRequest(empty) },
func(empty bool) message.Message { return containertest.GenerateListResponseBody(empty) },
func(empty bool) message.Message { return containertest.GenerateListResponse(empty) },
func(empty bool) message.Message { return containertest.GenerateSetExtendedACLRequestBody(empty) },
func(empty bool) message.Message { return containertest.GenerateSetExtendedACLRequest(empty) },
func(empty bool) message.Message { return containertest.GenerateGetRequestBody(empty) },
func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) },
func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) },
func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequestBody(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequest(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponseBody(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponse(empty) },
func(empty bool) message.Message { return containertest.GenerateUsedSpaceAnnouncement(empty) },
func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequestBody(empty) },
func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequest(empty) },
func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceResponseBody(empty) },
func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceResponse(empty) },
)
}

View file

@ -1,7 +1,8 @@
package containertest
import (
acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test"
"crypto/rand"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
netmaptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/test"
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
@ -36,8 +37,11 @@ func GenerateContainer(empty bool) *container.Container {
m := new(container.Container)
if !empty {
nonce := make([]byte, 16)
_, _ = rand.Read(nonce)
m.SetBasicACL(12)
m.SetNonce([]byte{1, 2, 3})
m.SetNonce(nonce)
m.SetOwnerID(refstest.GenerateOwnerID(false))
m.SetAttributes(GenerateAttributes(false))
m.SetPlacementPolicy(netmaptest.GeneratePlacementPolicy(false))
@ -234,163 +238,3 @@ func GenerateListResponse(empty bool) *container.ListResponse {
return m
}
func GenerateSetExtendedACLRequestBody(empty bool) *container.SetExtendedACLRequestBody {
m := new(container.SetExtendedACLRequestBody)
if !empty {
m.SetEACL(acltest.GenerateTable(false))
}
m.SetSignature(refstest.GenerateSignature(empty))
return m
}
func GenerateSetExtendedACLRequest(empty bool) *container.SetExtendedACLRequest {
m := new(container.SetExtendedACLRequest)
if !empty {
m.SetBody(GenerateSetExtendedACLRequestBody(false))
}
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
return m
}
func GenerateSetExtendedACLResponseBody(_ bool) *container.SetExtendedACLResponseBody {
m := new(container.SetExtendedACLResponseBody)
return m
}
func GenerateSetExtendedACLResponse(empty bool) *container.SetExtendedACLResponse {
m := new(container.SetExtendedACLResponse)
if !empty {
m.SetBody(GenerateSetExtendedACLResponseBody(false))
}
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
return m
}
func GenerateGetExtendedACLRequestBody(empty bool) *container.GetExtendedACLRequestBody {
m := new(container.GetExtendedACLRequestBody)
if !empty {
m.SetContainerID(refstest.GenerateContainerID(false))
}
return m
}
func GenerateGetExtendedACLRequest(empty bool) *container.GetExtendedACLRequest {
m := new(container.GetExtendedACLRequest)
if !empty {
m.SetBody(GenerateGetExtendedACLRequestBody(false))
}
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
return m
}
func GenerateGetExtendedACLResponseBody(empty bool) *container.GetExtendedACLResponseBody {
m := new(container.GetExtendedACLResponseBody)
if !empty {
m.SetEACL(acltest.GenerateTable(false))
}
m.SetSignature(refstest.GenerateSignature(empty))
m.SetSessionToken(sessiontest.GenerateSessionToken(empty))
return m
}
func GenerateGetExtendedACLResponse(empty bool) *container.GetExtendedACLResponse {
m := new(container.GetExtendedACLResponse)
if !empty {
m.SetBody(GenerateGetExtendedACLResponseBody(false))
}
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
return m
}
func GenerateUsedSpaceAnnouncement(empty bool) *container.UsedSpaceAnnouncement {
m := new(container.UsedSpaceAnnouncement)
if !empty {
m.SetContainerID(refstest.GenerateContainerID(false))
m.SetEpoch(1)
m.SetUsedSpace(2)
}
return m
}
func GenerateUsedSpaceAnnouncements(empty bool) []container.UsedSpaceAnnouncement {
var res []container.UsedSpaceAnnouncement
if !empty {
res = append(res,
*GenerateUsedSpaceAnnouncement(false),
*GenerateUsedSpaceAnnouncement(false),
)
}
return res
}
func GenerateAnnounceUsedSpaceRequestBody(empty bool) *container.AnnounceUsedSpaceRequestBody {
m := new(container.AnnounceUsedSpaceRequestBody)
if !empty {
m.SetAnnouncements(GenerateUsedSpaceAnnouncements(false))
}
return m
}
func GenerateAnnounceUsedSpaceRequest(empty bool) *container.AnnounceUsedSpaceRequest {
m := new(container.AnnounceUsedSpaceRequest)
if !empty {
m.SetBody(GenerateAnnounceUsedSpaceRequestBody(false))
}
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
return m
}
func GenerateAnnounceUsedSpaceResponseBody(_ bool) *container.AnnounceUsedSpaceResponseBody {
m := new(container.AnnounceUsedSpaceResponseBody)
return m
}
func GenerateAnnounceUsedSpaceResponse(empty bool) *container.AnnounceUsedSpaceResponse {
m := new(container.AnnounceUsedSpaceResponse)
if !empty {
m.SetBody(GenerateAnnounceUsedSpaceResponseBody(false))
}
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
return m
}

View file

@ -1,7 +1,6 @@
package container
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
@ -110,76 +109,6 @@ type ListResponse struct {
session.ResponseHeaders
}
type SetExtendedACLRequestBody struct {
eacl *acl.Table
sig *refs.Signature
}
type SetExtendedACLRequest struct {
body *SetExtendedACLRequestBody
session.RequestHeaders
}
type SetExtendedACLResponseBody struct{}
type SetExtendedACLResponse struct {
body *SetExtendedACLResponseBody
session.ResponseHeaders
}
type GetExtendedACLRequestBody struct {
cid *refs.ContainerID
}
type GetExtendedACLRequest struct {
body *GetExtendedACLRequestBody
session.RequestHeaders
}
type GetExtendedACLResponseBody struct {
eacl *acl.Table
sig *refs.Signature
token *session.Token
}
type GetExtendedACLResponse struct {
body *GetExtendedACLResponseBody
session.ResponseHeaders
}
type UsedSpaceAnnouncement struct {
epoch uint64
cid *refs.ContainerID
usedSpace uint64
}
type AnnounceUsedSpaceRequestBody struct {
announcements []UsedSpaceAnnouncement
}
type AnnounceUsedSpaceRequest struct {
body *AnnounceUsedSpaceRequestBody
session.RequestHeaders
}
type AnnounceUsedSpaceResponseBody struct{}
type AnnounceUsedSpaceResponse struct {
body *AnnounceUsedSpaceResponseBody
session.ResponseHeaders
}
func (a *Attribute) GetKey() string {
if a != nil {
return a.key
@ -515,203 +444,3 @@ func (r *ListResponse) GetBody() *ListResponseBody {
func (r *ListResponse) SetBody(v *ListResponseBody) {
r.body = v
}
func (r *SetExtendedACLRequestBody) GetEACL() *acl.Table {
if r != nil {
return r.eacl
}
return nil
}
func (r *SetExtendedACLRequestBody) SetEACL(v *acl.Table) {
r.eacl = v
}
func (r *SetExtendedACLRequestBody) GetSignature() *refs.Signature {
if r != nil {
return r.sig
}
return nil
}
func (r *SetExtendedACLRequestBody) SetSignature(v *refs.Signature) {
// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
v.SetScheme(0)
r.sig = v
}
func (r *SetExtendedACLRequest) GetBody() *SetExtendedACLRequestBody {
if r != nil {
return r.body
}
return nil
}
func (r *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequestBody) {
r.body = v
}
func (r *SetExtendedACLResponse) GetBody() *SetExtendedACLResponseBody {
if r != nil {
return r.body
}
return nil
}
func (r *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponseBody) {
r.body = v
}
func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID {
if r != nil {
return r.cid
}
return nil
}
func (r *GetExtendedACLRequestBody) SetContainerID(v *refs.ContainerID) {
r.cid = v
}
func (r *GetExtendedACLRequest) GetBody() *GetExtendedACLRequestBody {
if r != nil {
return r.body
}
return nil
}
func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) {
r.body = v
}
func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table {
if r != nil {
return r.eacl
}
return nil
}
func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) {
r.eacl = v
}
func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature {
if r != nil {
return r.sig
}
return nil
}
func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) {
// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
v.SetScheme(0)
r.sig = v
}
// GetSessionToken returns token of the session within which requested
// eACL table was set.
func (r *GetExtendedACLResponseBody) GetSessionToken() *session.Token {
if r != nil {
return r.token
}
return nil
}
// SetSessionToken sets token of the session within which requested
// eACL table was set.
func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.Token) {
r.token = v
}
func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody {
if r != nil {
return r.body
}
return nil
}
func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) {
r.body = v
}
func (a *UsedSpaceAnnouncement) GetEpoch() uint64 {
if a != nil {
return a.epoch
}
return 0
}
func (a *UsedSpaceAnnouncement) SetEpoch(v uint64) {
a.epoch = v
}
func (a *UsedSpaceAnnouncement) GetUsedSpace() uint64 {
if a != nil {
return a.usedSpace
}
return 0
}
func (a *UsedSpaceAnnouncement) SetUsedSpace(v uint64) {
a.usedSpace = v
}
func (a *UsedSpaceAnnouncement) GetContainerID() *refs.ContainerID {
if a != nil {
return a.cid
}
return nil
}
func (a *UsedSpaceAnnouncement) SetContainerID(v *refs.ContainerID) {
a.cid = v
}
func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []UsedSpaceAnnouncement {
if r != nil {
return r.announcements
}
return nil
}
func (r *AnnounceUsedSpaceRequestBody) SetAnnouncements(v []UsedSpaceAnnouncement) {
r.announcements = v
}
func (r *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequestBody {
if r != nil {
return r.body
}
return nil
}
func (r *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequestBody) {
r.body = v
}
func (r *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponseBody {
if r != nil {
return r.body
}
return nil
}
func (r *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponseBody) {
r.body = v
}

20
go.mod
View file

@ -1,26 +1,28 @@
module git.frostfs.info/TrueCloudLab/frostfs-api-go/v2
go 1.19
go 1.22
require (
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0
github.com/VictoriaMetrics/easyproto v0.1.4
github.com/mailru/easyjson v0.7.7
github.com/stretchr/testify v1.8.3
golang.org/x/sync v0.2.0
google.golang.org/grpc v1.55.0
google.golang.org/protobuf v1.30.0
golang.org/x/sync v0.6.0
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
)
require (
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

44
go.sum
View file

@ -2,19 +2,22 @@ git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSV
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU=
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA=
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc=
github.com/VictoriaMetrics/easyproto v0.1.4 h1:r8cNvo8o6sR4QShBXQd1bKw/VVLSQma/V2KhTBPf+Sc=
github.com/VictoriaMetrics/easyproto v0.1.4/go.mod h1:QlGlzaJnDfFd8Lk6Ci/fuLxfTo3/GThPs2KH23mv710=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@ -23,23 +26,20 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU=
google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View file

@ -1,15 +0,0 @@
package random
import (
"math/rand"
"time"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
// Uint32 returns random uint32 value [0, max).
func Uint32(max uint32) uint32 {
return rand.Uint32() % max
}

View file

@ -1,8 +0,0 @@
package lock
import refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
// SetMembers sets `members` field.
func (x *Lock) SetMembers(ids []*refs.ObjectID) {
x.Members = ids
}

BIN
lock/grpc/types.pb.go generated

Binary file not shown.

BIN
lock/grpc/types_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,26 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package lock
func DoFuzzProtoLock(data []byte) int {
msg := new(Lock)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONLock(data []byte) int {
msg := new(Lock)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,21 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package lock
import (
testing "testing"
)
func FuzzProtoLock(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoLock(data)
})
}
func FuzzJSONLock(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONLock(data)
})
}

View file

@ -45,28 +45,26 @@ func (f *Filter) FromGRPCMessage(m grpc.Message) error {
return nil
}
func FiltersToGRPC(fs []Filter) (res []*netmap.Filter) {
func FiltersToGRPC(fs []Filter) (res []netmap.Filter) {
if fs != nil {
res = make([]*netmap.Filter, 0, len(fs))
res = make([]netmap.Filter, 0, len(fs))
for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*netmap.Filter))
res = append(res, *fs[i].ToGRPCMessage().(*netmap.Filter))
}
}
return
}
func FiltersFromGRPC(fs []*netmap.Filter) (res []Filter, err error) {
func FiltersFromGRPC(fs []netmap.Filter) (res []Filter, err error) {
if fs != nil {
res = make([]Filter, len(fs))
for i := range fs {
if fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
}
}
@ -105,28 +103,26 @@ func (s *Selector) FromGRPCMessage(m grpc.Message) error {
return nil
}
func SelectorsToGRPC(ss []Selector) (res []*netmap.Selector) {
func SelectorsToGRPC(ss []Selector) (res []netmap.Selector) {
if ss != nil {
res = make([]*netmap.Selector, 0, len(ss))
res = make([]netmap.Selector, 0, len(ss))
for i := range ss {
res = append(res, ss[i].ToGRPCMessage().(*netmap.Selector))
res = append(res, *ss[i].ToGRPCMessage().(*netmap.Selector))
}
}
return
}
func SelectorsFromGRPC(ss []*netmap.Selector) (res []Selector, err error) {
func SelectorsFromGRPC(ss []netmap.Selector) (res []Selector, err error) {
if ss != nil {
res = make([]Selector, len(ss))
for i := range ss {
if ss[i] != nil {
err = res[i].FromGRPCMessage(ss[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&ss[i])
if err != nil {
return
}
}
}
@ -142,6 +138,8 @@ func (r *Replica) ToGRPCMessage() grpc.Message {
m.SetSelector(r.selector)
m.SetCount(r.count)
m.EcDataCount = r.ecDataCount
m.EcParityCount = r.ecParityCount
}
return m
@ -155,32 +153,32 @@ func (r *Replica) FromGRPCMessage(m grpc.Message) error {
r.selector = v.GetSelector()
r.count = v.GetCount()
r.ecDataCount = v.GetEcDataCount()
r.ecParityCount = v.GetEcParityCount()
return nil
}
func ReplicasToGRPC(rs []Replica) (res []*netmap.Replica) {
func ReplicasToGRPC(rs []Replica) (res []netmap.Replica) {
if rs != nil {
res = make([]*netmap.Replica, 0, len(rs))
res = make([]netmap.Replica, 0, len(rs))
for i := range rs {
res = append(res, rs[i].ToGRPCMessage().(*netmap.Replica))
res = append(res, *rs[i].ToGRPCMessage().(*netmap.Replica))
}
}
return
}
func ReplicasFromGRPC(rs []*netmap.Replica) (res []Replica, err error) {
func ReplicasFromGRPC(rs []netmap.Replica) (res []Replica, err error) {
if rs != nil {
res = make([]Replica, len(rs))
for i := range rs {
if rs[i] != nil {
err = res[i].FromGRPCMessage(rs[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&rs[i])
if err != nil {
return
}
}
}
@ -198,6 +196,7 @@ func (p *PlacementPolicy) ToGRPCMessage() grpc.Message {
m.SetSelectors(SelectorsToGRPC(p.selectors))
m.SetReplicas(ReplicasToGRPC(p.replicas))
m.SetContainerBackupFactor(p.backupFactor)
m.SetUnique(p.unique)
}
return m
@ -228,6 +227,8 @@ func (p *PlacementPolicy) FromGRPCMessage(m grpc.Message) error {
p.backupFactor = v.GetContainerBackupFactor()
p.unique = v.GetUnique()
return nil
}
@ -282,28 +283,26 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil
}
func AttributesToGRPC(as []Attribute) (res []*netmap.NodeInfo_Attribute) {
func AttributesToGRPC(as []Attribute) (res []netmap.NodeInfo_Attribute) {
if as != nil {
res = make([]*netmap.NodeInfo_Attribute, 0, len(as))
res = make([]netmap.NodeInfo_Attribute, 0, len(as))
for i := range as {
res = append(res, as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute))
res = append(res, *as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute))
}
}
return
}
func AttributesFromGRPC(as []*netmap.NodeInfo_Attribute) (res []Attribute, err error) {
func AttributesFromGRPC(as []netmap.NodeInfo_Attribute) (res []Attribute, err error) {
if as != nil {
res = make([]Attribute, len(as))
for i := range as {
if as[i] != nil {
err = res[i].FromGRPCMessage(as[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&as[i])
if err != nil {
return
}
}
}
@ -521,13 +520,13 @@ func (x *NetworkConfig) ToGRPCMessage() grpc.Message {
if x != nil {
m = new(netmap.NetworkConfig)
var ps []*netmap.NetworkConfig_Parameter
var ps []netmap.NetworkConfig_Parameter
if ln := len(x.ps); ln > 0 {
ps = make([]*netmap.NetworkConfig_Parameter, 0, ln)
ps = make([]netmap.NetworkConfig_Parameter, 0, ln)
for i := 0; i < ln; i++ {
ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
ps = append(ps, *x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
}
}
@ -554,10 +553,8 @@ func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error {
ps = make([]NetworkParameter, ln)
for i := 0; i < ln; i++ {
if psV2[i] != nil {
if err := ps[i].FromGRPCMessage(psV2[i]); err != nil {
return err
}
if err := ps[i].FromGRPCMessage(&psV2[i]); err != nil {
return err
}
}
}
@ -749,10 +746,10 @@ func (x *NetMap) ToGRPCMessage() grpc.Message {
m.SetEpoch(x.epoch)
if x.nodes != nil {
nodes := make([]*netmap.NodeInfo, len(x.nodes))
nodes := make([]netmap.NodeInfo, len(x.nodes))
for i := range x.nodes {
nodes[i] = x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo)
nodes[i] = *x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo)
}
m.SetNodes(nodes)
@ -777,7 +774,7 @@ func (x *NetMap) FromGRPCMessage(m grpc.Message) error {
x.nodes = make([]NodeInfo, len(nodes))
for i := range nodes {
err = x.nodes[i].FromGRPCMessage(nodes[i])
err = x.nodes[i].FromGRPCMessage(&nodes[i])
if err != nil {
return err
}

View file

@ -1,116 +0,0 @@
package netmap
import (
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
// SetBody sets body of the request.
func (m *LocalNodeInfoRequest) SetBody(v *LocalNodeInfoRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *LocalNodeInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *LocalNodeInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetVersion sets version of response body.
func (m *LocalNodeInfoResponse_Body) SetVersion(v *refs.Version) {
m.Version = v
}
// SetNodeInfo sets node info of response body.
func (m *LocalNodeInfoResponse_Body) SetNodeInfo(v *NodeInfo) {
m.NodeInfo = v
}
// SetBody sets body of the response.
func (m *LocalNodeInfoResponse) SetBody(v *LocalNodeInfoResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *LocalNodeInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *LocalNodeInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetBody sets body of the request.
func (x *NetworkInfoRequest) SetBody(v *NetworkInfoRequest_Body) {
x.Body = v
}
// SetMetaHeader sets meta header of the request.
func (x *NetworkInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) {
x.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (x *NetworkInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
x.VerifyHeader = v
}
// SetNetworkInfo sets information about the network.
func (x *NetworkInfoResponse_Body) SetNetworkInfo(v *NetworkInfo) {
x.NetworkInfo = v
}
// SetBody sets body of the response.
func (x *NetworkInfoResponse) SetBody(v *NetworkInfoResponse_Body) {
x.Body = v
}
// SetMetaHeader sets meta header of the response.
func (x *NetworkInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
x.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (x *NetworkInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
x.VerifyHeader = v
}
// SetBody sets body of the request.
func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) {
x.Body = v
}
// SetMetaHeader sets meta header of the request.
func (x *NetmapSnapshotRequest) SetMetaHeader(v *session.RequestMetaHeader) {
x.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (x *NetmapSnapshotRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
x.VerifyHeader = v
}
// SetNetmap sets current Netmap.
func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) {
x.Netmap = v
}
// SetBody sets body of the response.
func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) {
x.Body = v
}
// SetMetaHeader sets meta header of the response.
func (x *NetmapSnapshotResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
x.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (x *NetmapSnapshotResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
x.VerifyHeader = v
}

Binary file not shown.

BIN
netmap/grpc/service_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,121 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
func DoFuzzProtoLocalNodeInfoRequest(data []byte) int {
msg := new(LocalNodeInfoRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONLocalNodeInfoRequest(data []byte) int {
msg := new(LocalNodeInfoRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoLocalNodeInfoResponse(data []byte) int {
msg := new(LocalNodeInfoResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONLocalNodeInfoResponse(data []byte) int {
msg := new(LocalNodeInfoResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkInfoRequest(data []byte) int {
msg := new(NetworkInfoRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkInfoRequest(data []byte) int {
msg := new(NetworkInfoRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkInfoResponse(data []byte) int {
msg := new(NetworkInfoResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkInfoResponse(data []byte) int {
msg := new(NetworkInfoResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetmapSnapshotRequest(data []byte) int {
msg := new(NetmapSnapshotRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetmapSnapshotRequest(data []byte) int {
msg := new(NetmapSnapshotRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetmapSnapshotResponse(data []byte) int {
msg := new(NetmapSnapshotResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetmapSnapshotResponse(data []byte) int {
msg := new(NetmapSnapshotResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,71 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
import (
testing "testing"
)
func FuzzProtoLocalNodeInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoLocalNodeInfoRequest(data)
})
}
func FuzzJSONLocalNodeInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONLocalNodeInfoRequest(data)
})
}
func FuzzProtoLocalNodeInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoLocalNodeInfoResponse(data)
})
}
func FuzzJSONLocalNodeInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONLocalNodeInfoResponse(data)
})
}
func FuzzProtoNetworkInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkInfoRequest(data)
})
}
func FuzzJSONNetworkInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkInfoRequest(data)
})
}
func FuzzProtoNetworkInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkInfoResponse(data)
})
}
func FuzzJSONNetworkInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkInfoResponse(data)
})
}
func FuzzProtoNetmapSnapshotRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetmapSnapshotRequest(data)
})
}
func FuzzJSONNetmapSnapshotRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetmapSnapshotRequest(data)
})
}
func FuzzProtoNetmapSnapshotResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetmapSnapshotResponse(data)
})
}
func FuzzJSONNetmapSnapshotResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetmapSnapshotResponse(data)
})
}

Binary file not shown.

View file

@ -1,207 +0,0 @@
package netmap
// SetReplicas of placement policy.
func (m *PlacementPolicy) SetReplicas(v []*Replica) {
m.Replicas = v
}
// SetContainerBackupFactor of placement policy.
func (m *PlacementPolicy) SetContainerBackupFactor(v uint32) {
m.ContainerBackupFactor = v
}
// SetSelectors of placement policy.
func (m *PlacementPolicy) SetSelectors(v []*Selector) {
m.Selectors = v
}
// SetFilters of placement policy.
func (m *PlacementPolicy) SetFilters(v []*Filter) {
m.Filters = v
}
// SetName of placement filter.
func (m *Filter) SetName(v string) {
m.Name = v
}
// SetKey of placement filter.
func (m *Filter) SetKey(v string) {
m.Key = v
}
// SetOperation of placement filter.
func (m *Filter) SetOp(v Operation) {
m.Op = v
}
// SetValue of placement filter.
func (m *Filter) SetValue(v string) {
m.Value = v
}
// SetFilters sets sub-filters of placement filter.
func (m *Filter) SetFilters(v []*Filter) {
m.Filters = v
}
// SetName of placement selector.
func (m *Selector) SetName(v string) {
m.Name = v
}
// SetCount of nodes of placement selector.
func (m *Selector) SetCount(v uint32) {
m.Count = v
}
// SetAttribute of nodes of placement selector.
func (m *Selector) SetAttribute(v string) {
m.Attribute = v
}
// SetFilter of placement selector.
func (m *Selector) SetFilter(v string) {
m.Filter = v
}
// SetClause of placement selector.
func (m *Selector) SetClause(v Clause) {
m.Clause = v
}
// SetCount of object replica.
func (m *Replica) SetCount(v uint32) {
m.Count = v
}
// SetSelector of object replica.
func (m *Replica) SetSelector(v string) {
m.Selector = v
}
// SetKey sets key to the node attribute.
func (m *NodeInfo_Attribute) SetKey(v string) {
m.Key = v
}
// SetValue sets value of the node attribute.
func (m *NodeInfo_Attribute) SetValue(v string) {
m.Value = v
}
// SetParent sets value of the node parents.
func (m *NodeInfo_Attribute) SetParents(v []string) {
m.Parents = v
}
// SetAddress sets node network address.
//
// Deprecated: use SetAddresses.
func (m *NodeInfo) SetAddress(v string) {
m.SetAddresses([]string{v})
}
// SetAddresses sets list of network addresses of the node.
func (m *NodeInfo) SetAddresses(v []string) {
m.Addresses = v
}
// SetPublicKey sets node public key in a binary format.
func (m *NodeInfo) SetPublicKey(v []byte) {
m.PublicKey = v
}
// SetAttributes sets list of the node attributes.
func (m *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) {
m.Attributes = v
}
// SetState sets node state.
func (m *NodeInfo) SetState(v NodeInfo_State) {
m.State = v
}
// SetCurrentEpoch sets number of the current epoch.
func (x *NetworkInfo) SetCurrentEpoch(v uint64) {
x.CurrentEpoch = v
}
// SetMagicNumber sets magic number of the sidechain.
func (x *NetworkInfo) SetMagicNumber(v uint64) {
x.MagicNumber = v
}
// SetMsPerBlock sets MillisecondsPerBlock network parameter.
func (x *NetworkInfo) SetMsPerBlock(v int64) {
x.MsPerBlock = v
}
// SetNetworkConfig sets NeoFS network configuration.
func (x *NetworkInfo) SetNetworkConfig(v *NetworkConfig) {
x.NetworkConfig = v
}
// FromString parses Clause from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Clause) FromString(s string) bool {
i, ok := Clause_value[s]
if ok {
*x = Clause(i)
}
return ok
}
// FromString parses Operation from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
i, ok := Operation_value[s]
if ok {
*x = Operation(i)
}
return ok
}
// FromString parses NodeInfo_State from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *NodeInfo_State) FromString(s string) bool {
i, ok := NodeInfo_State_value[s]
if ok {
*x = NodeInfo_State(i)
}
return ok
}
// SetKey sets parameter key.
func (x *NetworkConfig_Parameter) SetKey(v []byte) {
x.Key = v
}
// SetValue sets parameter value.
func (x *NetworkConfig_Parameter) SetValue(v []byte) {
x.Value = v
}
// SetParameters sets NeoFS network parameters.
func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) {
x.Parameters = v
}
// SetEpoch sets revision number of the Netmap.
func (x *Netmap) SetEpoch(v uint64) {
x.Epoch = v
}
// SetNodes sets nodes presented in the Netmap.
func (x *Netmap) SetNodes(v []*NodeInfo) {
x.Nodes = v
}

BIN
netmap/grpc/types.pb.go generated

Binary file not shown.

BIN
netmap/grpc/types_frostfs.pb.go generated Normal file

Binary file not shown.

View file

@ -0,0 +1,159 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
func DoFuzzProtoFilter(data []byte) int {
msg := new(Filter)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONFilter(data []byte) int {
msg := new(Filter)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSelector(data []byte) int {
msg := new(Selector)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSelector(data []byte) int {
msg := new(Selector)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoReplica(data []byte) int {
msg := new(Replica)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONReplica(data []byte) int {
msg := new(Replica)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPlacementPolicy(data []byte) int {
msg := new(PlacementPolicy)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPlacementPolicy(data []byte) int {
msg := new(PlacementPolicy)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNodeInfo(data []byte) int {
msg := new(NodeInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNodeInfo(data []byte) int {
msg := new(NodeInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetmap(data []byte) int {
msg := new(Netmap)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetmap(data []byte) int {
msg := new(Netmap)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkConfig(data []byte) int {
msg := new(NetworkConfig)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkConfig(data []byte) int {
msg := new(NetworkConfig)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkInfo(data []byte) int {
msg := new(NetworkInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkInfo(data []byte) int {
msg := new(NetworkInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,91 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
import (
testing "testing"
)
func FuzzProtoFilter(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoFilter(data)
})
}
func FuzzJSONFilter(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONFilter(data)
})
}
func FuzzProtoSelector(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSelector(data)
})
}
func FuzzJSONSelector(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSelector(data)
})
}
func FuzzProtoReplica(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoReplica(data)
})
}
func FuzzJSONReplica(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONReplica(data)
})
}
func FuzzProtoPlacementPolicy(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPlacementPolicy(data)
})
}
func FuzzJSONPlacementPolicy(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPlacementPolicy(data)
})
}
func FuzzProtoNodeInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNodeInfo(data)
})
}
func FuzzJSONNodeInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNodeInfo(data)
})
}
func FuzzProtoNetmap(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetmap(data)
})
}
func FuzzJSONNetmap(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetmap(data)
})
}
func FuzzProtoNetworkConfig(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkConfig(data)
})
}
func FuzzJSONNetworkConfig(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkConfig(data)
})
}
func FuzzProtoNetworkInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkInfo(data)
})
}
func FuzzJSONNetworkInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkInfo(data)
})
}

View file

@ -19,8 +19,10 @@ const (
attributeSelectorField = 4
filterSelectorField = 5
countReplicaField = 1
selectorReplicaField = 2
countReplicaField = 1
selectorReplicaField = 2
ecDataCountReplicaField = 3
ecParityCountReplicaField = 4
replicasPolicyField = 1
backupPolicyField = 2
@ -65,6 +67,10 @@ func (f *Filter) StableMarshal(buf []byte) []byte {
}
func (f *Filter) StableSize() (size int) {
if f == nil {
return 0
}
size += protoutil.StringSize(nameFilterField, f.name)
size += protoutil.StringSize(keyFilterField, f.key)
size += protoutil.EnumSize(opFilterField, int32(f.op))
@ -101,6 +107,10 @@ func (s *Selector) StableMarshal(buf []byte) []byte {
}
func (s *Selector) StableSize() (size int) {
if s == nil {
return 0
}
size += protoutil.StringSize(nameSelectorField, s.name)
size += protoutil.UInt32Size(countSelectorField, s.count)
size += protoutil.EnumSize(countSelectorField, int32(s.clause))
@ -126,14 +136,22 @@ func (r *Replica) StableMarshal(buf []byte) []byte {
var offset int
offset += protoutil.UInt32Marshal(countReplicaField, buf[offset:], r.count)
protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector)
offset += protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector)
offset += protoutil.UInt32Marshal(ecDataCountReplicaField, buf[offset:], r.ecDataCount)
protoutil.UInt32Marshal(ecParityCountReplicaField, buf[offset:], r.ecParityCount)
return buf
}
func (r *Replica) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.UInt32Size(countReplicaField, r.count)
size += protoutil.StringSize(selectorReplicaField, r.selector)
size += protoutil.UInt32Size(ecDataCountReplicaField, r.ecDataCount)
size += protoutil.UInt32Size(ecParityCountReplicaField, r.ecParityCount)
return size
}
@ -173,6 +191,10 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) []byte {
}
func (p *PlacementPolicy) StableSize() (size int) {
if p == nil {
return 0
}
for i := range p.replicas {
size += protoutil.NestedStructureSize(replicasPolicyField, &p.replicas[i])
}

View file

@ -81,6 +81,17 @@ func GenerateReplica(empty bool) *netmap.Replica {
return m
}
func GenerateEC(empty bool) *netmap.Replica {
m := new(netmap.Replica)
if !empty {
m.SetECDataCount(4)
m.SetECParityCount(2)
}
return m
}
func GenerateReplicas(empty bool) []netmap.Replica {
var res []netmap.Replica
@ -88,6 +99,7 @@ func GenerateReplicas(empty bool) []netmap.Replica {
res = append(res,
*GenerateReplica(false),
*GenerateReplica(false),
*GenerateEC(false),
)
}
@ -102,6 +114,7 @@ func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy {
m.SetFilters(GenerateFilters(false))
m.SetSelectors(GenerateSelectors(false))
m.SetReplicas(GenerateReplicas(false))
m.SetUnique(true)
}
return m

View file

@ -50,6 +50,9 @@ type Selector struct {
type Replica struct {
count uint32
selector string
ecDataCount uint32
ecParityCount uint32
}
type Operation uint32
@ -108,6 +111,7 @@ const (
OR
AND
NOT
LIKE
)
const (
@ -259,6 +263,30 @@ func (r *Replica) SetCount(count uint32) {
r.count = count
}
func (r *Replica) GetECDataCount() uint32 {
if r != nil {
return r.ecDataCount
}
return 0
}
func (r *Replica) SetECDataCount(count uint32) {
r.ecDataCount = count
}
func (r *Replica) GetECParityCount() uint32 {
if r != nil {
return r.ecParityCount
}
return 0
}
func (r *Replica) SetECParityCount(count uint32) {
r.ecParityCount = count
}
func (p *PlacementPolicy) GetUnique() bool {
if p != nil {
return p.unique

View file

@ -10,7 +10,7 @@ import (
func TestSetNotification(t *testing.T) {
o := new(Object)
var ni = NotificationInfo{
ni := NotificationInfo{
epoch: 10,
topic: "test",
}

View file

@ -142,28 +142,26 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil
}
func AttributesToGRPC(xs []Attribute) (res []*object.Header_Attribute) {
func AttributesToGRPC(xs []Attribute) (res []object.Header_Attribute) {
if xs != nil {
res = make([]*object.Header_Attribute, 0, len(xs))
res = make([]object.Header_Attribute, 0, len(xs))
for i := range xs {
res = append(res, xs[i].ToGRPCMessage().(*object.Header_Attribute))
res = append(res, *xs[i].ToGRPCMessage().(*object.Header_Attribute))
}
}
return
}
func AttributesFromGRPC(xs []*object.Header_Attribute) (res []Attribute, err error) {
func AttributesFromGRPC(xs []object.Header_Attribute) (res []Attribute, err error) {
if xs != nil {
res = make([]Attribute, len(xs))
for i := range xs {
if xs[i] != nil {
err = res[i].FromGRPCMessage(xs[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&xs[i])
if err != nil {
return
}
}
}
@ -262,6 +260,74 @@ func (h *SplitHeader) FromGRPCMessage(m grpc.Message) error {
return nil
}
func (h *ECHeader) ToGRPCMessage() grpc.Message {
var m *object.Header_EC
if h != nil {
m = new(object.Header_EC)
m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID)
m.ParentSplitId = h.ParentSplitID
m.ParentSplitParentId = h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID)
m.ParentAttributes = AttributesToGRPC(h.ParentAttributes)
m.Index = h.Index
m.Total = h.Total
m.Header = h.Header
m.HeaderLength = h.HeaderLength
}
return m
}
func (h *ECHeader) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*object.Header_EC)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
par := v.GetParent()
if par == nil {
h.Parent = nil
} else {
if h.Parent == nil {
h.Parent = new(refs.ObjectID)
}
err = h.Parent.FromGRPCMessage(par)
if err != nil {
return err
}
}
h.ParentSplitID = v.GetParentSplitId()
parSplitParentID := v.GetParentSplitParentId()
if parSplitParentID == nil {
h.ParentSplitParentID = nil
} else {
if h.ParentSplitParentID == nil {
h.ParentSplitParentID = new(refs.ObjectID)
}
err = h.ParentSplitParentID.FromGRPCMessage(parSplitParentID)
if err != nil {
return err
}
}
if h.ParentAttributes, err = AttributesFromGRPC(v.GetParentAttributes()); err != nil {
return err
}
h.Index = v.GetIndex()
h.Total = v.GetTotal()
h.Header = v.GetHeader()
h.HeaderLength = v.GetHeaderLength()
return nil
}
func (h *Header) ToGRPCMessage() grpc.Message {
var m *object.Header
@ -275,6 +341,7 @@ func (h *Header) ToGRPCMessage() grpc.Message {
m.SetContainerId(h.cid.ToGRPCMessage().(*refsGRPC.ContainerID))
m.SetSessionToken(h.sessionToken.ToGRPCMessage().(*sessionGRPC.SessionToken))
m.SetSplit(h.split.ToGRPCMessage().(*object.Header_Split))
m.Ec = h.ec.ToGRPCMessage().(*object.Header_EC)
m.SetAttributes(AttributesToGRPC(h.attr))
m.SetPayloadLength(h.payloadLen)
m.SetCreationEpoch(h.creatEpoch)
@ -313,6 +380,9 @@ func (h *Header) FromGRPCMessage(m grpc.Message) error {
if err := h.fillSplitHeader(v); err != nil {
return err
}
if err := h.fillECHeader(v); err != nil {
return err
}
h.attr, err = AttributesFromGRPC(v.GetAttributes())
if err != nil {
@ -417,6 +487,19 @@ func (h *Header) fillSplitHeader(v *object.Header) error {
return h.split.FromGRPCMessage(split)
}
func (h *Header) fillECHeader(v *object.Header) error {
ec := v.GetEc()
if ec == nil {
h.ec = nil
return nil
}
if h.ec == nil {
h.ec = new(ECHeader)
}
return h.ec.FromGRPCMessage(ec)
}
func (h *HeaderWithSignature) ToGRPCMessage() grpc.Message {
var m *object.HeaderWithSignature
@ -591,6 +674,73 @@ func (s *SplitInfo) FromGRPCMessage(m grpc.Message) error {
return nil
}
func (s *ECInfo) ToGRPCMessage() grpc.Message {
var m *object.ECInfo
if s != nil {
m = new(object.ECInfo)
if s.Chunks != nil {
chunks := make([]object.ECInfo_Chunk, len(s.Chunks))
for i := range chunks {
chunks[i] = *s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk)
}
m.Chunks = chunks
}
}
return m
}
func (s *ECInfo) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*object.ECInfo)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
chunks := v.GetChunks()
if chunks == nil {
s.Chunks = nil
} else {
s.Chunks = make([]ECChunk, len(chunks))
for i := range chunks {
if err := s.Chunks[i].FromGRPCMessage(&chunks[i]); err != nil {
return err
}
}
}
return nil
}
func (c *ECChunk) ToGRPCMessage() grpc.Message {
var m *object.ECInfo_Chunk
if c != nil {
m = new(object.ECInfo_Chunk)
m.Total = c.Total
m.Index = c.Index
m.Id = c.ID.ToGRPCMessage().(*refsGRPC.ObjectID)
}
return m
}
func (c *ECChunk) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*object.ECInfo_Chunk)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
if err := c.ID.FromGRPCMessage(v.GetId()); err != nil {
return err
}
c.Index = v.Index
c.Total = v.Total
return nil
}
func (r *GetRequestBody) ToGRPCMessage() grpc.Message {
var m *object.GetRequest_Body
@ -771,6 +921,8 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message {
m.SetChunk(t.ToGRPCMessage().(*object.GetResponse_Body_Chunk))
case *SplitInfo:
m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:
m.SetEcInfo(t.ToGRPCMessage().(*object.ECInfo))
default:
panic(fmt.Sprintf("unknown get object part %T", t))
}
@ -809,6 +961,12 @@ func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error {
r.objPart = partSplit
err = partSplit.FromGRPCMessage(pt.SplitInfo)
}
case *object.GetResponse_Body_EcInfo:
if pt != nil {
partEC := new(ECInfo)
r.objPart = partEC
err = partEC.FromGRPCMessage(pt.EcInfo)
}
default:
err = fmt.Errorf("unknown get object part %T", pt)
}
@ -1348,6 +1506,8 @@ func (r *HeadResponseBody) ToGRPCMessage() grpc.Message {
m.SetShortHeader(v.ToGRPCMessage().(*object.ShortHeader))
case *SplitInfo:
m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:
m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo))
default:
panic(fmt.Sprintf("unknown head part %T", v))
}
@ -1386,6 +1546,12 @@ func (r *HeadResponseBody) FromGRPCMessage(m grpc.Message) error {
r.hdrPart = partSplit
err = partSplit.FromGRPCMessage(pt.SplitInfo)
}
case *object.HeadResponse_Body_EcInfo:
if pt != nil {
partEC := new(ECInfo)
r.hdrPart = partEC
err = partEC.FromGRPCMessage(pt.EcInfo)
}
default:
err = fmt.Errorf("unknown head part %T", pt)
}
@ -1458,28 +1624,26 @@ func (f *SearchFilter) FromGRPCMessage(m grpc.Message) error {
return nil
}
func SearchFiltersToGRPC(fs []SearchFilter) (res []*object.SearchRequest_Body_Filter) {
func SearchFiltersToGRPC(fs []SearchFilter) (res []object.SearchRequest_Body_Filter) {
if fs != nil {
res = make([]*object.SearchRequest_Body_Filter, 0, len(fs))
res = make([]object.SearchRequest_Body_Filter, 0, len(fs))
for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter))
res = append(res, *fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter))
}
}
return
}
func SearchFiltersFromGRPC(fs []*object.SearchRequest_Body_Filter) (res []SearchFilter, err error) {
func SearchFiltersFromGRPC(fs []object.SearchRequest_Body_Filter) (res []SearchFilter, err error) {
if fs != nil {
res = make([]SearchFilter, len(fs))
for i := range fs {
if fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
}
}
@ -1659,28 +1823,26 @@ func (r *Range) FromGRPCMessage(m grpc.Message) error {
return nil
}
func RangesToGRPC(rs []Range) (res []*object.Range) {
func RangesToGRPC(rs []Range) (res []object.Range) {
if rs != nil {
res = make([]*object.Range, 0, len(rs))
res = make([]object.Range, 0, len(rs))
for i := range rs {
res = append(res, rs[i].ToGRPCMessage().(*object.Range))
res = append(res, *rs[i].ToGRPCMessage().(*object.Range))
}
}
return
}
func RangesFromGRPC(rs []*object.Range) (res []Range, err error) {
func RangesFromGRPC(rs []object.Range) (res []Range, err error) {
if rs != nil {
res = make([]Range, len(rs))
for i := range rs {
if rs[i] != nil {
err = res[i].FromGRPCMessage(rs[i])
if err != nil {
return
}
err = res[i].FromGRPCMessage(&rs[i])
if err != nil {
return
}
}
}
@ -1817,6 +1979,8 @@ func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message {
m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk))
case *SplitInfo:
m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:
m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo))
default:
panic(fmt.Sprintf("unknown get range part %T", v))
}
@ -1849,6 +2013,12 @@ func (r *GetRangeResponseBody) FromGRPCMessage(m grpc.Message) error {
r.rngPart = partSplit
err = partSplit.FromGRPCMessage(pt.SplitInfo)
}
case *object.GetRangeResponse_Body_EcInfo:
if pt != nil {
partEC := new(ECInfo)
r.rngPart = partEC
err = partEC.FromGRPCMessage(pt.EcInfo)
}
default:
err = fmt.Errorf("unknown get range part %T", pt)
}
@ -2169,3 +2339,217 @@ func (r *PutSingleResponse) FromGRPCMessage(m grpc.Message) error {
return r.ResponseHeaders.FromMessage(v)
}
func (r *PatchRequestBodyPatch) ToGRPCMessage() grpc.Message {
var m *object.PatchRequest_Body_Patch
if r != nil {
m = new(object.PatchRequest_Body_Patch)
m.SetSourceRange(r.GetRange().ToGRPCMessage().(*object.Range))
m.SetChunk(r.GetChunk())
}
return m
}
func (r *PatchRequestBodyPatch) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*object.PatchRequest_Body_Patch)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
srcRange := v.GetSourceRange()
if srcRange == nil {
r.Range = nil
} else {
if r.Range == nil {
r.Range = new(Range)
}
err = r.Range.FromGRPCMessage(srcRange)
if err != nil {
return err
}
}
r.Chunk = v.GetChunk()
return nil
}
func (r *PatchRequestBody) ToGRPCMessage() grpc.Message {
var m *object.PatchRequest_Body
if r != nil {
m = new(object.PatchRequest_Body)
m.SetAddress(r.address.ToGRPCMessage().(*refsGRPC.Address))
m.SetNewAttributes(AttributesToGRPC(r.newAttributes))
m.SetReplaceAttributes(r.replaceAttributes)
m.SetPatch(r.patch.ToGRPCMessage().(*object.PatchRequest_Body_Patch))
}
return m
}
func (r *PatchRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*object.PatchRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
addr := v.GetAddress()
if addr == nil {
r.address = nil
} else {
if r.address == nil {
r.address = new(refs.Address)
}
err = r.address.FromGRPCMessage(addr)
if err != nil {
return err
}
}
r.newAttributes, err = AttributesFromGRPC(v.GetNewAttributes())
if err != nil {
return err
}
r.replaceAttributes = v.GetReplaceAttributes()
patch := v.GetPatch()
if patch == nil {
r.patch = nil
} else {
if r.patch == nil {
r.patch = new(PatchRequestBodyPatch)
}
err = r.patch.FromGRPCMessage(patch)
if err != nil {
return err
}
}
return nil
}
func (r *PatchRequest) ToGRPCMessage() grpc.Message {
var m *object.PatchRequest
if r != nil {
m = new(object.PatchRequest)
m.SetBody(r.body.ToGRPCMessage().(*object.PatchRequest_Body))
r.RequestHeaders.ToMessage(m)
}
return m
}
func (r *PatchRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*object.PatchRequest)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(PatchRequestBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.RequestHeaders.FromMessage(v)
}
func (r *PatchResponseBody) ToGRPCMessage() grpc.Message {
var m *object.PatchResponse_Body
if r != nil {
m = new(object.PatchResponse_Body)
m.SetObjectId(r.ObjectID.ToGRPCMessage().(*refsGRPC.ObjectID))
}
return m
}
func (r *PatchResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*object.PatchResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
objID := v.GetObjectId()
if objID == nil {
r.ObjectID = nil
} else {
if r.ObjectID == nil {
r.ObjectID = new(refs.ObjectID)
}
err = r.ObjectID.FromGRPCMessage(objID)
if err != nil {
return err
}
}
return nil
}
func (r *PatchResponse) ToGRPCMessage() grpc.Message {
var m *object.PatchResponse
if r != nil {
m = new(object.PatchResponse)
m.SetBody(r.Body.ToGRPCMessage().(*object.PatchResponse_Body))
r.ResponseHeaders.ToMessage(m)
}
return m
}
func (r *PatchResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*object.PatchResponse)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.Body = nil
} else {
if r.Body == nil {
r.Body = new(PatchResponseBody)
}
err = r.Body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.ResponseHeaders.FromMessage(v)
}

View file

@ -36,6 +36,9 @@ const (
// FilterHeaderSplitID is a filter key to "split.splitID" field of the object header.
FilterHeaderSplitID = ReservedFilterPrefix + "split.splitID"
// FilterHeaderECParent is a filter key to "ec.parent" field of the object header.
FilterHeaderECParent = ReservedFilterPrefix + "ec.parent"
)
const (

View file

@ -1,537 +0,0 @@
package object
import (
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
// SetAddress sets address of the requested object.
func (m *GetRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetRaw sets raw flag of the request.
func (m *GetRequest_Body) SetRaw(v bool) {
m.Raw = v
}
// SetBody sets body of the request.
func (m *GetRequest) SetBody(v *GetRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetObjectId sets identifier of the object.
func (m *GetResponse_Body_Init) SetObjectId(v *refs.ObjectID) {
m.ObjectId = v
}
// SetSignature sets signature of the object identifier.
func (m *GetResponse_Body_Init) SetSignature(v *refs.Signature) {
m.Signature = v
}
// SetHeader sets header of the object.
func (m *GetResponse_Body_Init) SetHeader(v *Header) {
m.Header = v
}
// GetChunk returns chunk of the object payload bytes.
func (m *GetResponse_Body_Chunk) GetChunk() []byte {
if m != nil {
return m.Chunk
}
return nil
}
// SetChunk sets chunk of the object payload bytes.
func (m *GetResponse_Body_Chunk) SetChunk(v []byte) {
m.Chunk = v
}
// SetInit sets initial part of the object.
func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) {
m.ObjectPart = &GetResponse_Body_Init_{
Init: v,
}
}
// SetChunk sets part of the object payload.
func (m *GetResponse_Body) SetChunk(v *GetResponse_Body_Chunk) {
m.ObjectPart = v
}
// SetSplitInfo sets part of the object payload.
func (m *GetResponse_Body) SetSplitInfo(v *SplitInfo) {
m.ObjectPart = &GetResponse_Body_SplitInfo{
SplitInfo: v,
}
}
// SetBody sets body of the response.
func (m *GetResponse) SetBody(v *GetResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetObjectId sets identifier of the object.
func (m *PutRequest_Body_Init) SetObjectId(v *refs.ObjectID) {
m.ObjectId = v
}
// SetSignature sets signature of the object identifier.
func (m *PutRequest_Body_Init) SetSignature(v *refs.Signature) {
m.Signature = v
}
// SetHeader sets header of the object.
func (m *PutRequest_Body_Init) SetHeader(v *Header) {
m.Header = v
}
// SetCopiesNumber sets number of the copies to save.
func (m *PutRequest_Body_Init) SetCopiesNumber(v []uint32) {
m.CopiesNumber = v
}
// GetChunk returns chunk of the object payload bytes.
func (m *PutRequest_Body_Chunk) GetChunk() []byte {
if m != nil {
return m.Chunk
}
return nil
}
// SetChunk sets chunk of the object payload bytes.
func (m *PutRequest_Body_Chunk) SetChunk(v []byte) {
m.Chunk = v
}
// SetInit sets initial part of the object.
func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) {
m.ObjectPart = &PutRequest_Body_Init_{
Init: v,
}
}
// SetChunk sets part of the object payload.
func (m *PutRequest_Body) SetChunk(v *PutRequest_Body_Chunk) {
m.ObjectPart = v
}
// SetBody sets body of the request.
func (m *PutRequest) SetBody(v *PutRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetObjectId sets identifier of the saved object.
func (m *PutResponse_Body) SetObjectId(v *refs.ObjectID) {
m.ObjectId = v
}
// SetBody sets body of the response.
func (m *PutResponse) SetBody(v *PutResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetAddress sets address of the object to delete.
func (m *DeleteRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetBody sets body of the request.
func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetTombstone sets tombstone address.
func (x *DeleteResponse_Body) SetTombstone(v *refs.Address) {
x.Tombstone = v
}
// SetBody sets body of the response.
func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetAddress sets address of the object with the requested header.
func (m *HeadRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetMainOnly sets flag to return the minimal header subset.
func (m *HeadRequest_Body) SetMainOnly(v bool) {
m.MainOnly = v
}
// SetRaw sets raw flag of the request.
func (m *HeadRequest_Body) SetRaw(v bool) {
m.Raw = v
}
// SetBody sets body of the request.
func (m *HeadRequest) SetBody(v *HeadRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *HeadRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *HeadRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetHeader sets object header.
func (m *HeaderWithSignature) SetHeader(v *Header) {
m.Header = v
}
// SetSignature of the header.
func (m *HeaderWithSignature) SetSignature(v *refs.Signature) {
m.Signature = v
}
// SetHeader sets full header of the object.
func (m *HeadResponse_Body) SetHeader(v *HeaderWithSignature) {
m.Head = &HeadResponse_Body_Header{
Header: v,
}
}
// SetShortHeader sets short header of the object.
func (m *HeadResponse_Body) SetShortHeader(v *ShortHeader) {
m.Head = &HeadResponse_Body_ShortHeader{
ShortHeader: v,
}
}
// SetSplitInfo sets meta info about split hierarchy of the object.
func (m *HeadResponse_Body) SetSplitInfo(v *SplitInfo) {
m.Head = &HeadResponse_Body_SplitInfo{
SplitInfo: v,
}
}
// SetBody sets body of the response.
func (m *HeadResponse) SetBody(v *HeadResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *HeadResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *HeadResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetMatchType sets match type of the filter.
func (m *SearchRequest_Body_Filter) SetMatchType(v MatchType) {
m.MatchType = v
}
// SetKey sets key to the filtering header.
func (m *SearchRequest_Body_Filter) SetKey(v string) {
m.Key = v
}
// SetValue sets value of the filtering header.
func (m *SearchRequest_Body_Filter) SetValue(v string) {
m.Value = v
}
// SetVersion sets version of the search query.
func (m *SearchRequest_Body) SetVersion(v uint32) {
m.Version = v
}
// SetFilters sets list of the query filters.
func (m *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) {
m.Filters = v
}
// SetContainerId sets container ID of the search requets.
func (m *SearchRequest_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetBody sets body of the request.
func (m *SearchRequest) SetBody(v *SearchRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *SearchRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *SearchRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetIdList sets list of the identifiers of the matched objects.
func (m *SearchResponse_Body) SetIdList(v []*refs.ObjectID) {
m.IdList = v
}
// SetBody sets body of the response.
func (m *SearchResponse) SetBody(v *SearchResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *SearchResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *SearchResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetOffset sets offset of the payload range.
func (m *Range) SetOffset(v uint64) {
m.Offset = v
}
// SetLength sets length of the payload range.
func (m *Range) SetLength(v uint64) {
m.Length = v
}
// SetAddress sets address of the object with the request payload range.
func (m *GetRangeRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetRange sets range of the object payload.
func (m *GetRangeRequest_Body) SetRange(v *Range) {
m.Range = v
}
// SetRaw sets raw flag of the request.
func (m *GetRangeRequest_Body) SetRaw(v bool) {
m.Raw = v
}
// SetBody sets body of the request.
func (m *GetRangeRequest) SetBody(v *GetRangeRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetRangeRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRangeRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// GetChunk returns chunk of the object payload range bytes.
func (m *GetRangeResponse_Body_Chunk) GetChunk() []byte {
if m != nil {
return m.Chunk
}
return nil
}
// SetChunk sets chunk of the object payload range bytes.
func (m *GetRangeResponse_Body_Chunk) SetChunk(v []byte) {
m.Chunk = v
}
// SetChunk sets chunk of the object payload.
func (m *GetRangeResponse_Body) SetChunk(v *GetRangeResponse_Body_Chunk) {
m.RangePart = v
}
// SetSplitInfo sets meta info about split hierarchy of the object.
func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) {
m.RangePart = &GetRangeResponse_Body_SplitInfo{
SplitInfo: v,
}
}
// SetBody sets body of the response.
func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetRangeResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetRangeResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetAddress sets address of the object with the request payload range.
func (m *GetRangeHashRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetRanges sets list of the ranges of the object payload.
func (m *GetRangeHashRequest_Body) SetRanges(v []*Range) {
m.Ranges = v
}
// SetSalt sets salt for the object payload ranges.
func (m *GetRangeHashRequest_Body) SetSalt(v []byte) {
m.Salt = v
}
// Set sets salt for the object payload ranges.
func (m *GetRangeHashRequest_Body) SetType(v refs.ChecksumType) {
m.Type = v
}
// SetBody sets body of the request.
func (m *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetRangeHashRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRangeHashRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetHashList returns list of the range hashes.
func (m *GetRangeHashResponse_Body) SetHashList(v [][]byte) {
m.HashList = v
}
// SetHashList returns list of the range hashes.
func (m *GetRangeHashResponse_Body) SetType(v refs.ChecksumType) {
m.Type = v
}
// SetBody sets body of the response.
func (m *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetRangeHashResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetObject set object of the body.
func (m *PutSingleRequest_Body) SetObject(o *Object) {
m.Object = o
}
// SetCopiesNumber sets copies number of the body.
func (m *PutSingleRequest_Body) SetCopiesNumber(v []uint32) {
m.CopiesNumber = v
}
// SetBody sets body of the request.
func (m *PutSingleRequest) SetBody(b *PutSingleRequest_Body) {
m.Body = b
}
// SetMetaHeader sets meta header of the request.
func (m *PutSingleRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *PutSingleRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetBody sets body of the response.
func (m *PutSingleResponse) SetBody(b *PutSingleResponse_Body) {
m.Body = b
}
// SetMetaHeader sets meta header of the response.
func (m *PutSingleResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *PutSingleResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}

Some files were not shown because too many files have changed in this diff Show more