Compare commits

...

24 commits

Author SHA1 Message Date
593dd77d84
[#327] rpc: Fix mem leak
gRPC stream must be closed by `cancel` to prevent memleak.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-30 12:53:43 +03:00
2786fadb25 [#326] pool: Add test for concurrent client deletion
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
2025-01-29 20:16:59 +03:00
37350dbb1e [#326] pool: Fix panic that causes mutex deadlock
Two concurrent 'deleteClientFromMap' calls for
the same client may produce panic and deadlock.

First goroutine acquires lock, removes element
from the map, releases lock.

Second goroutine acquires lock, and throws panic
while trying to call 'close()' on empty struct.
Lock is never released and it causes deadlock for
other goroutines.

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
2025-01-29 20:14:55 +03:00
d195cb5104
[#324] rpc: Fix mem leak
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-01-29 16:34:30 +03:00
00cebd297f [#303] user: Make user.ID a util.Uint160
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
2025-01-28 18:01:21 +03:00
761d087b93 [#302] user: Make ScriptHash return no error
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
2025-01-27 19:13:52 +03:00
9d7f7bd04f
[#320] .forgejo: Add generate-proto action
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2025-01-21 14:35:18 +03:00
7c577ecaeb
[#320] api: Run 'make proto'
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2025-01-21 14:33:23 +03:00
4b4f35bbac
[#320] make/proto: Add installing protoc-gen-go-grpc
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2025-01-21 14:32:02 +03:00
328d214d2d
[#317] api: Revert easyproto marshaler usage
It has caused a noticeable degradation in node.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-01-09 11:46:09 +03:00
bab4d5a692
[#317] go.mod: Update protobuf version
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-01-09 11:46:08 +03:00
42a0fc8c13 [#305] tree/pool: Add flag to use net map to prioritize tree services
New version of tree/pool selects tree service connection to make request based on the current net map and container placement policy

Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
2024-12-18 09:23:44 +03:00
dcd4ea334e
[#315] api: Restore test.proto file
Introduced in #281.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-12-16 10:42:16 +03:00
c757365752 [#309] Refine CODEOWNERS settings
Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-12-12 12:34:51 +00:00
902f32eeab [#312] pool: Ignore ECInfoErr errors in GetSplitInfo
* Ignore `ECInfoError` errors after raw `HeadObject` request

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-12-12 10:12:24 +00:00
d86cf85b39 [#311] client/container: Remove outdated comment
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
2024-12-11 15:53:53 +03:00
3dbae11efa
[#310] client/container: Remove commented code
Refs #291.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-12-11 14:23:44 +03:00
c4463df8d4 [#291] container: Rename field Account to OwnerID in PrmContainerList
Renaming this field so that it matches PrmContainerListStream.

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
2024-12-10 13:49:38 +03:00
852dac1476 [#291] container: Add ListStream method
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
2024-12-10 13:49:38 +03:00
e3026d3f4c [#291] container: Add ListStream to api
Since api was moved from `TrueCloudLab/frostfs-api-go` to sdk,
moving changes from TrueCloudLab/frostfs-api-go#125 here.

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
2024-12-10 12:05:56 +03:00
81c423e709 [#301] rpc: Make client stream initialization get cancelled by dial timeout
* `c.conn` may be already invalidated but the rpc client can't detect this.
  `NewStream` may hang trying to open a stream with invalidated connection.
  Using timer with `dialTimeout` for `NewStream` fixes this problem.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-12-06 09:49:44 +00:00
f7da6ba99c
[#306] netmap: Allow to select empty set of nodes
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-12-05 15:33:29 +03:00
0352b5b191
[#185] Implement rpc/client for tree service
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
2024-11-29 15:23:14 +03:00
afdc2d8340 [#297] bearer: Update module docstring
Module top level docstring was referencing outdated APIs which do not
exist anymore.

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-11-13 10:41:25 +03:00
149 changed files with 4600 additions and 3199 deletions

View file

@ -0,0 +1,22 @@
name: Code generation
on: [pull_request]
jobs:
wrappers:
name: Generate proto
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.23'
- name: Generate proto
run: make protoc
# The command seems to be non-deterministic.
# However, with >20 runs I haven't been able to reproduce the issue.
# This `git diff` is here to print diff in case we catch the behaviour again.
- name: Print diff
run: git diff HEAD
- name: Check that nothing has changed
run: git diff-index --exit-code HEAD

View file

@ -1 +1,3 @@
.* @TrueCloudLab/storage-core @TrueCloudLab/storage-services
.* @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers @TrueCloudLab/storage-services-committers @TrueCloudLab/storage-services-developers
.forgejo/.* @potyarkin
Makefile @potyarkin

View file

@ -7,8 +7,9 @@ TRUECLOUDLAB_LINT_VERSION ?= 0.0.7
OUTPUT_LINT_DIR ?= $(shell pwd)/bin
LINT_DIR = $(OUTPUT_LINT_DIR)/golangci-lint-$(LINT_VERSION)-v$(TRUECLOUDLAB_LINT_VERSION)
PROTOC_VERSION ?= 27.2
PROTOC_VERSION ?= 29.2
PROTOC_GEN_GO_VERSION ?= $(shell go list -f '{{.Version}}' -m google.golang.org/protobuf)
PROTOC_GEN_GRPC_GO_VERSION ?= 1.5.1
PROTOC_OS_VERSION=osx-x86_64
ifeq ($(shell uname), Linux)
PROTOC_OS_VERSION=linux-x86_64
@ -44,6 +45,8 @@ protoc-install:
@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)
@echo "⇒ Installing protoc-gen-go-grpc..."
@GOBIN=$(PROTOC_GEN_GO_DIR) go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@v$(PROTOC_GEN_GRPC_GO_VERSION)
# Regenerate code for proto files
@ -52,13 +55,13 @@ protoc:
make protoc-install; \
fi
# Protoc generate
@for f in `find . -type f -name '*.proto' -not -path './bin/*' -not -path './api/util/proto/test/*'`; do \
@for f in `find . -type f -name '*.proto' -not -path './bin/*'`; do \
echo "⇒ Processing $$f "; \
$(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 \
--plugin=protoc-gen-go=$(PROTOC_GEN_GO_DIR)/protoc-gen-go \
--plugin=protoc-gen-go-grpc=$(PROTOC_GEN_GO_DIR)/protoc-gen-go-grpc \
--go_out=. --go_opt=paths=source_relative \
--go_opt=default_api_level=API_HYBRID \
--go-grpc_opt=require_unimplemented_servers=false \
--go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \
done

BIN
api/accounting/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,45 +0,0 @@
//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

@ -1,31 +0,0 @@
//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.

Binary file not shown.

BIN
api/accounting/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,26 +0,0 @@
//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

@ -1,21 +0,0 @@
//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)
})
}

Binary file not shown.

View file

@ -187,24 +187,24 @@ 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 {
err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
@ -239,24 +239,24 @@ 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 {
err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
@ -305,24 +305,24 @@ 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 {
err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
@ -423,9 +423,9 @@ func (c *APEOverride) ToGRPCMessage() grpc.Message {
m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
if len(c.chains) > 0 {
apeChains := make([]apeGRPC.Chain, len(c.chains))
apeChains := make([]*apeGRPC.Chain, len(c.chains))
for i := range c.chains {
apeChains[i] = *c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
apeChains[i] = c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
}
m.SetChains(apeChains)
}
@ -453,7 +453,7 @@ func (c *APEOverride) FromGRPCMessage(m grpc.Message) error {
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 {
if err := c.chains[i].FromGRPCMessage(apeChains[i]); err != nil {
return err
}
}

BIN
api/acl/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,64 +0,0 @@
//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

@ -1,41 +0,0 @@
//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)
})
}

BIN
api/acl/grpc/types_protoopaque.pb.go generated Normal file

Binary file not shown.

View file

@ -14,12 +14,9 @@ func (x Action) String() string {
//
// Returns true if s was parsed successfully.
func (x *Action) FromString(s string) bool {
var g acl.Action
ok := g.FromString(s)
g, ok := acl.Action_value[s]
if ok {
*x = ActionFromGRPCField(g)
*x = ActionFromGRPCField(acl.Action(g))
}
return ok
@ -35,12 +32,10 @@ func (x Role) String() string {
//
// Returns true if s was parsed successfully.
func (x *Role) FromString(s string) bool {
var g acl.Role
ok := g.FromString(s)
g, ok := acl.Role_value[s]
if ok {
*x = RoleFromGRPCField(g)
*x = RoleFromGRPCField(acl.Role(g))
}
return ok
@ -56,12 +51,9 @@ func (x Operation) String() string {
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
var g acl.Operation
ok := g.FromString(s)
g, ok := acl.Operation_value[s]
if ok {
*x = OperationFromGRPCField(g)
*x = OperationFromGRPCField(acl.Operation(g))
}
return ok
@ -77,12 +69,10 @@ func (x MatchType) String() string {
//
// Returns true if s was parsed successfully.
func (x *MatchType) FromString(s string) bool {
var g acl.MatchType
ok := g.FromString(s)
g, ok := acl.MatchType_value[s]
if ok {
*x = MatchTypeFromGRPCField(g)
*x = MatchTypeFromGRPCField(acl.MatchType(g))
}
return ok
@ -98,12 +88,10 @@ func (x HeaderType) String() string {
//
// Returns true if s was parsed successfully.
func (x *HeaderType) FromString(s string) bool {
var g acl.HeaderType
ok := g.FromString(s)
g, ok := acl.HeaderType_value[s]
if ok {
*x = HeaderTypeFromGRPCField(g)
*x = HeaderTypeFromGRPCField(acl.HeaderType(g))
}
return ok

View file

@ -76,8 +76,7 @@ func (v2 *ChainRaw) ToGRPCMessage() grpc.Message {
if v2 != nil {
mgrpc = new(ape.Chain_Raw)
mgrpc.SetRaw(v2.GetRaw())
mgrpc.Raw = v2.GetRaw()
}
return mgrpc
@ -89,7 +88,7 @@ func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error {
return message.NewUnexpectedMessageType(m, mgrpc)
}
v2.SetRaw(mgrpc.GetRaw())
v2.SetRaw(mgrpc.Raw)
return nil
}
@ -104,7 +103,7 @@ func (v2 *Chain) ToGRPCMessage() grpc.Message {
default:
panic(fmt.Sprintf("unsupported chain kind: %T", chainKind))
case *ChainRaw:
mgrpc.SetKind(chainKind.ToGRPCMessage().(*ape.Chain_Raw))
mgrpc.SetRaw(chainKind.GetRaw())
}
}

BIN
api/ape/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,45 +0,0 @@
//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

@ -1,31 +0,0 @@
//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)
})
}

BIN
api/ape/grpc/types_protoopaque.pb.go generated Normal file

Binary file not shown.

View file

@ -296,9 +296,9 @@ func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message {
if respBody != nil {
respBodygrpc = new(apemanager.ListChainsResponse_Body)
chainsgrpc := make([]apeGRPC.Chain, 0, len(respBody.GetChains()))
chainsgrpc := make([]*apeGRPC.Chain, 0, len(respBody.GetChains()))
for _, chain := range respBody.GetChains() {
chainsgrpc = append(chainsgrpc, *chain.ToGRPCMessage().(*apeGRPC.Chain))
chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apeGRPC.Chain))
}
respBodygrpc.SetChains(chainsgrpc)
@ -317,7 +317,7 @@ func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error {
for _, chaingrpc := range respBodygrpc.GetChains() {
chain := new(ape.Chain)
if err := chain.FromGRPCMessage(&chaingrpc); err != nil {
if err := chain.FromGRPCMessage(chaingrpc); err != nil {
return err
}
chains = append(chains, chain)

BIN
api/apemanager/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,121 +0,0 @@
//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

@ -1,71 +0,0 @@
//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)
})
}

Binary file not shown.

Binary file not shown.

View file

@ -37,24 +37,24 @@ 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 {
err = res[i].FromGRPCMessage(&xs[i])
err = res[i].FromGRPCMessage(xs[i])
if err != nil {
return
}
@ -762,3 +762,138 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error {
return r.ResponseHeaders.FromMessage(v)
}
func (r *ListStreamRequestBody) ToGRPCMessage() grpc.Message {
var m *container.ListStreamRequest_Body
if r != nil {
m = new(container.ListStreamRequest_Body)
m.SetOwnerId(r.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID))
}
return m
}
func (r *ListStreamRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.ListStreamRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
ownerID := v.GetOwnerId()
if ownerID == nil {
r.ownerID = nil
} else {
if r.ownerID == nil {
r.ownerID = new(refs.OwnerID)
}
err = r.ownerID.FromGRPCMessage(ownerID)
}
return err
}
func (r *ListStreamRequest) ToGRPCMessage() grpc.Message {
var m *container.ListStreamRequest
if r != nil {
m = new(container.ListStreamRequest)
m.SetBody(r.body.ToGRPCMessage().(*container.ListStreamRequest_Body))
r.RequestHeaders.ToMessage(m)
}
return m
}
func (r *ListStreamRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.ListStreamRequest)
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(ListStreamRequestBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.RequestHeaders.FromMessage(v)
}
func (r *ListStreamResponseBody) ToGRPCMessage() grpc.Message {
var m *container.ListStreamResponse_Body
if r != nil {
m = new(container.ListStreamResponse_Body)
m.SetContainerIds(refs.ContainerIDsToGRPCMessage(r.cidList))
}
return m
}
func (r *ListStreamResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.ListStreamResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
r.cidList, err = refs.ContainerIDsFromGRPCMessage(v.GetContainerIds())
return err
}
func (r *ListStreamResponse) ToGRPCMessage() grpc.Message {
var m *container.ListStreamResponse
if r != nil {
m = new(container.ListStreamResponse)
m.SetBody(r.body.ToGRPCMessage().(*container.ListStreamResponse_Body))
r.ResponseHeaders.ToMessage(m)
}
return m
}
func (r *ListStreamResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.ListStreamResponse)
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(ListStreamResponseBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.ResponseHeaders.FromMessage(v)
}

BIN
api/container/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,159 +0,0 @@
//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

@ -1,91 +0,0 @@
//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.

Binary file not shown.

BIN
api/container/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,26 +0,0 @@
//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

@ -1,21 +0,0 @@
//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)
})
}

BIN
api/container/grpc/types_protoopaque.pb.go generated Normal file

Binary file not shown.

View file

@ -343,3 +343,65 @@ func (r *ListResponseBody) StableSize() (size int) {
func (r *ListResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.ListResponse_Body))
}
func (r *ListStreamRequestBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
protoutil.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID)
return buf
}
func (r *ListStreamRequestBody) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.NestedStructureSize(listReqBodyOwnerField, r.ownerID)
return size
}
func (r *ListStreamRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.ListStreamRequest_Body))
}
func (r *ListStreamResponseBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
var offset int
for i := range r.cidList {
offset += protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], &r.cidList[i])
}
return buf
}
func (r *ListStreamResponseBody) StableSize() (size int) {
if r == nil {
return 0
}
for i := range r.cidList {
size += protoutil.NestedStructureSize(listRespBodyIDsField, &r.cidList[i])
}
return size
}
func (r *ListStreamResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.ListStreamResponse_Body))
}

View file

@ -109,6 +109,26 @@ type ListResponse struct {
session.ResponseHeaders
}
type ListStreamRequestBody struct {
ownerID *refs.OwnerID
}
type ListStreamRequest struct {
body *ListStreamRequestBody
session.RequestHeaders
}
type ListStreamResponseBody struct {
cidList []refs.ContainerID
}
type ListStreamResponse struct {
body *ListStreamResponseBody
session.ResponseHeaders
}
func (a *Attribute) GetKey() string {
if a != nil {
return a.key
@ -444,3 +464,51 @@ func (r *ListResponse) GetBody() *ListResponseBody {
func (r *ListResponse) SetBody(v *ListResponseBody) {
r.body = v
}
func (r *ListStreamRequestBody) GetOwnerID() *refs.OwnerID {
if r != nil {
return r.ownerID
}
return nil
}
func (r *ListStreamRequestBody) SetOwnerID(v *refs.OwnerID) {
r.ownerID = v
}
func (r *ListStreamRequest) GetBody() *ListStreamRequestBody {
if r != nil {
return r.body
}
return nil
}
func (r *ListStreamRequest) SetBody(v *ListStreamRequestBody) {
r.body = v
}
func (r *ListStreamResponseBody) GetContainerIDs() []refs.ContainerID {
if r != nil {
return r.cidList
}
return nil
}
func (r *ListStreamResponseBody) SetContainerIDs(v []refs.ContainerID) {
r.cidList = v
}
func (r *ListStreamResponse) GetBody() *ListStreamResponseBody {
if r != nil {
return r.body
}
return nil
}
func (r *ListStreamResponse) SetBody(v *ListStreamResponseBody) {
r.body = v
}

BIN
api/lock/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,26 +0,0 @@
//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

@ -1,21 +0,0 @@
//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)
})
}

BIN
api/lock/grpc/types_protoopaque.pb.go generated Normal file

Binary file not shown.

View file

@ -45,24 +45,24 @@ 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 {
err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
@ -103,24 +103,24 @@ 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 {
err = res[i].FromGRPCMessage(&ss[i])
err = res[i].FromGRPCMessage(ss[i])
if err != nil {
return
}
@ -138,8 +138,8 @@ func (r *Replica) ToGRPCMessage() grpc.Message {
m.SetSelector(r.selector)
m.SetCount(r.count)
m.EcDataCount = r.ecDataCount
m.EcParityCount = r.ecParityCount
m.SetEcDataCount(r.ecDataCount)
m.SetEcParityCount(r.ecParityCount)
}
return m
@ -159,24 +159,24 @@ func (r *Replica) FromGRPCMessage(m grpc.Message) error {
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 {
err = res[i].FromGRPCMessage(&rs[i])
err = res[i].FromGRPCMessage(rs[i])
if err != nil {
return
}
@ -283,24 +283,24 @@ 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 {
err = res[i].FromGRPCMessage(&as[i])
err = res[i].FromGRPCMessage(as[i])
if err != nil {
return
}
@ -520,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 := range ln {
ps = append(ps, *x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
}
}
@ -553,7 +553,7 @@ func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error {
ps = make([]NetworkParameter, ln)
for i := range ln {
if err := ps[i].FromGRPCMessage(&psV2[i]); err != nil {
if err := ps[i].FromGRPCMessage(psV2[i]); err != nil {
return err
}
}
@ -746,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)
@ -774,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
}

BIN
api/netmap/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,121 +0,0 @@
//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

@ -1,71 +0,0 @@
//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.

BIN
api/netmap/grpc/service_protoopaque.pb.go generated Normal file

Binary file not shown.

BIN
api/netmap/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,159 +0,0 @@
//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

@ -1,91 +0,0 @@
//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)
})
}

BIN
api/netmap/grpc/types_protoopaque.pb.go generated Normal file

Binary file not shown.

View file

@ -14,12 +14,10 @@ func (x Clause) String() string {
//
// Returns true if s was parsed successfully.
func (x *Clause) FromString(s string) bool {
var g netmap.Clause
ok := g.FromString(s)
g, ok := netmap.Clause_value[s]
if ok {
*x = ClauseFromGRPCMessage(g)
*x = ClauseFromGRPCMessage(netmap.Clause(g))
}
return ok
@ -35,12 +33,10 @@ func (x Operation) String() string {
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
var g netmap.Operation
ok := g.FromString(s)
g, ok := netmap.Operation_value[s]
if ok {
*x = OperationFromGRPCMessage(g)
*x = OperationFromGRPCMessage(netmap.Operation(g))
}
return ok
@ -56,12 +52,10 @@ func (x NodeState) String() string {
//
// Returns true if s was parsed successfully.
func (x *NodeState) FromString(s string) bool {
var g netmap.NodeInfo_State
ok := g.FromString(s)
g, ok := netmap.NodeInfo_State_value[s]
if ok {
*x = NodeStateFromRPCMessage(g)
*x = NodeStateFromRPCMessage(netmap.NodeInfo_State(g))
}
return ok

View file

@ -142,24 +142,24 @@ 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 {
err = res[i].FromGRPCMessage(&xs[i])
err = res[i].FromGRPCMessage(xs[i])
if err != nil {
return
}
@ -266,14 +266,14 @@ func (h *ECHeader) ToGRPCMessage() grpc.Message {
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
m.SetParent(h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID))
m.SetParentSplitId(h.ParentSplitID)
m.SetParentSplitParentId(h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID))
m.SetParentAttributes(AttributesToGRPC(h.ParentAttributes))
m.SetIndex(h.Index)
m.SetTotal(h.Total)
m.SetHeader(h.Header)
m.SetHeaderLength(h.HeaderLength)
}
return m
@ -681,9 +681,9 @@ func (s *ECInfo) ToGRPCMessage() grpc.Message {
m = new(object.ECInfo)
if s.Chunks != nil {
chunks := make([]object.ECInfo_Chunk, len(s.Chunks))
chunks := make([]*object.ECInfo_Chunk, len(s.Chunks))
for i := range chunks {
chunks[i] = *s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk)
chunks[i] = s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk)
}
m.Chunks = chunks
}
@ -704,7 +704,7 @@ func (s *ECInfo) FromGRPCMessage(m grpc.Message) error {
} else {
s.Chunks = make([]ECChunk, len(chunks))
for i := range chunks {
if err := s.Chunks[i].FromGRPCMessage(&chunks[i]); err != nil {
if err := s.Chunks[i].FromGRPCMessage(chunks[i]); err != nil {
return err
}
}
@ -718,9 +718,9 @@ func (c *ECChunk) ToGRPCMessage() grpc.Message {
if c != nil {
m = new(object.ECInfo_Chunk)
m.Total = c.Total
m.Index = c.Index
m.Id = c.ID.ToGRPCMessage().(*refsGRPC.ObjectID)
m.SetTotal(c.Total)
m.SetIndex(c.Index)
m.SetId(c.ID.ToGRPCMessage().(*refsGRPC.ObjectID))
}
return m
@ -735,8 +735,8 @@ func (c *ECChunk) FromGRPCMessage(m grpc.Message) error {
if err := c.ID.FromGRPCMessage(v.GetId()); err != nil {
return err
}
c.Index = v.Index
c.Total = v.Total
c.Index = v.GetIndex()
c.Total = v.GetTotal()
return nil
}
@ -888,8 +888,7 @@ func (r *GetObjectPartChunk) ToGRPCMessage() grpc.Message {
if r != nil {
m = new(object.GetResponse_Body_Chunk)
m.SetChunk(r.chunk)
m.Chunk = r.chunk
}
return m
@ -901,7 +900,7 @@ func (r *GetObjectPartChunk) FromGRPCMessage(m grpc.Message) error {
return message.NewUnexpectedMessageType(m, v)
}
r.chunk = v.GetChunk()
r.chunk = v.Chunk
return nil
}
@ -918,7 +917,7 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message {
case *GetObjectPartInit:
m.SetInit(t.ToGRPCMessage().(*object.GetResponse_Body_Init))
case *GetObjectPartChunk:
m.SetChunk(t.ToGRPCMessage().(*object.GetResponse_Body_Chunk))
m.SetChunk(t.ToGRPCMessage().(*object.GetResponse_Body_Chunk).Chunk)
case *SplitInfo:
m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:
@ -1088,7 +1087,7 @@ func (r *PutObjectPartChunk) ToGRPCMessage() grpc.Message {
if r != nil {
m = new(object.PutRequest_Body_Chunk)
m.SetChunk(r.chunk)
m.Chunk = r.chunk
}
return m
@ -1100,7 +1099,7 @@ func (r *PutObjectPartChunk) FromGRPCMessage(m grpc.Message) error {
return message.NewUnexpectedMessageType(m, v)
}
r.chunk = v.GetChunk()
r.chunk = v.Chunk
return nil
}
@ -1117,7 +1116,7 @@ func (r *PutRequestBody) ToGRPCMessage() grpc.Message {
case *PutObjectPartInit:
m.SetInit(t.ToGRPCMessage().(*object.PutRequest_Body_Init))
case *PutObjectPartChunk:
m.SetChunk(t.ToGRPCMessage().(*object.PutRequest_Body_Chunk))
m.SetChunk(t.ToGRPCMessage().(*object.PutRequest_Body_Chunk).Chunk)
default:
panic(fmt.Sprintf("unknown put object part %T", t))
}
@ -1624,24 +1623,24 @@ 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 {
err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
@ -1823,24 +1822,24 @@ 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 {
err = res[i].FromGRPCMessage(&rs[i])
err = res[i].FromGRPCMessage(rs[i])
if err != nil {
return
}
@ -1949,7 +1948,7 @@ func (r *GetRangePartChunk) ToGRPCMessage() grpc.Message {
if r != nil {
m = new(object.GetRangeResponse_Body_Chunk)
m.SetChunk(r.chunk)
m.Chunk = r.chunk
}
return m
@ -1961,7 +1960,7 @@ func (r *GetRangePartChunk) FromGRPCMessage(m grpc.Message) error {
return message.NewUnexpectedMessageType(m, v)
}
r.chunk = v.GetChunk()
r.chunk = v.Chunk
return nil
}
@ -1976,7 +1975,7 @@ func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message {
case nil:
m.RangePart = nil
case *GetRangePartChunk:
m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk))
m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk).Chunk)
case *SplitInfo:
m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:

BIN
api/object/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,387 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
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 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 DoFuzzProtoHeadRequest(data []byte) int {
msg := new(HeadRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeadRequest(data []byte) int {
msg := new(HeadRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeaderWithSignature(data []byte) int {
msg := new(HeaderWithSignature)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeaderWithSignature(data []byte) int {
msg := new(HeaderWithSignature)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeadResponse(data []byte) int {
msg := new(HeadResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeadResponse(data []byte) int {
msg := new(HeadResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSearchRequest(data []byte) int {
msg := new(SearchRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSearchRequest(data []byte) int {
msg := new(SearchRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSearchResponse(data []byte) int {
msg := new(SearchResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSearchResponse(data []byte) int {
msg := new(SearchResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoRange(data []byte) int {
msg := new(Range)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONRange(data []byte) int {
msg := new(Range)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeRequest(data []byte) int {
msg := new(GetRangeRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeRequest(data []byte) int {
msg := new(GetRangeRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeResponse(data []byte) int {
msg := new(GetRangeResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeResponse(data []byte) int {
msg := new(GetRangeResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeHashRequest(data []byte) int {
msg := new(GetRangeHashRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeHashRequest(data []byte) int {
msg := new(GetRangeHashRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeHashResponse(data []byte) int {
msg := new(GetRangeHashResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeHashResponse(data []byte) int {
msg := new(GetRangeHashResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutSingleRequest(data []byte) int {
msg := new(PutSingleRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutSingleRequest(data []byte) int {
msg := new(PutSingleRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutSingleResponse(data []byte) int {
msg := new(PutSingleResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutSingleResponse(data []byte) int {
msg := new(PutSingleResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPatchRequest(data []byte) int {
msg := new(PatchRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPatchRequest(data []byte) int {
msg := new(PatchRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPatchResponse(data []byte) int {
msg := new(PatchResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPatchResponse(data []byte) int {
msg := new(PatchResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,211 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
import (
testing "testing"
)
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 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 FuzzProtoHeadRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeadRequest(data)
})
}
func FuzzJSONHeadRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeadRequest(data)
})
}
func FuzzProtoHeaderWithSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeaderWithSignature(data)
})
}
func FuzzJSONHeaderWithSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeaderWithSignature(data)
})
}
func FuzzProtoHeadResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeadResponse(data)
})
}
func FuzzJSONHeadResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeadResponse(data)
})
}
func FuzzProtoSearchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSearchRequest(data)
})
}
func FuzzJSONSearchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSearchRequest(data)
})
}
func FuzzProtoSearchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSearchResponse(data)
})
}
func FuzzJSONSearchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSearchResponse(data)
})
}
func FuzzProtoRange(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoRange(data)
})
}
func FuzzJSONRange(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONRange(data)
})
}
func FuzzProtoGetRangeRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeRequest(data)
})
}
func FuzzJSONGetRangeRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeRequest(data)
})
}
func FuzzProtoGetRangeResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeResponse(data)
})
}
func FuzzJSONGetRangeResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeResponse(data)
})
}
func FuzzProtoGetRangeHashRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeHashRequest(data)
})
}
func FuzzJSONGetRangeHashRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeHashRequest(data)
})
}
func FuzzProtoGetRangeHashResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeHashResponse(data)
})
}
func FuzzJSONGetRangeHashResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeHashResponse(data)
})
}
func FuzzProtoPutSingleRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutSingleRequest(data)
})
}
func FuzzJSONPutSingleRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutSingleRequest(data)
})
}
func FuzzProtoPutSingleResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutSingleResponse(data)
})
}
func FuzzJSONPutSingleResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutSingleResponse(data)
})
}
func FuzzProtoPatchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPatchRequest(data)
})
}
func FuzzJSONPatchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPatchRequest(data)
})
}
func FuzzProtoPatchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPatchResponse(data)
})
}
func FuzzJSONPatchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPatchResponse(data)
})
}

