Compare commits
No commits in common. "master" and "feat/stream-for-list" have entirely different histories.
master
...
feat/strea
12 changed files with 147 additions and 870 deletions
|
@ -1,3 +1 @@
|
|||
.* @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers @TrueCloudLab/storage-services-committers @TrueCloudLab/storage-services-developers
|
||||
.forgejo/.* @potyarkin
|
||||
Makefile @potyarkin
|
||||
.* @TrueCloudLab/storage-core @TrueCloudLab/storage-services
|
||||
|
|
202
api/util/proto/test/test.pb.go
generated
202
api/util/proto/test/test.pb.go
generated
|
@ -2,7 +2,7 @@
|
|||
// versions:
|
||||
// protoc-gen-go v1.33.0
|
||||
// protoc v5.27.2
|
||||
// source: api/util/proto/test/test.proto
|
||||
// source: util/proto/test/test.proto
|
||||
|
||||
package test
|
||||
|
||||
|
@ -53,11 +53,11 @@ func (x Primitives_SomeEnum) String() string {
|
|||
}
|
||||
|
||||
func (Primitives_SomeEnum) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_api_util_proto_test_test_proto_enumTypes[0].Descriptor()
|
||||
return file_util_proto_test_test_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (Primitives_SomeEnum) Type() protoreflect.EnumType {
|
||||
return &file_api_util_proto_test_test_proto_enumTypes[0]
|
||||
return &file_util_proto_test_test_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x Primitives_SomeEnum) Number() protoreflect.EnumNumber {
|
||||
|
@ -66,7 +66,7 @@ func (x Primitives_SomeEnum) Number() protoreflect.EnumNumber {
|
|||
|
||||
// Deprecated: Use Primitives_SomeEnum.Descriptor instead.
|
||||
func (Primitives_SomeEnum) EnumDescriptor() ([]byte, []int) {
|
||||
return file_api_util_proto_test_test_proto_rawDescGZIP(), []int{0, 0}
|
||||
return file_util_proto_test_test_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
type Primitives struct {
|
||||
|
@ -96,7 +96,7 @@ type Primitives struct {
|
|||
func (x *Primitives) Reset() {
|
||||
*x = Primitives{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_util_proto_test_test_proto_msgTypes[0]
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ func (x *Primitives) String() string {
|
|||
func (*Primitives) ProtoMessage() {}
|
||||
|
||||
func (x *Primitives) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_util_proto_test_test_proto_msgTypes[0]
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -122,7 +122,7 @@ func (x *Primitives) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use Primitives.ProtoReflect.Descriptor instead.
|
||||
func (*Primitives) Descriptor() ([]byte, []int) {
|
||||
return file_api_util_proto_test_test_proto_rawDescGZIP(), []int{0}
|
||||
return file_util_proto_test_test_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Primitives) GetFieldA() []byte {
|
||||
|
@ -270,7 +270,7 @@ type RepPrimitives struct {
|
|||
func (x *RepPrimitives) Reset() {
|
||||
*x = RepPrimitives{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_util_proto_test_test_proto_msgTypes[1]
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ func (x *RepPrimitives) String() string {
|
|||
func (*RepPrimitives) ProtoMessage() {}
|
||||
|
||||
func (x *RepPrimitives) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_util_proto_test_test_proto_msgTypes[1]
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -296,7 +296,7 @@ func (x *RepPrimitives) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use RepPrimitives.ProtoReflect.Descriptor instead.
|
||||
func (*RepPrimitives) Descriptor() ([]byte, []int) {
|
||||
return file_api_util_proto_test_test_proto_rawDescGZIP(), []int{1}
|
||||
return file_util_proto_test_test_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *RepPrimitives) GetFieldA() [][]byte {
|
||||
|
@ -366,7 +366,7 @@ type Primitives_Aux struct {
|
|||
func (x *Primitives_Aux) Reset() {
|
||||
*x = Primitives_Aux{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_util_proto_test_test_proto_msgTypes[2]
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ func (x *Primitives_Aux) String() string {
|
|||
func (*Primitives_Aux) ProtoMessage() {}
|
||||
|
||||
func (x *Primitives_Aux) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_util_proto_test_test_proto_msgTypes[2]
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -392,7 +392,7 @@ func (x *Primitives_Aux) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use Primitives_Aux.ProtoReflect.Descriptor instead.
|
||||
func (*Primitives_Aux) Descriptor() ([]byte, []int) {
|
||||
return file_api_util_proto_test_test_proto_rawDescGZIP(), []int{0, 0}
|
||||
return file_util_proto_test_test_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *Primitives_Aux) GetInnerField() uint32 {
|
||||
|
@ -413,7 +413,7 @@ type RepPrimitives_Aux struct {
|
|||
func (x *RepPrimitives_Aux) Reset() {
|
||||
*x = RepPrimitives_Aux{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_util_proto_test_test_proto_msgTypes[3]
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ func (x *RepPrimitives_Aux) String() string {
|
|||
func (*RepPrimitives_Aux) ProtoMessage() {}
|
||||
|
||||
func (x *RepPrimitives_Aux) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_util_proto_test_test_proto_msgTypes[3]
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -439,7 +439,7 @@ func (x *RepPrimitives_Aux) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use RepPrimitives_Aux.ProtoReflect.Descriptor instead.
|
||||
func (*RepPrimitives_Aux) Descriptor() ([]byte, []int) {
|
||||
return file_api_util_proto_test_test_proto_rawDescGZIP(), []int{1, 0}
|
||||
return file_util_proto_test_test_proto_rawDescGZIP(), []int{1, 0}
|
||||
}
|
||||
|
||||
func (x *RepPrimitives_Aux) GetInnerField() uint32 {
|
||||
|
@ -449,90 +449,90 @@ func (x *RepPrimitives_Aux) GetInnerField() uint32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
var File_api_util_proto_test_test_proto protoreflect.FileDescriptor
|
||||
var File_util_proto_test_test_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_api_util_proto_test_test_proto_rawDesc = []byte{
|
||||
0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x12, 0x04, 0x74, 0x65, 0x73, 0x74, 0x22, 0xa6, 0x04, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69,
|
||||
0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17,
|
||||
0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x5f, 0x63, 0x18, 0xc8, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x43, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0xc9, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x66,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x66,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66,
|
||||
0x18, 0xcb, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x67, 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28,
|
||||
0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x47, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x5f, 0x69, 0x18, 0xcd, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x06, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x49, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6a, 0x18, 0xce,
|
||||
0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4a, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6b, 0x18, 0xcf, 0x01, 0x20, 0x01, 0x28, 0x07, 0x52,
|
||||
0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4b, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x5f, 0x68, 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74,
|
||||
0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65,
|
||||
0x45, 0x6e, 0x75, 0x6d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x12, 0x1c, 0x0a, 0x08,
|
||||
0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x18, 0x91, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48,
|
||||
0x00, 0x52, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x12, 0x1c, 0x0a, 0x08, 0x66, 0x69,
|
||||
0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x18, 0x92, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52,
|
||||
0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c,
|
||||
0x64, 0x5f, 0x61, 0x75, 0x78, 0x18, 0x93, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74,
|
||||
0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41,
|
||||
0x75, 0x78, 0x48, 0x00, 0x52, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26,
|
||||
0x0a, 0x03, 0x41, 0x75, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65,
|
||||
0x72, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e,
|
||||
0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12,
|
||||
0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a,
|
||||
0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x22,
|
||||
0xa2, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65,
|
||||
0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03,
|
||||
var file_util_proto_test_test_proto_rawDesc = []byte{
|
||||
0x0a, 0x1a, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73,
|
||||
0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x74, 0x65,
|
||||
0x73, 0x74, 0x22, 0xa6, 0x04, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65,
|
||||
0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69,
|
||||
0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x42, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03,
|
||||
0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07,
|
||||
0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65,
|
||||
0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17,
|
||||
0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52,
|
||||
0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, 0x1d, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x5f, 0x66, 0x75, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x07, 0x66,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x46, 0x75, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
|
||||
0x61, 0x75, 0x78, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74,
|
||||
0x2e, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41,
|
||||
0x75, 0x78, 0x52, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, 0x0a, 0x03,
|
||||
0x41, 0x75, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x46,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x42, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0xc8,
|
||||
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x5f, 0x65, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x45, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0xcb, 0x01, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, 0x18, 0x0a, 0x07, 0x66,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x5f, 0x67, 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x66,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x47, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x69,
|
||||
0x18, 0xcd, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6a, 0x18, 0xce, 0x01, 0x20, 0x01, 0x28,
|
||||
0x01, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4a, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x5f, 0x6b, 0x18, 0xcf, 0x01, 0x20, 0x01, 0x28, 0x07, 0x52, 0x06, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x4b, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x68, 0x18, 0xac,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69,
|
||||
0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d,
|
||||
0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x12, 0x1c, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c,
|
||||
0x64, 0x5f, 0x6d, 0x61, 0x18, 0x91, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x07, 0x66,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x12, 0x1c, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
|
||||
0x6d, 0x65, 0x18, 0x92, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x07, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x4d, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x75,
|
||||
0x78, 0x18, 0x93, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e,
|
||||
0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x78, 0x48, 0x00,
|
||||
0x52, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, 0x0a, 0x03, 0x41, 0x75,
|
||||
0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x46, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b,
|
||||
0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50,
|
||||
0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47,
|
||||
0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01,
|
||||
0x42, 0x09, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x22, 0xa2, 0x02, 0x0a, 0x0d,
|
||||
0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a,
|
||||
0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06,
|
||||
0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
|
||||
0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12,
|
||||
0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05,
|
||||
0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c,
|
||||
0x64, 0x5f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0x05, 0x20, 0x03,
|
||||
0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69,
|
||||
0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x46, 0x12, 0x1d, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x75, 0x18,
|
||||
0x07, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x46, 0x75, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x75, 0x78, 0x18,
|
||||
0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70,
|
||||
0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x78, 0x52, 0x08,
|
||||
0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, 0x0a, 0x03, 0x41, 0x75, 0x78, 0x12,
|
||||
0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74,
|
||||
0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_api_util_proto_test_test_proto_rawDescOnce sync.Once
|
||||
file_api_util_proto_test_test_proto_rawDescData = file_api_util_proto_test_test_proto_rawDesc
|
||||
file_util_proto_test_test_proto_rawDescOnce sync.Once
|
||||
file_util_proto_test_test_proto_rawDescData = file_util_proto_test_test_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_api_util_proto_test_test_proto_rawDescGZIP() []byte {
|
||||
file_api_util_proto_test_test_proto_rawDescOnce.Do(func() {
|
||||
file_api_util_proto_test_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_util_proto_test_test_proto_rawDescData)
|
||||
func file_util_proto_test_test_proto_rawDescGZIP() []byte {
|
||||
file_util_proto_test_test_proto_rawDescOnce.Do(func() {
|
||||
file_util_proto_test_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_util_proto_test_test_proto_rawDescData)
|
||||
})
|
||||
return file_api_util_proto_test_test_proto_rawDescData
|
||||
return file_util_proto_test_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_api_util_proto_test_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_api_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_api_util_proto_test_test_proto_goTypes = []interface{}{
|
||||
var file_util_proto_test_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_util_proto_test_test_proto_goTypes = []interface{}{
|
||||
(Primitives_SomeEnum)(0), // 0: test.Primitives.SomeEnum
|
||||
(*Primitives)(nil), // 1: test.Primitives
|
||||
(*RepPrimitives)(nil), // 2: test.RepPrimitives
|
||||
(*Primitives_Aux)(nil), // 3: test.Primitives.Aux
|
||||
(*RepPrimitives_Aux)(nil), // 4: test.RepPrimitives.Aux
|
||||
}
|
||||
var file_api_util_proto_test_test_proto_depIdxs = []int32{
|
||||
var file_util_proto_test_test_proto_depIdxs = []int32{
|
||||
0, // 0: test.Primitives.field_h:type_name -> test.Primitives.SomeEnum
|
||||
3, // 1: test.Primitives.field_aux:type_name -> test.Primitives.Aux
|
||||
4, // 2: test.RepPrimitives.field_aux:type_name -> test.RepPrimitives.Aux
|
||||
|
@ -543,13 +543,13 @@ var file_api_util_proto_test_test_proto_depIdxs = []int32{
|
|||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_api_util_proto_test_test_proto_init() }
|
||||
func file_api_util_proto_test_test_proto_init() {
|
||||
if File_api_util_proto_test_test_proto != nil {
|
||||
func init() { file_util_proto_test_test_proto_init() }
|
||||
func file_util_proto_test_test_proto_init() {
|
||||
if File_util_proto_test_test_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_api_util_proto_test_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_util_proto_test_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Primitives); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
@ -561,7 +561,7 @@ func file_api_util_proto_test_test_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_api_util_proto_test_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_util_proto_test_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RepPrimitives); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
@ -573,7 +573,7 @@ func file_api_util_proto_test_test_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_api_util_proto_test_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_util_proto_test_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Primitives_Aux); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
@ -585,7 +585,7 @@ func file_api_util_proto_test_test_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_api_util_proto_test_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_util_proto_test_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RepPrimitives_Aux); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
@ -598,7 +598,7 @@ func file_api_util_proto_test_test_proto_init() {
|
|||
}
|
||||
}
|
||||
}
|
||||
file_api_util_proto_test_test_proto_msgTypes[0].OneofWrappers = []interface{}{
|
||||
file_util_proto_test_test_proto_msgTypes[0].OneofWrappers = []interface{}{
|
||||
(*Primitives_FieldMa)(nil),
|
||||
(*Primitives_FieldMe)(nil),
|
||||
(*Primitives_FieldAux)(nil),
|
||||
|
@ -607,19 +607,19 @@ func file_api_util_proto_test_test_proto_init() {
|
|||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_api_util_proto_test_test_proto_rawDesc,
|
||||
RawDescriptor: file_util_proto_test_test_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_api_util_proto_test_test_proto_goTypes,
|
||||
DependencyIndexes: file_api_util_proto_test_test_proto_depIdxs,
|
||||
EnumInfos: file_api_util_proto_test_test_proto_enumTypes,
|
||||
MessageInfos: file_api_util_proto_test_test_proto_msgTypes,
|
||||
GoTypes: file_util_proto_test_test_proto_goTypes,
|
||||
DependencyIndexes: file_util_proto_test_test_proto_depIdxs,
|
||||
EnumInfos: file_util_proto_test_test_proto_enumTypes,
|
||||
MessageInfos: file_util_proto_test_test_proto_msgTypes,
|
||||
}.Build()
|
||||
File_api_util_proto_test_test_proto = out.File
|
||||
file_api_util_proto_test_test_proto_rawDesc = nil
|
||||
file_api_util_proto_test_test_proto_goTypes = nil
|
||||
file_api_util_proto_test_test_proto_depIdxs = nil
|
||||
File_util_proto_test_test_proto = out.File
|
||||
file_util_proto_test_test_proto_rawDesc = nil
|
||||
file_util_proto_test_test_proto_goTypes = nil
|
||||
file_util_proto_test_test_proto_depIdxs = nil
|
||||
}
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package test;
|
||||
|
||||
option go_package = "util/proto/test";
|
||||
|
||||
message Primitives {
|
||||
bytes field_a = 1;
|
||||
string field_b = 2;
|
||||
bool field_c = 200;
|
||||
int32 field_d = 201;
|
||||
uint32 field_e = 202;
|
||||
int64 field_f = 203;
|
||||
uint64 field_g = 204;
|
||||
fixed64 field_i = 205;
|
||||
double field_j = 206;
|
||||
fixed32 field_k = 207;
|
||||
|
||||
enum SomeEnum {
|
||||
UNKNOWN = 0;
|
||||
POSITIVE = 1;
|
||||
NEGATIVE = -1;
|
||||
}
|
||||
SomeEnum field_h = 300;
|
||||
|
||||
message Aux { uint32 inner_field = 1; }
|
||||
|
||||
oneof field_m {
|
||||
bytes field_ma = 401;
|
||||
uint32 field_me = 402;
|
||||
Aux field_aux = 403;
|
||||
}
|
||||
}
|
||||
|
||||
message RepPrimitives {
|
||||
repeated bytes field_a = 1;
|
||||
repeated string field_b = 2;
|
||||
repeated int32 field_c = 3;
|
||||
repeated uint32 field_d = 4;
|
||||
repeated int64 field_e = 5;
|
||||
repeated uint64 field_f = 6;
|
||||
repeated uint64 field_fu = 7 [ packed = false ];
|
||||
|
||||
message Aux { uint32 inner_field = 1; }
|
||||
repeated Aux field_aux = 8;
|
||||
}
|
12
go.mod
12
go.mod
|
@ -14,7 +14,6 @@ require (
|
|||
github.com/klauspost/reedsolomon v1.12.1
|
||||
github.com/mailru/easyjson v0.7.7
|
||||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/multiformats/go-multiaddr v0.14.0
|
||||
github.com/nspcc-dev/neo-go v0.106.2
|
||||
github.com/stretchr/testify v1.9.0
|
||||
go.uber.org/zap v1.27.0
|
||||
|
@ -30,20 +29,13 @@ require (
|
|||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
|
||||
github.com/golang/snappy v0.0.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.1 // indirect
|
||||
github.com/ipfs/go-cid v0.0.7 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/multiformats/go-base32 v0.1.0 // indirect
|
||||
github.com/multiformats/go-base36 v0.2.0 // indirect
|
||||
github.com/multiformats/go-multibase v0.2.0 // indirect
|
||||
github.com/multiformats/go-multihash v0.2.3 // indirect
|
||||
github.com/multiformats/go-varint v0.0.7 // indirect
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20240301084351-0246b013f8b2 // indirect
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20240521091047-78685785716d // indirect
|
||||
github.com/nspcc-dev/rfc6979 v0.2.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 // indirect
|
||||
github.com/twmb/murmur3 v1.1.8 // indirect
|
||||
go.etcd.io/bbolt v1.3.9 // indirect
|
||||
|
@ -54,5 +46,5 @@ require (
|
|||
golang.org/x/sys v0.21.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
|
||||
lukechampine.com/blake3 v1.2.1 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
||||
)
|
||||
|
|
39
go.sum
39
go.sum
|
@ -55,43 +55,24 @@ github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyf
|
|||
github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU=
|
||||
github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY=
|
||||
github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc=
|
||||
github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/klauspost/reedsolomon v1.12.1 h1:NhWgum1efX1x58daOBGCFWcxtEhOhXKKl1HAPQUp03Q=
|
||||
github.com/klauspost/reedsolomon v1.12.1/go.mod h1:nEi5Kjb6QqtbofI6s+cbG/j1da11c96IBYBSnVGtuBs=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ=
|
||||
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
|
||||
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
|
||||
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
|
||||
github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY=
|
||||
github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU=
|
||||
github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
|
||||
github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
|
||||
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
|
||||
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
|
||||
github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA=
|
||||
github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE=
|
||||
github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI=
|
||||
github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM=
|
||||
github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0=
|
||||
github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4=
|
||||
github.com/multiformats/go-multiaddr v0.14.0 h1:bfrHrJhrRuh/NXH5mCnemjpbGjzRw/b+tJFOD41g2tU=
|
||||
github.com/multiformats/go-multiaddr v0.14.0/go.mod h1:6EkVAxtznq2yC3QT5CM1UTAwG0GTP3EWAIcjHuzQ+r4=
|
||||
github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc=
|
||||
github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g=
|
||||
github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk=
|
||||
github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc=
|
||||
github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U=
|
||||
github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM=
|
||||
github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
||||
github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8=
|
||||
github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU=
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20240301084351-0246b013f8b2 h1:mD9hU3v+zJcnHAVmHnZKt3I++tvn30gBj2rP2PocZMk=
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20240301084351-0246b013f8b2/go.mod h1:U5VfmPNM88P4RORFb6KSUVBdJBDhlqggJZYGXGPxOcc=
|
||||
github.com/nspcc-dev/neo-go v0.106.2 h1:KXSJ2J5Oacc7LrX3r4jvnC8ihKqHs5NB21q4f2S3r9o=
|
||||
|
@ -121,8 +102,6 @@ github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k
|
|||
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
|
@ -142,7 +121,6 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8
|
|||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
||||
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
||||
|
@ -197,8 +175,9 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi
|
|||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
|
@ -209,7 +188,5 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
|
|||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI=
|
||||
lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=
|
||||
rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU=
|
||||
rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA=
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
// NOTE: code is taken from https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/df05057ed46632e7746fcaa26731987a9070b2e5/pkg/network/address.go
|
||||
|
||||
package network
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
manet "github.com/multiformats/go-multiaddr/net"
|
||||
)
|
||||
|
||||
var errHostIsEmpty = errors.New("host is empty")
|
||||
|
||||
// Address represents the FrostFS node
|
||||
// network address.
|
||||
type Address struct {
|
||||
ma multiaddr.Multiaddr
|
||||
}
|
||||
|
||||
// URIAddr returns Address as a URI.
|
||||
//
|
||||
// Panics if host address cannot be fetched from Address.
|
||||
//
|
||||
// See also FromString.
|
||||
func (a Address) URIAddr() string {
|
||||
_, host, err := manet.DialArgs(a.ma)
|
||||
if err != nil {
|
||||
// the only correct way to construct Address is AddressFromString
|
||||
// which makes this error appear unexpected
|
||||
panic(fmt.Errorf("could not get host addr: %w", err))
|
||||
}
|
||||
|
||||
if !a.IsTLSEnabled() {
|
||||
return host
|
||||
}
|
||||
|
||||
return (&url.URL{
|
||||
Scheme: "grpcs",
|
||||
Host: host,
|
||||
}).String()
|
||||
}
|
||||
|
||||
// FromString restores Address from a string representation.
|
||||
//
|
||||
// Supports URIAddr, MultiAddr and HostAddr strings.
|
||||
func (a *Address) FromString(s string) error {
|
||||
var err error
|
||||
|
||||
a.ma, err = multiaddr.NewMultiaddr(s)
|
||||
if err != nil {
|
||||
var (
|
||||
host string
|
||||
hasTLS bool
|
||||
)
|
||||
host, hasTLS, err = client.ParseURI(s)
|
||||
if err != nil {
|
||||
host = s
|
||||
}
|
||||
|
||||
s, err = multiaddrStringFromHostAddr(host)
|
||||
if err == nil {
|
||||
a.ma, err = multiaddr.NewMultiaddr(s)
|
||||
if err == nil && hasTLS {
|
||||
a.ma = a.ma.Encapsulate(tls)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// multiaddrStringFromHostAddr converts "localhost:8080" to "/dns4/localhost/tcp/8080".
|
||||
func multiaddrStringFromHostAddr(host string) (string, error) {
|
||||
if len(host) == 0 {
|
||||
return "", errHostIsEmpty
|
||||
}
|
||||
|
||||
endpoint, port, err := net.SplitHostPort(host)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Empty address in host `:8080` generates `/dns4//tcp/8080` multiaddr
|
||||
// which is invalid. It could be `/tcp/8080` but this breaks
|
||||
// `manet.DialArgs`. The solution is to manually parse it as 0.0.0.0
|
||||
if endpoint == "" {
|
||||
return "/ip4/0.0.0.0/tcp/" + port, nil
|
||||
}
|
||||
|
||||
var (
|
||||
prefix = "/dns4"
|
||||
addr = endpoint
|
||||
)
|
||||
|
||||
if ip := net.ParseIP(endpoint); ip != nil {
|
||||
addr = ip.String()
|
||||
if ip.To4() == nil {
|
||||
prefix = "/ip6"
|
||||
} else {
|
||||
prefix = "/ip4"
|
||||
}
|
||||
}
|
||||
|
||||
const l4Protocol = "tcp"
|
||||
|
||||
return strings.Join([]string{prefix, addr, l4Protocol, port}, "/"), nil
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
// NOTE: code is taken from https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/df05057ed46632e7746fcaa26731987a9070b2e5/pkg/network/address_test.go
|
||||
|
||||
package network
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestAddressFromString(t *testing.T) {
|
||||
t.Run("valid addresses", func(t *testing.T) {
|
||||
testcases := []struct {
|
||||
inp string
|
||||
exp multiaddr.Multiaddr
|
||||
}{
|
||||
{":8080", buildMultiaddr("/ip4/0.0.0.0/tcp/8080", t)},
|
||||
{"example.com:7070", buildMultiaddr("/dns4/example.com/tcp/7070", t)},
|
||||
{"213.44.87.1:32512", buildMultiaddr("/ip4/213.44.87.1/tcp/32512", t)},
|
||||
{"[2004:eb1::1]:8080", buildMultiaddr("/ip6/2004:eb1::1/tcp/8080", t)},
|
||||
{"grpc://example.com:7070", buildMultiaddr("/dns4/example.com/tcp/7070", t)},
|
||||
{"grpcs://example.com:7070", buildMultiaddr("/dns4/example.com/tcp/7070/"+tlsProtocolName, t)},
|
||||
}
|
||||
|
||||
var addr Address
|
||||
|
||||
for _, testcase := range testcases {
|
||||
err := addr.FromString(testcase.inp)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, testcase.exp, addr.ma, testcase.inp)
|
||||
}
|
||||
})
|
||||
t.Run("invalid addresses", func(t *testing.T) {
|
||||
testCases := []string{
|
||||
"wtf://example.com:123", // wrong scheme
|
||||
"grpc://example.com", // missing port
|
||||
}
|
||||
|
||||
var addr Address
|
||||
for _, tc := range testCases {
|
||||
require.Error(t, addr.FromString(tc))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestAddress_HostAddrString(t *testing.T) {
|
||||
t.Run("valid addresses", func(t *testing.T) {
|
||||
testcases := []struct {
|
||||
ma multiaddr.Multiaddr
|
||||
exp string
|
||||
}{
|
||||
{buildMultiaddr("/dns4/frostfs.bigcorp.com/tcp/8080", t), "frostfs.bigcorp.com:8080"},
|
||||
{buildMultiaddr("/ip4/172.16.14.1/tcp/8080", t), "172.16.14.1:8080"},
|
||||
{buildMultiaddr("/ip4/192.168.0.1/tcp/8888/tls", t), "grpcs://192.168.0.1:8888"},
|
||||
}
|
||||
|
||||
for _, testcase := range testcases {
|
||||
addr := Address{testcase.ma}
|
||||
|
||||
got := addr.URIAddr()
|
||||
|
||||
require.Equal(t, testcase.exp, got)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("invalid addresses", func(t *testing.T) {
|
||||
testcases := []multiaddr.Multiaddr{
|
||||
buildMultiaddr("/tcp/8080", t),
|
||||
}
|
||||
|
||||
for _, testcase := range testcases {
|
||||
addr := Address{testcase}
|
||||
require.Panics(t, func() { addr.URIAddr() })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func buildMultiaddr(s string, t *testing.T) multiaddr.Multiaddr {
|
||||
ma, err := multiaddr.NewMultiaddr(s)
|
||||
require.NoError(t, err)
|
||||
return ma
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
// NOTE: code is taken from https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/df05057ed46632e7746fcaa26731987a9070b2e5/pkg/network/tls.go
|
||||
|
||||
package network
|
||||
|
||||
import "github.com/multiformats/go-multiaddr"
|
||||
|
||||
const (
|
||||
tlsProtocolName = "tls"
|
||||
)
|
||||
|
||||
// tls var is used for (un)wrapping other multiaddrs around TLS multiaddr.
|
||||
var tls, _ = multiaddr.NewMultiaddr("/" + tlsProtocolName)
|
||||
|
||||
// IsTLSEnabled searches for wrapped TLS protocol in multiaddr.
|
||||
func (a Address) IsTLSEnabled() bool {
|
||||
_, err := a.ma.ValueForProtocol(multiaddr.P_TLS)
|
||||
return err == nil
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
// NOTE: code is taken from https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/df05057ed46632e7746fcaa26731987a9070b2e5/pkg/network/tls_test.go
|
||||
|
||||
package network
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestAddress_TLSEnabled(t *testing.T) {
|
||||
testCases := [...]struct {
|
||||
input string
|
||||
wantTLS bool
|
||||
}{
|
||||
{"/dns4/localhost/tcp/8080", false},
|
||||
{"/dns4/localhost/tcp/8080/tls", true},
|
||||
{"/tls/dns4/localhost/tcp/8080", true},
|
||||
{"grpc://localhost:8080", false},
|
||||
{"grpcs://localhost:8080", true},
|
||||
}
|
||||
|
||||
var addr Address
|
||||
|
||||
for _, test := range testCases {
|
||||
err := addr.FromString(test.input)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, test.wantTLS, addr.IsTLSEnabled(), test.input)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAddressTLSEnabled(b *testing.B) {
|
||||
var addr Address
|
||||
err := addr.FromString("/dns4/localhost/tcp/8080/tls")
|
||||
require.NoError(b, err)
|
||||
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
|
||||
var enabled bool
|
||||
for range b.N {
|
||||
enabled = addr.IsTLSEnabled()
|
||||
}
|
||||
require.True(b, enabled)
|
||||
}
|
|
@ -3211,12 +3211,11 @@ func (p *Pool) GetSplitInfo(ctx context.Context, cnrID cid.ID, objID oid.ID, tok
|
|||
_, err := p.HeadObject(ctx, prm)
|
||||
|
||||
var errSplit *object.SplitInfoError
|
||||
var errECInfo *object.ECInfoError
|
||||
|
||||
switch {
|
||||
case errors.As(err, &errSplit):
|
||||
return errSplit.SplitInfo(), nil
|
||||
case err == nil || errors.As(err, &errECInfo):
|
||||
case err == nil:
|
||||
return nil, relations.ErrNoSplitInfo
|
||||
default:
|
||||
return nil, fmt.Errorf("failed to get raw object header: %w", err)
|
||||
|
|
|
@ -14,8 +14,6 @@ import (
|
|||
rpcclient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tree"
|
||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pkg/network"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"go.uber.org/zap"
|
||||
|
@ -75,12 +73,6 @@ type InitParameters struct {
|
|||
nodeParams []pool.NodeParam
|
||||
dialOptions []grpc.DialOption
|
||||
maxRequestAttempts int
|
||||
netMapInfoSource NetMapInfoSource
|
||||
}
|
||||
|
||||
type NetMapInfoSource interface {
|
||||
NetMapSnapshot(ctx context.Context) (netmap.NetMap, error)
|
||||
PlacementPolicy(ctx context.Context, cnrID cid.ID) (netmap.PlacementPolicy, error)
|
||||
}
|
||||
|
||||
// Pool represents virtual connection to the FrostFS tree services network to communicate
|
||||
|
@ -88,7 +80,7 @@ type NetMapInfoSource interface {
|
|||
// due to their unavailability.
|
||||
//
|
||||
// Pool can be created and initialized using NewPool function.
|
||||
// Before executing the FrostFS tree operations using the Pool without netMapInfoSource, connection to the
|
||||
// Before executing the FrostFS tree operations using the Pool, connection to the
|
||||
// servers MUST BE correctly established (see Dial method).
|
||||
type Pool struct {
|
||||
innerPools []*innerPool
|
||||
|
@ -104,18 +96,12 @@ type Pool struct {
|
|||
streamTimeout time.Duration
|
||||
nodeDialTimeout time.Duration
|
||||
|
||||
netMapInfoSource NetMapInfoSource
|
||||
|
||||
// mutex protects clientMap and startIndices
|
||||
mutex sync.RWMutex
|
||||
// clientMap will be used if netMapInfoSource is set
|
||||
clientMap map[uint64]client
|
||||
startIndicesMtx sync.RWMutex
|
||||
// startIndices points to the client from which the next request will be executed.
|
||||
// Since clients are stored in innerPool field we have to use two indices.
|
||||
// These indices being changed during:
|
||||
// * rebalance procedure (see Pool.startRebalance)
|
||||
// * retry in case of request failure (see Pool.requestWithRetry)
|
||||
// startIndices will be used if netMapInfoSource is not set
|
||||
startIndices [2]int
|
||||
}
|
||||
|
||||
|
@ -227,6 +213,11 @@ func NewPool(options InitParameters) (*Pool, error) {
|
|||
return nil, fmt.Errorf("missed required parameter 'Key'")
|
||||
}
|
||||
|
||||
nodesParams, err := adjustNodeParams(options.nodeParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fillDefaultInitParams(&options)
|
||||
|
||||
methods := make([]*pool.MethodStatus, methodLast)
|
||||
|
@ -239,44 +230,27 @@ func NewPool(options InitParameters) (*Pool, error) {
|
|||
logger: options.logger,
|
||||
dialOptions: options.dialOptions,
|
||||
rebalanceParams: rebalanceParameters{
|
||||
nodesGroup: nodesParams,
|
||||
nodeRequestTimeout: options.healthcheckTimeout,
|
||||
clientRebalanceInterval: options.clientRebalanceInterval,
|
||||
},
|
||||
maxRequestAttempts: options.maxRequestAttempts,
|
||||
streamTimeout: options.nodeStreamTimeout,
|
||||
nodeDialTimeout: options.nodeDialTimeout,
|
||||
methods: methods,
|
||||
netMapInfoSource: options.netMapInfoSource,
|
||||
clientMap: make(map[uint64]client),
|
||||
}
|
||||
|
||||
if options.netMapInfoSource == nil {
|
||||
nodesParams, err := adjustNodeParams(options.nodeParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.rebalanceParams.nodesGroup = nodesParams
|
||||
}
|
||||
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// Dial may not be called and will have no effect if netMapInfoSource is set.
|
||||
// See also InitParameters.SetNetMapInfoSource
|
||||
//
|
||||
// Otherwise, Dial establishes a connection to the tree servers from the FrostFS network.
|
||||
// Dial establishes a connection to the tree servers from the FrostFS network.
|
||||
// It also starts a routine that checks the health of the nodes and
|
||||
// updates the weights of the nodes for balancing.
|
||||
// Returns an error describing failure reason.
|
||||
//
|
||||
// If failed and netMapInfoSource is not set, the Pool SHOULD NOT be used.
|
||||
// If failed, the Pool SHOULD NOT be used.
|
||||
//
|
||||
// See also InitParameters.SetClientRebalanceInterval.
|
||||
func (p *Pool) Dial(ctx context.Context) error {
|
||||
if p.netMapInfoSource != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
inner := make([]*innerPool, len(p.rebalanceParams.nodesGroup))
|
||||
var atLeastOneHealthy bool
|
||||
|
||||
|
@ -360,12 +334,6 @@ func (x *InitParameters) SetMaxRequestAttempts(maxAttempts int) {
|
|||
x.maxRequestAttempts = maxAttempts
|
||||
}
|
||||
|
||||
// SetNetMapInfoSource sets implementation of interface to get current net map and container placement policy.
|
||||
// If set, AddNode will have no effect.
|
||||
func (x *InitParameters) SetNetMapInfoSource(netMapInfoSource NetMapInfoSource) {
|
||||
x.netMapInfoSource = netMapInfoSource
|
||||
}
|
||||
|
||||
// GetNodes invokes eponymous method from TreeServiceClient.
|
||||
//
|
||||
// Can return predefined errors:
|
||||
|
@ -391,7 +359,7 @@ func (p *Pool) GetNodes(ctx context.Context, prm GetNodesParams) ([]*tree.GetNod
|
|||
}
|
||||
|
||||
var resp *tree.GetNodeByPathResponse
|
||||
err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) (inErr error) {
|
||||
err := p.requestWithRetry(ctx, func(client *rpcclient.Client) (inErr error) {
|
||||
resp, inErr = rpcapi.GetNodeByPath(client, request, rpcclient.WithContext(ctx))
|
||||
// Pool wants to do retry 'GetNodeByPath' request if result is empty.
|
||||
// Empty result is expected due to delayed tree service sync.
|
||||
|
@ -495,7 +463,7 @@ func (p *Pool) GetSubTree(ctx context.Context, prm GetSubTreeParams) (*SubTreeRe
|
|||
}
|
||||
|
||||
var cli *rpcapi.GetSubTreeResponseReader
|
||||
err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) (inErr error) {
|
||||
err := p.requestWithRetry(ctx, func(client *rpcclient.Client) (inErr error) {
|
||||
cli, inErr = rpcapi.GetSubTree(client, request, rpcclient.WithContext(ctx))
|
||||
return handleError("failed to get sub tree client", inErr)
|
||||
})
|
||||
|
@ -529,7 +497,7 @@ func (p *Pool) AddNode(ctx context.Context, prm AddNodeParams) (uint64, error) {
|
|||
}
|
||||
|
||||
var resp *tree.AddResponse
|
||||
err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) (inErr error) {
|
||||
err := p.requestWithRetry(ctx, func(client *rpcclient.Client) (inErr error) {
|
||||
resp, inErr = rpcapi.Add(client, request, rpcclient.WithContext(ctx))
|
||||
return handleError("failed to add node", inErr)
|
||||
})
|
||||
|
@ -564,7 +532,7 @@ func (p *Pool) AddNodeByPath(ctx context.Context, prm AddNodeByPathParams) (uint
|
|||
}
|
||||
|
||||
var resp *tree.AddByPathResponse
|
||||
err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) (inErr error) {
|
||||
err := p.requestWithRetry(ctx, func(client *rpcclient.Client) (inErr error) {
|
||||
resp, inErr = rpcapi.AddByPath(client, request, rpcclient.WithContext(ctx))
|
||||
return handleError("failed to add node by path", inErr)
|
||||
})
|
||||
|
@ -606,7 +574,7 @@ func (p *Pool) MoveNode(ctx context.Context, prm MoveNodeParams) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) error {
|
||||
err := p.requestWithRetry(ctx, func(client *rpcclient.Client) error {
|
||||
if _, err := rpcapi.Move(client, request, rpcclient.WithContext(ctx)); err != nil {
|
||||
return handleError("failed to move node", err)
|
||||
}
|
||||
|
@ -637,7 +605,7 @@ func (p *Pool) RemoveNode(ctx context.Context, prm RemoveNodeParams) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) error {
|
||||
err := p.requestWithRetry(ctx, func(client *rpcclient.Client) error {
|
||||
if _, err := rpcapi.Remove(client, request, rpcclient.WithContext(ctx)); err != nil {
|
||||
return handleError("failed to remove node", err)
|
||||
}
|
||||
|
@ -663,24 +631,6 @@ func (p *Pool) Close() error {
|
|||
}
|
||||
}
|
||||
|
||||
if closeErr := p.closeClientMapConnections(); closeErr != nil {
|
||||
err = closeErr
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *Pool) closeClientMapConnections() (err error) {
|
||||
p.mutex.Lock()
|
||||
defer p.mutex.Unlock()
|
||||
|
||||
for _, cl := range p.clientMap {
|
||||
if closeErr := cl.close(); closeErr != nil {
|
||||
p.log(zapcore.ErrorLevel, "close client connection", zap.Error(closeErr))
|
||||
err = closeErr
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -851,24 +801,20 @@ func (p *Pool) updateInnerNodesHealth(ctx context.Context, i int, buffer []bool)
|
|||
}
|
||||
|
||||
func (p *Pool) getStartIndices() (int, int) {
|
||||
p.mutex.RLock()
|
||||
defer p.mutex.RUnlock()
|
||||
p.startIndicesMtx.RLock()
|
||||
defer p.startIndicesMtx.RUnlock()
|
||||
|
||||
return p.startIndices[0], p.startIndices[1]
|
||||
}
|
||||
|
||||
func (p *Pool) setStartIndices(i, j int) {
|
||||
p.mutex.Lock()
|
||||
p.startIndicesMtx.Lock()
|
||||
p.startIndices[0] = i
|
||||
p.startIndices[1] = j
|
||||
p.mutex.Unlock()
|
||||
p.startIndicesMtx.Unlock()
|
||||
}
|
||||
|
||||
func (p *Pool) requestWithRetry(ctx context.Context, cnrID cid.ID, fn func(client *rpcclient.Client) error) error {
|
||||
if p.netMapInfoSource != nil {
|
||||
return p.requestWithRetryContainerNodes(ctx, cnrID, fn)
|
||||
}
|
||||
|
||||
func (p *Pool) requestWithRetry(ctx context.Context, fn func(client *rpcclient.Client) error) error {
|
||||
var (
|
||||
err, finErr error
|
||||
cl *rpcclient.Client
|
||||
|
@ -920,141 +866,10 @@ LOOP:
|
|||
return finErr
|
||||
}
|
||||
|
||||
func (p *Pool) requestWithRetryContainerNodes(ctx context.Context, cnrID cid.ID, fn func(client *rpcclient.Client) error) error {
|
||||
var (
|
||||
err, finErr error
|
||||
cl *rpcclient.Client
|
||||
)
|
||||
|
||||
reqID := GetRequestID(ctx)
|
||||
|
||||
netMap, err := p.netMapInfoSource.NetMapSnapshot(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get net map: %w", err)
|
||||
}
|
||||
|
||||
policy, err := p.netMapInfoSource.PlacementPolicy(ctx, cnrID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get container placement policy: %w", err)
|
||||
}
|
||||
|
||||
cnrNodes, err := netMap.ContainerNodes(policy, cnrID[:])
|
||||
if err != nil {
|
||||
return fmt.Errorf("get container nodes: %w", err)
|
||||
}
|
||||
|
||||
cnrNodes, err = netMap.PlacementVectors(cnrNodes, cnrID[:])
|
||||
if err != nil {
|
||||
return fmt.Errorf("get placement vectors: %w", err)
|
||||
}
|
||||
|
||||
attempts := p.maxRequestAttempts
|
||||
|
||||
LOOP:
|
||||
for _, cnrNodeGroup := range cnrNodes {
|
||||
for _, cnrNode := range cnrNodeGroup {
|
||||
if attempts == 0 {
|
||||
break LOOP
|
||||
}
|
||||
|
||||
treeCl, ok := p.getClientFromMap(cnrNode.Hash())
|
||||
if !ok {
|
||||
treeCl, err = p.getNewTreeClient(ctx, cnrNode)
|
||||
if err != nil {
|
||||
finErr = finalError(finErr, err)
|
||||
p.log(zap.DebugLevel, "failed to create tree client", zap.String("request_id", reqID), zap.Int("remaining attempts", attempts))
|
||||
continue
|
||||
}
|
||||
|
||||
p.addClientToMap(cnrNode.Hash(), treeCl)
|
||||
}
|
||||
attempts--
|
||||
|
||||
if cl, err = treeCl.serviceClient(); err == nil {
|
||||
err = fn(cl)
|
||||
}
|
||||
if shouldRedial(ctx, err) {
|
||||
p.deleteClientFromMap(cnrNode.Hash())
|
||||
}
|
||||
if !shouldTryAgain(err) {
|
||||
if err != nil {
|
||||
err = fmt.Errorf("address %s: %w", treeCl.endpoint(), err)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
finErr = finalError(finErr, err)
|
||||
p.log(zap.DebugLevel, "tree request error", zap.String("request_id", reqID), zap.Int("remaining attempts", attempts),
|
||||
zap.String("address", treeCl.endpoint()), zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
return finErr
|
||||
}
|
||||
|
||||
func (p *Pool) getClientFromMap(hash uint64) (client, bool) {
|
||||
p.mutex.RLock()
|
||||
defer p.mutex.RUnlock()
|
||||
|
||||
cl, ok := p.clientMap[hash]
|
||||
return cl, ok
|
||||
}
|
||||
|
||||
func (p *Pool) addClientToMap(hash uint64, cl client) {
|
||||
p.mutex.Lock()
|
||||
p.clientMap[hash] = cl
|
||||
p.mutex.Unlock()
|
||||
}
|
||||
|
||||
func (p *Pool) deleteClientFromMap(hash uint64) {
|
||||
p.mutex.Lock()
|
||||
_ = p.clientMap[hash].close()
|
||||
delete(p.clientMap, hash)
|
||||
p.mutex.Unlock()
|
||||
}
|
||||
|
||||
func (p *Pool) getNewTreeClient(ctx context.Context, node netmap.NodeInfo) (*treeClient, error) {
|
||||
var (
|
||||
treeCl *treeClient
|
||||
err error
|
||||
)
|
||||
|
||||
node.IterateNetworkEndpoints(func(endpoint string) bool {
|
||||
var addr network.Address
|
||||
if err = addr.FromString(endpoint); err != nil {
|
||||
p.log(zap.WarnLevel, "can't parse endpoint", zap.String("endpoint", endpoint), zap.Error(err))
|
||||
return false
|
||||
}
|
||||
|
||||
newTreeCl := newTreeClient(addr.URIAddr(), p.dialOptions, p.nodeDialTimeout, p.streamTimeout)
|
||||
if err = newTreeCl.dial(ctx); err != nil {
|
||||
p.log(zap.WarnLevel, "failed to dial tree client", zap.String("address", addr.URIAddr()), zap.Error(err))
|
||||
return false
|
||||
}
|
||||
|
||||
treeCl = newTreeCl
|
||||
return true
|
||||
})
|
||||
|
||||
if treeCl == nil {
|
||||
return nil, fmt.Errorf("tree client wasn't initialized")
|
||||
}
|
||||
|
||||
return treeCl, nil
|
||||
}
|
||||
|
||||
func shouldTryAgain(err error) bool {
|
||||
return !(err == nil || errors.Is(err, ErrNodeAccessDenied))
|
||||
}
|
||||
|
||||
func shouldRedial(ctx context.Context, err error) bool {
|
||||
if err == nil || errors.Is(err, ErrNodeAccessDenied) || errors.Is(err, ErrNodeNotFound) || errors.Is(err, errNodeEmptyResult) || errors.Is(ctx.Err(), context.Canceled) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func prioErr(err error) int {
|
||||
switch {
|
||||
case err == nil:
|
||||
|
|
|
@ -7,12 +7,7 @@ import (
|
|||
|
||||
rpcClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client"
|
||||
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
|
||||
"git.frostfs.info/TrueCloudLab/hrw"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap/zaptest"
|
||||
)
|
||||
|
@ -20,14 +15,12 @@ import (
|
|||
type treeClientMock struct {
|
||||
address string
|
||||
err bool
|
||||
used bool
|
||||
}
|
||||
|
||||
func (t *treeClientMock) serviceClient() (*rpcClient.Client, error) {
|
||||
if t.err {
|
||||
return nil, errors.New("serviceClient() mock error")
|
||||
}
|
||||
t.used = true
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
@ -58,23 +51,6 @@ func (t *treeClientMock) close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
type netMapInfoMock struct {
|
||||
netMap netmap.NetMap
|
||||
policy netmap.PlacementPolicy
|
||||
err error
|
||||
}
|
||||
|
||||
func (n *netMapInfoMock) NetMapSnapshot(context.Context) (netmap.NetMap, error) {
|
||||
if n.err != nil {
|
||||
return netmap.NetMap{}, n.err
|
||||
}
|
||||
return n.netMap, nil
|
||||
}
|
||||
|
||||
func (n *netMapInfoMock) PlacementPolicy(context.Context, cid.ID) (netmap.PlacementPolicy, error) {
|
||||
return n.policy, nil
|
||||
}
|
||||
|
||||
func TestHandleError(t *testing.T) {
|
||||
defaultError := errors.New("default error")
|
||||
for _, tc := range []struct {
|
||||
|
@ -128,14 +104,14 @@ func TestRetry(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run("first ok", func(t *testing.T) {
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err := p.requestWithRetry(ctx, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkIndicesAndReset(t, p, 0, 0)
|
||||
})
|
||||
|
||||
t.Run("first failed", func(t *testing.T) {
|
||||
setErrors(p, "node00")
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err := p.requestWithRetry(ctx, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkIndicesAndReset(t, p, 0, 1)
|
||||
})
|
||||
|
@ -143,7 +119,7 @@ func TestRetry(t *testing.T) {
|
|||
t.Run("all failed", func(t *testing.T) {
|
||||
setErrors(p, nodes[0]...)
|
||||
setErrors(p, nodes[1]...)
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err := p.requestWithRetry(ctx, makeFn)
|
||||
require.Error(t, err)
|
||||
checkIndicesAndReset(t, p, 0, 0)
|
||||
})
|
||||
|
@ -151,13 +127,13 @@ func TestRetry(t *testing.T) {
|
|||
t.Run("round", func(t *testing.T) {
|
||||
setErrors(p, nodes[0][0], nodes[0][1])
|
||||
setErrors(p, nodes[1]...)
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err := p.requestWithRetry(ctx, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkIndices(t, p, 0, 2)
|
||||
resetClientsErrors(p)
|
||||
|
||||
setErrors(p, nodes[0][2], nodes[0][3])
|
||||
err = p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err = p.requestWithRetry(ctx, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkIndicesAndReset(t, p, 0, 0)
|
||||
})
|
||||
|
@ -165,14 +141,14 @@ func TestRetry(t *testing.T) {
|
|||
t.Run("group switch", func(t *testing.T) {
|
||||
setErrors(p, nodes[0]...)
|
||||
setErrors(p, nodes[1][0])
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err := p.requestWithRetry(ctx, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkIndicesAndReset(t, p, 1, 1)
|
||||
})
|
||||
|
||||
t.Run("group round", func(t *testing.T) {
|
||||
setErrors(p, nodes[0][1:]...)
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err := p.requestWithRetry(ctx, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkIndicesAndReset(t, p, 0, 0)
|
||||
})
|
||||
|
@ -180,7 +156,7 @@ func TestRetry(t *testing.T) {
|
|||
t.Run("group round switch", func(t *testing.T) {
|
||||
setErrors(p, nodes[0]...)
|
||||
p.setStartIndices(0, 1)
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err := p.requestWithRetry(ctx, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkIndicesAndReset(t, p, 1, 0)
|
||||
})
|
||||
|
@ -188,14 +164,14 @@ func TestRetry(t *testing.T) {
|
|||
t.Run("no panic group switch", func(t *testing.T) {
|
||||
setErrors(p, nodes[1]...)
|
||||
p.setStartIndices(1, 0)
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err := p.requestWithRetry(ctx, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkIndicesAndReset(t, p, 0, 0)
|
||||
})
|
||||
|
||||
t.Run("error empty result", func(t *testing.T) {
|
||||
errNodes, index := 2, 0
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), func(client *rpcClient.Client) error {
|
||||
err := p.requestWithRetry(ctx, func(client *rpcClient.Client) error {
|
||||
if index < errNodes {
|
||||
index++
|
||||
return errNodeEmptyResult
|
||||
|
@ -208,7 +184,7 @@ func TestRetry(t *testing.T) {
|
|||
|
||||
t.Run("error not found", func(t *testing.T) {
|
||||
errNodes, index := 2, 0
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), func(client *rpcClient.Client) error {
|
||||
err := p.requestWithRetry(ctx, func(client *rpcClient.Client) error {
|
||||
if index < errNodes {
|
||||
index++
|
||||
return ErrNodeNotFound
|
||||
|
@ -221,7 +197,7 @@ func TestRetry(t *testing.T) {
|
|||
|
||||
t.Run("error access denied", func(t *testing.T) {
|
||||
var index int
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), func(client *rpcClient.Client) error {
|
||||
err := p.requestWithRetry(ctx, func(client *rpcClient.Client) error {
|
||||
index++
|
||||
return ErrNodeAccessDenied
|
||||
})
|
||||
|
@ -235,7 +211,7 @@ func TestRetry(t *testing.T) {
|
|||
p.maxRequestAttempts = 2
|
||||
setErrors(p, nodes[0]...)
|
||||
setErrors(p, nodes[1]...)
|
||||
err := p.requestWithRetry(ctx, cidtest.ID(), makeFn)
|
||||
err := p.requestWithRetry(ctx, makeFn)
|
||||
require.Error(t, err)
|
||||
checkIndicesAndReset(t, p, 0, 2)
|
||||
p.maxRequestAttempts = oldVal
|
||||
|
@ -297,125 +273,6 @@ func TestRebalance(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRetryContainerNodes(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
nodesCount := 3
|
||||
policy := getPlacementPolicy(uint32(nodesCount))
|
||||
p := &Pool{
|
||||
logger: zaptest.NewLogger(t),
|
||||
maxRequestAttempts: nodesCount,
|
||||
}
|
||||
|
||||
var nm netmap.NetMap
|
||||
for i := 0; i < nodesCount; i++ {
|
||||
key, err := keys.NewPrivateKey()
|
||||
require.NoError(t, err)
|
||||
nm.SetNodes(append(nm.Nodes(), getNodeInfo(key.Bytes())))
|
||||
}
|
||||
p.netMapInfoSource = &netMapInfoMock{netMap: nm, policy: policy}
|
||||
|
||||
cnrID := cidtest.ID()
|
||||
cnrNodes, err := nm.ContainerNodes(policy, cnrID[:])
|
||||
require.NoError(t, err)
|
||||
cnrNodes, err = nm.PlacementVectors(cnrNodes, cnrID[:])
|
||||
require.NoError(t, err)
|
||||
require.Len(t, cnrNodes, 1)
|
||||
require.Len(t, cnrNodes[0], nodesCount)
|
||||
|
||||
makeFn := func(client *rpcClient.Client) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
t.Run("first ok", func(t *testing.T) {
|
||||
p.clientMap = makeClientMap(cnrNodes[0])
|
||||
err = p.requestWithRetry(ctx, cnrID, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkClientsUsage(t, p, cnrNodes[0][0])
|
||||
checkClientsPresence(t, p, cnrNodes[0]...)
|
||||
})
|
||||
|
||||
t.Run("first failed", func(t *testing.T) {
|
||||
p.clientMap = makeClientMap(cnrNodes[0])
|
||||
setClientMapErrors(p, cnrNodes[0][0])
|
||||
err = p.requestWithRetry(ctx, cnrID, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkClientsUsage(t, p, cnrNodes[0][1])
|
||||
checkClientsPresence(t, p, cnrNodes[0][1:]...)
|
||||
})
|
||||
|
||||
t.Run("first two failed", func(t *testing.T) {
|
||||
p.clientMap = makeClientMap(cnrNodes[0])
|
||||
setClientMapErrors(p, cnrNodes[0][0], cnrNodes[0][1])
|
||||
err = p.requestWithRetry(ctx, cnrID, makeFn)
|
||||
require.NoError(t, err)
|
||||
checkClientsUsage(t, p, cnrNodes[0][2])
|
||||
checkClientsPresence(t, p, cnrNodes[0][2])
|
||||
})
|
||||
|
||||
t.Run("all failed", func(t *testing.T) {
|
||||
p.clientMap = makeClientMap(cnrNodes[0])
|
||||
setClientMapErrors(p, cnrNodes[0][0], cnrNodes[0][1], cnrNodes[0][2])
|
||||
err = p.requestWithRetry(ctx, cnrID, makeFn)
|
||||
require.Error(t, err)
|
||||
checkClientsUsage(t, p)
|
||||
checkClientsPresence(t, p)
|
||||
})
|
||||
|
||||
t.Run("error empty result", func(t *testing.T) {
|
||||
p.clientMap = makeClientMap(cnrNodes[0])
|
||||
errNodes, index := 2, 0
|
||||
err = p.requestWithRetry(ctx, cnrID, func(client *rpcClient.Client) error {
|
||||
if index < errNodes {
|
||||
index++
|
||||
return errNodeEmptyResult
|
||||
}
|
||||
return nil
|
||||
})
|
||||
require.NoError(t, err)
|
||||
checkClientsUsage(t, p, cnrNodes[0][:errNodes+1]...)
|
||||
checkClientsPresence(t, p, cnrNodes[0]...)
|
||||
})
|
||||
|
||||
t.Run("error not found", func(t *testing.T) {
|
||||
p.clientMap = makeClientMap(cnrNodes[0])
|
||||
errNodes, index := 2, 0
|
||||
err = p.requestWithRetry(ctx, cnrID, func(client *rpcClient.Client) error {
|
||||
if index < errNodes {
|
||||
index++
|
||||
return ErrNodeNotFound
|
||||
}
|
||||
return nil
|
||||
})
|
||||
require.NoError(t, err)
|
||||
checkClientsUsage(t, p, cnrNodes[0][:errNodes+1]...)
|
||||
checkClientsPresence(t, p, cnrNodes[0]...)
|
||||
})
|
||||
|
||||
t.Run("error access denied", func(t *testing.T) {
|
||||
p.clientMap = makeClientMap(cnrNodes[0])
|
||||
var index int
|
||||
err = p.requestWithRetry(ctx, cnrID, func(client *rpcClient.Client) error {
|
||||
index++
|
||||
return ErrNodeAccessDenied
|
||||
})
|
||||
require.ErrorIs(t, err, ErrNodeAccessDenied)
|
||||
require.Equal(t, 1, index)
|
||||
checkClientsUsage(t, p, cnrNodes[0][0])
|
||||
checkClientsPresence(t, p, cnrNodes[0]...)
|
||||
})
|
||||
|
||||
t.Run("limit attempts", func(t *testing.T) {
|
||||
p.clientMap = makeClientMap(cnrNodes[0])
|
||||
p.maxRequestAttempts = 2
|
||||
setClientMapErrors(p, cnrNodes[0][0], cnrNodes[0][1])
|
||||
err = p.requestWithRetry(ctx, cnrID, makeFn)
|
||||
require.Error(t, err)
|
||||
checkClientsUsage(t, p)
|
||||
checkClientsPresence(t, p, cnrNodes[0][2])
|
||||
p.maxRequestAttempts = nodesCount
|
||||
})
|
||||
}
|
||||
|
||||
func makeInnerPool(nodes [][]string) []*innerPool {
|
||||
res := make([]*innerPool, len(nodes))
|
||||
|
||||
|
@ -502,59 +359,3 @@ func containsStr(list []string, item string) bool {
|
|||
|
||||
return false
|
||||
}
|
||||
|
||||
func makeClientMap(nodes []netmap.NodeInfo) map[uint64]client {
|
||||
res := make(map[uint64]client, len(nodes))
|
||||
for _, node := range nodes {
|
||||
res[hrw.Hash(node.PublicKey())] = &treeClientMock{}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func checkClientsPresence(t *testing.T, p *Pool, nodes ...netmap.NodeInfo) {
|
||||
require.Len(t, p.clientMap, len(nodes))
|
||||
for _, node := range nodes {
|
||||
require.NotNil(t, p.clientMap[hrw.Hash(node.PublicKey())])
|
||||
}
|
||||
}
|
||||
|
||||
func checkClientsUsage(t *testing.T, p *Pool, nodes ...netmap.NodeInfo) {
|
||||
for hash, cl := range p.clientMap {
|
||||
if containsHash(nodes, hash) {
|
||||
require.True(t, cl.(*treeClientMock).used)
|
||||
} else {
|
||||
require.False(t, cl.(*treeClientMock).used)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setClientMapErrors(p *Pool, nodes ...netmap.NodeInfo) {
|
||||
for hash, cl := range p.clientMap {
|
||||
if containsHash(nodes, hash) {
|
||||
cl.(*treeClientMock).err = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func containsHash(list []netmap.NodeInfo, hash uint64) bool {
|
||||
for i := range list {
|
||||
if hrw.Hash(list[i].PublicKey()) == hash {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func getPlacementPolicy(replicas uint32) (p netmap.PlacementPolicy) {
|
||||
var r netmap.ReplicaDescriptor
|
||||
r.SetNumberOfObjects(replicas)
|
||||
p.AddReplicas([]netmap.ReplicaDescriptor{r}...)
|
||||
return p
|
||||
}
|
||||
|
||||
func getNodeInfo(key []byte) netmap.NodeInfo {
|
||||
var node netmap.NodeInfo
|
||||
node.SetPublicKey(key)
|
||||
return node
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue