[#317] api: Revert easyproto marshaler usage
All checks were successful
DCO / DCO (pull_request) Successful in 26s
Tests and linters / Tests (pull_request) Successful in 46s
Tests and linters / Lint (pull_request) Successful in 1m52s

It has caused a noticeable degradation in node.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-12-26 10:03:55 +03:00
parent bab4d5a692
commit 328d214d2d
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg
110 changed files with 47773 additions and 37555 deletions

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
}

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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

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)
})
}

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

File diff suppressed because it is too large Load diff

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