Binary file not shown.

BIN
api/object/grpc/service_protoopaque.pb.go generated Normal file

Binary file not shown.

BIN
api/object/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,102 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
func DoFuzzProtoShortHeader(data []byte) int {
msg := new(ShortHeader)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONShortHeader(data []byte) int {
msg := new(ShortHeader)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeader(data []byte) int {
msg := new(Header)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeader(data []byte) int {
msg := new(Header)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoObject(data []byte) int {
msg := new(Object)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONObject(data []byte) int {
msg := new(Object)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSplitInfo(data []byte) int {
msg := new(SplitInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSplitInfo(data []byte) int {
msg := new(SplitInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoECInfo(data []byte) int {
msg := new(ECInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONECInfo(data []byte) int {
msg := new(ECInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,61 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
import (
testing "testing"
)
func FuzzProtoShortHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoShortHeader(data)
})
}
func FuzzJSONShortHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONShortHeader(data)
})
}
func FuzzProtoHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeader(data)
})
}
func FuzzJSONHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeader(data)
})
}
func FuzzProtoObject(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoObject(data)
})
}
func FuzzJSONObject(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONObject(data)
})
}
func FuzzProtoSplitInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSplitInfo(data)
})
}
func FuzzJSONSplitInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSplitInfo(data)
})
}
func FuzzProtoECInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoECInfo(data)
})
}
func FuzzJSONECInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONECInfo(data)
})
}

BIN
api/object/grpc/types_protoopaque.pb.go generated Normal file

Binary file not shown.

View file

@ -89,13 +89,13 @@ func (x *Lock) ToGRPCMessage() grpc.Message {
if x != nil {
m = new(lock.Lock)
var members []refsGRPC.ObjectID
var members []*refsGRPC.ObjectID
if x.members != nil {
members = make([]refsGRPC.ObjectID, len(x.members))
members = make([]*refsGRPC.ObjectID, len(x.members))
for i := range x.members {
members[i] = *x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID)
members[i] = x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID)
}
}
@ -119,7 +119,7 @@ func (x *Lock) FromGRPCMessage(m grpc.Message) error {
var err error
for i := range x.members {
err = x.members[i].FromGRPCMessage(&members[i])
err = x.members[i].FromGRPCMessage(members[i])
if err != nil {
return err
}

View file

@ -14,12 +14,10 @@ func (t Type) String() string {
//
// Returns true if s was parsed successfully.
func (t *Type) FromString(s string) bool {
var g object.ObjectType
ok := g.FromString(s)
g, ok := object.ObjectType_value[s]
if ok {
*t = TypeFromGRPCField(g)
*t = TypeFromGRPCField(object.ObjectType(g))
}
return ok
@ -43,12 +41,10 @@ func (t MatchType) String() string {
//
// Returns true if s was parsed successfully.
func (t *MatchType) FromString(s string) bool {
var g object.MatchType
ok := g.FromString(s)
g, ok := object.MatchType_value[s]
if ok {
*t = MatchTypeFromGRPCField(g)
*t = MatchTypeFromGRPCField(object.MatchType(g))
}
return ok

View file

@ -52,24 +52,24 @@ func (c *ContainerID) FromGRPCMessage(m grpc.Message) error {
return nil
}
func ContainerIDsToGRPCMessage(ids []ContainerID) (res []refs.ContainerID) {
func ContainerIDsToGRPCMessage(ids []ContainerID) (res []*refs.ContainerID) {
if ids != nil {
res = make([]refs.ContainerID, 0, len(ids))
res = make([]*refs.ContainerID, 0, len(ids))
for i := range ids {
res = append(res, *ids[i].ToGRPCMessage().(*refs.ContainerID))
res = append(res, ids[i].ToGRPCMessage().(*refs.ContainerID))
}
}
return
}
func ContainerIDsFromGRPCMessage(idsV2 []refs.ContainerID) (res []ContainerID, err error) {
func ContainerIDsFromGRPCMessage(idsV2 []*refs.ContainerID) (res []ContainerID, err error) {
if idsV2 != nil {
res = make([]ContainerID, len(idsV2))
for i := range idsV2 {
err = res[i].FromGRPCMessage(&idsV2[i])
err = res[i].FromGRPCMessage(idsV2[i])
if err != nil {
return
}
@ -102,24 +102,24 @@ func (o *ObjectID) FromGRPCMessage(m grpc.Message) error {
return nil
}
func ObjectIDListToGRPCMessage(ids []ObjectID) (res []refs.ObjectID) {
func ObjectIDListToGRPCMessage(ids []ObjectID) (res []*refs.ObjectID) {
if ids != nil {
res = make([]refs.ObjectID, 0, len(ids))
res = make([]*refs.ObjectID, 0, len(ids))
for i := range ids {
res = append(res, *ids[i].ToGRPCMessage().(*refs.ObjectID))
res = append(res, ids[i].ToGRPCMessage().(*refs.ObjectID))
}
}
return
}
func ObjectIDListFromGRPCMessage(idsV2 []refs.ObjectID) (res []ObjectID, err error) {
func ObjectIDListFromGRPCMessage(idsV2 []*refs.ObjectID) (res []ObjectID, err error) {
if idsV2 != nil {
res = make([]ObjectID, len(idsV2))
for i := range idsV2 {
err = res[i].FromGRPCMessage(&idsV2[i])
err = res[i].FromGRPCMessage(idsV2[i])
if err != nil {
return
}

BIN
api/refs/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,159 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package refs
func DoFuzzProtoAddress(data []byte) int {
msg := new(Address)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONAddress(data []byte) int {
msg := new(Address)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoObjectID(data []byte) int {
msg := new(ObjectID)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONObjectID(data []byte) int {
msg := new(ObjectID)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoContainerID(data []byte) int {
msg := new(ContainerID)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONContainerID(data []byte) int {
msg := new(ContainerID)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoOwnerID(data []byte) int {
msg := new(OwnerID)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONOwnerID(data []byte) int {
msg := new(OwnerID)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoVersion(data []byte) int {
msg := new(Version)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONVersion(data []byte) int {
msg := new(Version)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSignature(data []byte) int {
msg := new(Signature)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSignature(data []byte) int {
msg := new(Signature)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSignatureRFC6979(data []byte) int {
msg := new(SignatureRFC6979)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSignatureRFC6979(data []byte) int {
msg := new(SignatureRFC6979)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoChecksum(data []byte) int {
msg := new(Checksum)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONChecksum(data []byte) int {
msg := new(Checksum)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,91 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package refs
import (
testing "testing"
)
func FuzzProtoAddress(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoAddress(data)
})
}
func FuzzJSONAddress(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONAddress(data)
})
}
func FuzzProtoObjectID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoObjectID(data)
})
}
func FuzzJSONObjectID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONObjectID(data)
})
}
func FuzzProtoContainerID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoContainerID(data)
})
}
func FuzzJSONContainerID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONContainerID(data)
})
}
func FuzzProtoOwnerID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoOwnerID(data)
})
}
func FuzzJSONOwnerID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONOwnerID(data)
})
}
func FuzzProtoVersion(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoVersion(data)
})
}
func FuzzJSONVersion(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONVersion(data)
})
}
func FuzzProtoSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSignature(data)
})
}
func FuzzJSONSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSignature(data)
})
}
func FuzzProtoSignatureRFC6979(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSignatureRFC6979(data)
})
}
func FuzzJSONSignatureRFC6979(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSignatureRFC6979(data)
})
}
func FuzzProtoChecksum(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoChecksum(data)
})
}
func FuzzJSONChecksum(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONChecksum(data)
})
}

BIN
api/refs/grpc/types_protoopaque.pb.go generated Normal file

Binary file not shown.

View file

@ -14,12 +14,10 @@ func (t ChecksumType) String() string {
//
// Returns true if s was parsed successfully.
func (t *ChecksumType) FromString(s string) bool {
var g refs.ChecksumType
ok := g.FromString(s)
g, ok := refs.ChecksumType_value[s]
if ok {
*t = ChecksumTypeFromGRPC(g)
*t = ChecksumTypeFromGRPC(refs.ChecksumType(g))
}
return ok
@ -35,12 +33,10 @@ func (t SignatureScheme) String() string {
//
// Returns true if s was parsed successfully.
func (t *SignatureScheme) FromString(s string) bool {
var g refs.SignatureScheme
ok := g.FromString(s)
g, ok := refs.SignatureScheme_value[s]
if ok {
*t = SignatureScheme(g)
*t = SignatureScheme(refs.SignatureScheme(g))
}
return ok

View file

@ -12,18 +12,20 @@ import (
// SendUnary initializes communication session by RPC info, performs unary RPC
// and closes the session.
func SendUnary(cli *Client, info common.CallMethodInfo, req, resp message.Message, opts ...CallOption) error {
rw, err := cli.Init(info, opts...)
rw, err := cli.initInternal(info, opts...)
if err != nil {
return err
}
err = rw.WriteMessage(req)
if err != nil {
rw.cancel()
return err
}
err = rw.ReadMessage(resp)
if err != nil {
rw.cancel()
return err
}
@ -38,18 +40,28 @@ type MessageWriterCloser interface {
}
type clientStreamWriterCloser struct {
MessageReadWriter
sw *streamWrapper
resp message.Message
}
// WriteMessage implements MessageWriterCloser.
func (c *clientStreamWriterCloser) WriteMessage(m message.Message) error {
return c.sw.WriteMessage(m)
}
func (c *clientStreamWriterCloser) Close() error {
err := c.MessageReadWriter.Close()
err := c.sw.closeSend()
if err != nil {
c.sw.cancel()
return err
}
return c.ReadMessage(c.resp)
if err = c.sw.ReadMessage(c.resp); err != nil {
c.sw.cancel()
return err
}
return c.sw.Close()
}
// OpenClientStream initializes communication session by RPC info, opens client-side stream
@ -57,14 +69,14 @@ func (c *clientStreamWriterCloser) Close() error {
//
// All stream writes must be performed before the closing. Close must be called once.
func OpenClientStream(cli *Client, info common.CallMethodInfo, resp message.Message, opts ...CallOption) (MessageWriterCloser, error) {
rw, err := cli.Init(info, opts...)
rw, err := cli.initInternal(info, opts...)
if err != nil {
return nil, err
}
return &clientStreamWriterCloser{
MessageReadWriter: rw,
resp: resp,
sw: rw,
resp: resp,
}, nil
}
@ -76,7 +88,7 @@ type MessageReaderCloser interface {
}
type serverStreamReaderCloser struct {
rw MessageReadWriter
rw *streamWrapper
once sync.Once
@ -91,11 +103,15 @@ func (s *serverStreamReaderCloser) ReadMessage(msg message.Message) error {
})
if err != nil {
s.rw.cancel()
return err
}
err = s.rw.ReadMessage(msg)
if !errors.Is(err, io.EOF) {
if err != nil {
s.rw.cancel()
}
return err
}
@ -112,7 +128,7 @@ func (s *serverStreamReaderCloser) ReadMessage(msg message.Message) error {
//
// All stream reads must be performed before the closing. Close must be called once.
func OpenServerStream(cli *Client, info common.CallMethodInfo, req message.Message, opts ...CallOption) (MessageReader, error) {
rw, err := cli.Init(info, opts...)
rw, err := cli.initInternal(info, opts...)
if err != nil {
return nil, err
}

View file

@ -3,6 +3,7 @@ package client
import (
"context"
"io"
"time"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message"
@ -40,6 +41,10 @@ type MessageReadWriter interface {
// Init initiates a messaging session and returns the interface for message transmitting.
func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageReadWriter, error) {
return c.initInternal(info, opts...)
}
func (c *Client) initInternal(info common.CallMethodInfo, opts ...CallOption) (*streamWrapper, error) {
prm := defaultCallParameters()
for _, opt := range opts {
@ -51,18 +56,62 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe
}
ctx, cancel := context.WithCancel(prm.ctx)
stream, err := c.conn.NewStream(ctx, &grpc.StreamDesc{
StreamName: info.Name,
ServerStreams: info.ServerStream(),
ClientStreams: info.ClientStream(),
}, toMethodName(info))
if err != nil {
// `conn.NewStream` doesn't check if `conn` may turn up invalidated right before this invocation.
// In such cases, the operation can hang indefinitely, with the context timeout being the only
// mechanism to cancel it.
//
// We use a separate timer instead of context timeout because the latter
// would propagate to all subsequent read/write operations on the opened stream,
// which is not desired for the stream's lifecycle management.
dialTimeoutTimer := time.NewTimer(c.dialTimeout)
defer func() {
dialTimeoutTimer.Stop()
select {
case <-dialTimeoutTimer.C:
default:
}
}()
type newStreamRes struct {
stream grpc.ClientStream
err error
}
newStreamCh := make(chan newStreamRes)
go func() {
stream, err := c.conn.NewStream(ctx, &grpc.StreamDesc{
StreamName: info.Name,
ServerStreams: info.ServerStream(),
ClientStreams: info.ClientStream(),
}, toMethodName(info))
newStreamCh <- newStreamRes{
stream: stream,
err: err,
}
}()
var res newStreamRes
select {
case <-dialTimeoutTimer.C:
cancel()
return nil, err
res = <-newStreamCh
if res.stream != nil && res.err == nil {
_ = res.stream.CloseSend()
}
return nil, context.Canceled
case res = <-newStreamCh:
}
if res.err != nil {
cancel()
return nil, res.err
}
return &streamWrapper{
ClientStream: stream,
ClientStream: res.stream,
cancel: cancel,
timeout: c.rwTimeout,
}, nil

View file

@ -34,10 +34,15 @@ func (w streamWrapper) WriteMessage(m message.Message) error {
})
}
func (w *streamWrapper) Close() error {
func (w *streamWrapper) closeSend() error {
return w.withTimeout(w.ClientStream.CloseSend)
}
func (w *streamWrapper) Close() error {
w.cancel()
return nil
}
func (w *streamWrapper) withTimeout(closure func() error) error {
ch := make(chan error, 1)
go func() {
@ -50,6 +55,10 @@ func (w *streamWrapper) withTimeout(closure func() error) error {
select {
case err := <-ch:
tt.Stop()
select {
case <-tt.C:
default:
}
return err
case <-tt.C:
w.cancel()

View file

@ -13,6 +13,7 @@ const (
rpcContainerGet = "Get"
rpcContainerDel = "Delete"
rpcContainerList = "List"
rpcContainerStream = "ListStream"
rpcContainerGetEACL = "GetExtendedACL"
rpcContainerUsedSpace = "AnnounceUsedSpace"
)
@ -80,3 +81,27 @@ func ListContainers(
return resp, nil
}
type ListStreamResponseReader struct {
r client.MessageReader
}
func (r *ListStreamResponseReader) Read(resp *container.ListStreamResponse) error {
return r.r.ReadMessage(resp)
}
// ListContainersStream executes ContainerService.ListStream RPC.
func ListContainersStream(
cli *client.Client,
req *container.ListStreamRequest,
opts ...client.CallOption,
) (*ListStreamResponseReader, error) {
wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceContainer, rpcContainerStream), req, opts...)
if err != nil {
return nil, err
}
return &ListStreamResponseReader{
r: wc,
}, nil
}

View file

@ -1,14 +1,17 @@
package message
import (
"encoding/json"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)
// GRPCConvertedMessage is an interface
// of the gRPC message that is used
// for Message encoding/decoding.
type GRPCConvertedMessage interface {
UnmarshalProtobuf([]byte) error
grpc.Message
proto.Message
}
// Unmarshal decodes m from its Protobuf binary representation
@ -16,7 +19,7 @@ type GRPCConvertedMessage interface {
//
// gm should be tof the same type as the m.ToGRPCMessage() return.
func Unmarshal(m Message, data []byte, gm GRPCConvertedMessage) error {
if err := gm.UnmarshalProtobuf(data); err != nil {
if err := proto.Unmarshal(data, gm); err != nil {
return err
}
@ -25,16 +28,21 @@ func Unmarshal(m Message, data []byte, gm GRPCConvertedMessage) error {
// MarshalJSON encodes m to Protobuf JSON representation.
func MarshalJSON(m Message) ([]byte, error) {
return json.Marshal(m.ToGRPCMessage())
return protojson.MarshalOptions{
EmitUnpopulated: true,
}.Marshal(
m.ToGRPCMessage().(proto.Message),
)
}
// UnmarshalJSON decodes m from its Protobuf JSON representation
// via related gRPC message.
//
// gm should be tof the same type as the m.ToGRPCMessage() return.
func UnmarshalJSON(m Message, data []byte, gm any) error {
if err := json.Unmarshal(data, gm); err != nil {
func UnmarshalJSON(m Message, data []byte, gm GRPCConvertedMessage) error {
if err := protojson.Unmarshal(data, gm); err != nil {
return err
}
return m.FromGRPCMessage(gm)
}

View file

@ -70,6 +70,7 @@ func TestRPCMessage(t *testing.T, msgGens ...func(empty bool) message.Message) {
})
}
t.Run("compatibility", func(t *testing.T) {
t.Skip()
testCompatibility(t, msgGen)
})
})

178
api/rpc/tree.go Normal file
View file

@ -0,0 +1,178 @@
package rpc
import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tree"
)
const serviceTree = "tree.TreeService"
const (
rpcTreeAdd = "Add"
rpcTreeAddByPath = "AddByPath"
rpcTreeRemove = "Remove"
rpcTreeMove = "Move"
rpcTreeGetNodeByPath = "GetNodeByPath"
rpcTreeGetSubTree = "GetSubTree"
rpcTreeList = "TreeList"
rpcTreeApply = "Apply"
rpcTreeGetOpLog = "GetOpLog"
rpcTreeHealthcheck = "Healthcheck"
)
func Add(
cli *client.Client,
req *tree.AddRequest,
opts ...client.CallOption,
) (*tree.AddResponse, error) {
resp := new(tree.AddResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeAdd), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func AddByPath(
cli *client.Client,
req *tree.AddByPathRequest,
opts ...client.CallOption,
) (*tree.AddByPathResponse, error) {
resp := new(tree.AddByPathResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeAddByPath), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func Remove(cli *client.Client,
req *tree.RemoveRequest,
opts ...client.CallOption,
) (*tree.RemoveResponse, error) {
resp := new(tree.RemoveResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeRemove), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func Move(cli *client.Client,
req *tree.MoveRequest,
opts ...client.CallOption,
) (*tree.MoveResponse, error) {
resp := new(tree.MoveResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeMove), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func GetNodeByPath(cli *client.Client,
req *tree.GetNodeByPathRequest,
opts ...client.CallOption,
) (*tree.GetNodeByPathResponse, error) {
resp := new(tree.GetNodeByPathResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeGetNodeByPath), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
type GetSubTreeResponseReader struct {
r client.MessageReader
}
// Read reads response from the stream.
//
// Returns io.EOF of streaming is finished.
func (r *GetSubTreeResponseReader) Read(resp *tree.GetSubTreeResponse) error {
return r.r.ReadMessage(resp)
}
func GetSubTree(cli *client.Client,
req *tree.GetSubTreeRequest,
opts ...client.CallOption,
) (*GetSubTreeResponseReader, error) {
wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceTree, rpcTreeGetSubTree), req, opts...)
if err != nil {
return nil, err
}
return &GetSubTreeResponseReader{
r: wc,
}, nil
}
func TreeList(cli *client.Client,
req *tree.ListRequest,
opts ...client.CallOption,
) (*tree.ListResponse, error) {
resp := new(tree.ListResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeList), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func Apply(cli *client.Client,
req *tree.ApplyRequest,
opts ...client.CallOption,
) (*tree.ApplyResponse, error) {
resp := new(tree.ApplyResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeApply), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
type TreeServiceGetOpLogResponseReader struct {
r client.MessageReader
}
// Read reads response from the stream.
//
// Returns io.EOF of streaming is finished.
func (r *TreeServiceGetOpLogResponseReader) Read(resp *tree.GetOpLogResponse) error {
return r.r.ReadMessage(resp)
}
func GetOpLog(cli *client.Client,
req *tree.GetOpLogRequest,
opts ...client.CallOption,
) (*TreeServiceGetOpLogResponseReader, error) {
wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceTree, rpcTreeGetOpLog), req, opts...)
if err != nil {
return nil, err
}
return &TreeServiceGetOpLogResponseReader{
r: wc,
}, nil
}
func Healthcheck(cli *client.Client,
req *tree.HealthcheckRequest,
opts ...client.CallOption,
) (*tree.HealthcheckResponse, error) {
resp := new(tree.HealthcheckResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeHealthcheck), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}

View file

@ -207,24 +207,24 @@ func (x *XHeader) FromGRPCMessage(m grpc.Message) error {
return nil
}
func XHeadersToGRPC(xs []XHeader) (res []session.XHeader) {
func XHeadersToGRPC(xs []XHeader) (res []*session.XHeader) {
if xs != nil {
res = make([]session.XHeader, 0, len(xs))
res = make([]*session.XHeader, 0, len(xs))
for i := range xs {
res = append(res, *xs[i].ToGRPCMessage().(*session.XHeader))
res = append(res, xs[i].ToGRPCMessage().(*session.XHeader))
}
}
return
}
func XHeadersFromGRPC(xs []session.XHeader) (res []XHeader, err error) {
func XHeadersFromGRPC(xs []*session.XHeader) (res []XHeader, err error) {
if xs != nil {
res = make([]XHeader, len(xs))
for i := range xs {
err = res[i].FromGRPCMessage(&xs[i])
err = res[i].FromGRPCMessage(xs[i])
if err != nil {
return
}

BIN
api/session/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,45 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package session
func DoFuzzProtoCreateRequest(data []byte) int {
msg := new(CreateRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONCreateRequest(data []byte) int {
msg := new(CreateRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoCreateResponse(data []byte) int {
msg := new(CreateResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONCreateResponse(data []byte) int {
msg := new(CreateResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,31 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package session
import (
testing "testing"
)
func FuzzProtoCreateRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoCreateRequest(data)
})
}
func FuzzJSONCreateRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONCreateRequest(data)
})
}
func FuzzProtoCreateResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoCreateResponse(data)
})
}
func FuzzJSONCreateResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONCreateResponse(data)
})
}

Binary file not shown.

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