forked from TrueCloudLab/frostfs-api-go
[#20] Remove storage groups
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
d989c8d2a3
commit
022f818735
8 changed files with 0 additions and 480 deletions
|
@ -1,59 +0,0 @@
|
||||||
package storagegroup
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
|
||||||
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
|
||||||
sg "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (s *StorageGroup) ToGRPCMessage() grpc.Message {
|
|
||||||
m := new(sg.StorageGroup)
|
|
||||||
|
|
||||||
if s != nil {
|
|
||||||
m = new(sg.StorageGroup)
|
|
||||||
|
|
||||||
m.SetMembers(refs.ObjectIDListToGRPCMessage(s.members))
|
|
||||||
//nolint:staticcheck
|
|
||||||
m.SetExpirationEpoch(s.exp)
|
|
||||||
m.SetValidationDataSize(s.size)
|
|
||||||
m.SetValidationHash(s.hash.ToGRPCMessage().(*refsGRPC.Checksum))
|
|
||||||
}
|
|
||||||
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *StorageGroup) FromGRPCMessage(m grpc.Message) error {
|
|
||||||
v, ok := m.(*sg.StorageGroup)
|
|
||||||
if !ok {
|
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error
|
|
||||||
|
|
||||||
hash := v.GetValidationHash()
|
|
||||||
if hash == nil {
|
|
||||||
s.hash = nil
|
|
||||||
} else {
|
|
||||||
if s.hash == nil {
|
|
||||||
s.hash = new(refs.Checksum)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = s.hash.FromGRPCMessage(hash)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s.members, err = refs.ObjectIDListFromGRPCMessage(v.GetMembers())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
//nolint:staticcheck
|
|
||||||
s.exp = v.GetExpirationEpoch()
|
|
||||||
s.size = v.GetValidationDataSize()
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package storagegroup
|
|
||||||
|
|
||||||
import (
|
|
||||||
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SetValidationDataSize sets the total size of the payloads of the storage group.
|
|
||||||
func (m *StorageGroup) SetValidationDataSize(v uint64) {
|
|
||||||
m.ValidationDataSize = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetValidationHash sets total homomorphic hash of the storage group payloads.
|
|
||||||
func (m *StorageGroup) SetValidationHash(v *refs.Checksum) {
|
|
||||||
m.ValidationHash = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetExpirationEpoch sets number of the last epoch of the storage group lifetime.
|
|
||||||
//
|
|
||||||
// Deprecated: do not use, `expiration_epoch` field is deprecated in protocol.
|
|
||||||
func (m *StorageGroup) SetExpirationEpoch(v uint64) {
|
|
||||||
m.ExpirationEpoch = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetMembers sets list of the identifiers of the storage group members.
|
|
||||||
func (m *StorageGroup) SetMembers(v []*refs.ObjectID) {
|
|
||||||
m.Members = v
|
|
||||||
}
|
|
211
storagegroup/grpc/types.pb.go
generated
211
storagegroup/grpc/types.pb.go
generated
|
@ -1,211 +0,0 @@
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
||||||
// versions:
|
|
||||||
// protoc-gen-go v1.28.1
|
|
||||||
// protoc v3.21.9
|
|
||||||
// source: storagegroup/grpc/types.proto
|
|
||||||
|
|
||||||
package storagegroup
|
|
||||||
|
|
||||||
import (
|
|
||||||
grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
||||||
reflect "reflect"
|
|
||||||
sync "sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Verify that this generated code is sufficiently up-to-date.
|
|
||||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
||||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
||||||
)
|
|
||||||
|
|
||||||
// StorageGroup keeps verification information for Data Audit sessions. Objects
|
|
||||||
// that require paid storage guarantees are gathered in `StorageGroups` with
|
|
||||||
// additional information used for the proof of storage. `StorageGroup` only
|
|
||||||
// contains objects from the same container.
|
|
||||||
//
|
|
||||||
// Being an object payload, StorageGroup may have expiration Epoch set with
|
|
||||||
// `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) well-known attribute. When expired, StorageGroup
|
|
||||||
// will be ignored by InnerRing nodes during Data Audit cycles and will be
|
|
||||||
// deleted by Storage Nodes.
|
|
||||||
type StorageGroup struct {
|
|
||||||
state protoimpl.MessageState
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Total size of the payloads of objects in the storage group
|
|
||||||
ValidationDataSize uint64 `protobuf:"varint,1,opt,name=validation_data_size,json=validationDataSize,proto3" json:"validation_data_size,omitempty"`
|
|
||||||
// Homomorphic hash from the concatenation of the payloads of the storage
|
|
||||||
// group members. The order of concatenation is the same as the order of the
|
|
||||||
// members in the `members` field.
|
|
||||||
ValidationHash *grpc.Checksum `protobuf:"bytes,2,opt,name=validation_hash,json=validationHash,proto3" json:"validation_hash,omitempty"`
|
|
||||||
// DEPRECATED. Last NeoFS epoch number of the storage group lifetime
|
|
||||||
//
|
|
||||||
// Deprecated: Do not use.
|
|
||||||
ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"`
|
|
||||||
// Strictly ordered list of storage group member objects. Members MUST be unique
|
|
||||||
Members []*grpc.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *StorageGroup) Reset() {
|
|
||||||
*x = StorageGroup{}
|
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_storagegroup_grpc_types_proto_msgTypes[0]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *StorageGroup) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*StorageGroup) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *StorageGroup) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_storagegroup_grpc_types_proto_msgTypes[0]
|
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use StorageGroup.ProtoReflect.Descriptor instead.
|
|
||||||
func (*StorageGroup) Descriptor() ([]byte, []int) {
|
|
||||||
return file_storagegroup_grpc_types_proto_rawDescGZIP(), []int{0}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *StorageGroup) GetValidationDataSize() uint64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.ValidationDataSize
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *StorageGroup) GetValidationHash() *grpc.Checksum {
|
|
||||||
if x != nil {
|
|
||||||
return x.ValidationHash
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Do not use.
|
|
||||||
func (x *StorageGroup) GetExpirationEpoch() uint64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.ExpirationEpoch
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *StorageGroup) GetMembers() []*grpc.ObjectID {
|
|
||||||
if x != nil {
|
|
||||||
return x.Members
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var File_storagegroup_grpc_types_proto protoreflect.FileDescriptor
|
|
||||||
|
|
||||||
var file_storagegroup_grpc_types_proto_rawDesc = []byte{
|
|
||||||
0x0a, 0x1d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67,
|
|
||||||
0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
|
||||||
0x16, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61,
|
|
||||||
0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x15, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72,
|
|
||||||
0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6,
|
|
||||||
0x01, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12,
|
|
||||||
0x30, 0x0a, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61,
|
|
||||||
0x74, 0x61, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x12, 0x76,
|
|
||||||
0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x53, 0x69, 0x7a,
|
|
||||||
0x65, 0x12, 0x41, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
|
|
||||||
0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f,
|
|
||||||
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63,
|
|
||||||
0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
|
||||||
0x48, 0x61, 0x73, 0x68, 0x12, 0x2d, 0x0a, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69,
|
|
||||||
0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x02,
|
|
||||||
0x18, 0x01, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70,
|
|
||||||
0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x04,
|
|
||||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
|
|
||||||
0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x07,
|
|
||||||
0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0x73, 0x5a, 0x4e, 0x67, 0x69, 0x74, 0x2e, 0x66,
|
|
||||||
0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65,
|
|
||||||
0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73,
|
|
||||||
0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61,
|
|
||||||
0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x6f,
|
|
||||||
0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0xaa, 0x02, 0x20, 0x4e, 0x65, 0x6f, 0x2e,
|
|
||||||
0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e,
|
|
||||||
0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72,
|
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
file_storagegroup_grpc_types_proto_rawDescOnce sync.Once
|
|
||||||
file_storagegroup_grpc_types_proto_rawDescData = file_storagegroup_grpc_types_proto_rawDesc
|
|
||||||
)
|
|
||||||
|
|
||||||
func file_storagegroup_grpc_types_proto_rawDescGZIP() []byte {
|
|
||||||
file_storagegroup_grpc_types_proto_rawDescOnce.Do(func() {
|
|
||||||
file_storagegroup_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_storagegroup_grpc_types_proto_rawDescData)
|
|
||||||
})
|
|
||||||
return file_storagegroup_grpc_types_proto_rawDescData
|
|
||||||
}
|
|
||||||
|
|
||||||
var file_storagegroup_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
|
||||||
var file_storagegroup_grpc_types_proto_goTypes = []interface{}{
|
|
||||||
(*StorageGroup)(nil), // 0: neo.fs.v2.storagegroup.StorageGroup
|
|
||||||
(*grpc.Checksum)(nil), // 1: neo.fs.v2.refs.Checksum
|
|
||||||
(*grpc.ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID
|
|
||||||
}
|
|
||||||
var file_storagegroup_grpc_types_proto_depIdxs = []int32{
|
|
||||||
1, // 0: neo.fs.v2.storagegroup.StorageGroup.validation_hash:type_name -> neo.fs.v2.refs.Checksum
|
|
||||||
2, // 1: neo.fs.v2.storagegroup.StorageGroup.members:type_name -> neo.fs.v2.refs.ObjectID
|
|
||||||
2, // [2:2] is the sub-list for method output_type
|
|
||||||
2, // [2:2] is the sub-list for method input_type
|
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
|
||||||
2, // [2:2] is the sub-list for extension extendee
|
|
||||||
0, // [0:2] is the sub-list for field type_name
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() { file_storagegroup_grpc_types_proto_init() }
|
|
||||||
func file_storagegroup_grpc_types_proto_init() {
|
|
||||||
if File_storagegroup_grpc_types_proto != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !protoimpl.UnsafeEnabled {
|
|
||||||
file_storagegroup_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
|
||||||
switch v := v.(*StorageGroup); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type x struct{}
|
|
||||||
out := protoimpl.TypeBuilder{
|
|
||||||
File: protoimpl.DescBuilder{
|
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
||||||
RawDescriptor: file_storagegroup_grpc_types_proto_rawDesc,
|
|
||||||
NumEnums: 0,
|
|
||||||
NumMessages: 1,
|
|
||||||
NumExtensions: 0,
|
|
||||||
NumServices: 0,
|
|
||||||
},
|
|
||||||
GoTypes: file_storagegroup_grpc_types_proto_goTypes,
|
|
||||||
DependencyIndexes: file_storagegroup_grpc_types_proto_depIdxs,
|
|
||||||
MessageInfos: file_storagegroup_grpc_types_proto_msgTypes,
|
|
||||||
}.Build()
|
|
||||||
File_storagegroup_grpc_types_proto = out.File
|
|
||||||
file_storagegroup_grpc_types_proto_rawDesc = nil
|
|
||||||
file_storagegroup_grpc_types_proto_goTypes = nil
|
|
||||||
file_storagegroup_grpc_types_proto_depIdxs = nil
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package storagegroup
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
|
||||||
storagegroup "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (s *StorageGroup) MarshalJSON() ([]byte, error) {
|
|
||||||
return message.MarshalJSON(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *StorageGroup) UnmarshalJSON(data []byte) error {
|
|
||||||
return message.UnmarshalJSON(s, data, new(storagegroup.StorageGroup))
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
package storagegroup
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
|
||||||
storagegroup "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/grpc"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
sizeField = 1
|
|
||||||
hashField = 2
|
|
||||||
expirationField = 3
|
|
||||||
objectIDsField = 4
|
|
||||||
)
|
|
||||||
|
|
||||||
// StableMarshal marshals unified storage group structure in a protobuf
|
|
||||||
// compatible way without field order shuffle.
|
|
||||||
func (s *StorageGroup) StableMarshal(buf []byte) []byte {
|
|
||||||
if s == nil {
|
|
||||||
return []byte{}
|
|
||||||
}
|
|
||||||
|
|
||||||
if buf == nil {
|
|
||||||
buf = make([]byte, s.StableSize())
|
|
||||||
}
|
|
||||||
|
|
||||||
var offset int
|
|
||||||
|
|
||||||
offset += proto.UInt64Marshal(sizeField, buf[offset:], s.size)
|
|
||||||
offset += proto.NestedStructureMarshal(hashField, buf[offset:], s.hash)
|
|
||||||
offset += proto.UInt64Marshal(expirationField, buf[offset:], s.exp)
|
|
||||||
refs.ObjectIDNestedListMarshal(objectIDsField, buf[offset:], s.members)
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// StableSize of storage group structure marshalled by StableMarshal function.
|
|
||||||
func (s *StorageGroup) StableSize() (size int) {
|
|
||||||
if s == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
size += proto.UInt64Size(sizeField, s.size)
|
|
||||||
size += proto.NestedStructureSize(hashField, s.hash)
|
|
||||||
size += proto.UInt64Size(expirationField, s.exp)
|
|
||||||
size += refs.ObjectIDNestedListSize(objectIDsField, s.members)
|
|
||||||
|
|
||||||
return size
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *StorageGroup) Unmarshal(data []byte) error {
|
|
||||||
return message.Unmarshal(s, data, new(storagegroup.StorageGroup))
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package storagegroup_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
|
||||||
messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test"
|
|
||||||
storagegrouptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup/test"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestMessageConvert(t *testing.T) {
|
|
||||||
messagetest.TestRPCMessage(t,
|
|
||||||
func(empty bool) message.Message { return storagegrouptest.GenerateStorageGroup(empty) },
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package storagegrouptest
|
|
||||||
|
|
||||||
import (
|
|
||||||
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/storagegroup"
|
|
||||||
)
|
|
||||||
|
|
||||||
func GenerateStorageGroup(empty bool) *storagegroup.StorageGroup {
|
|
||||||
m := new(storagegroup.StorageGroup)
|
|
||||||
|
|
||||||
if !empty {
|
|
||||||
m.SetValidationDataSize(44)
|
|
||||||
//nolint:staticcheck
|
|
||||||
m.SetExpirationEpoch(55)
|
|
||||||
m.SetMembers(refstest.GenerateObjectIDs(false))
|
|
||||||
}
|
|
||||||
|
|
||||||
m.SetValidationHash(refstest.GenerateChecksum(empty))
|
|
||||||
|
|
||||||
return m
|
|
||||||
}
|
|
|
@ -1,79 +0,0 @@
|
||||||
package storagegroup
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
|
||||||
)
|
|
||||||
|
|
||||||
// StorageGroup is a unified structure of StorageGroup
|
|
||||||
// message from proto definition.
|
|
||||||
type StorageGroup struct {
|
|
||||||
size uint64
|
|
||||||
|
|
||||||
hash *refs.Checksum
|
|
||||||
|
|
||||||
exp uint64
|
|
||||||
|
|
||||||
members []refs.ObjectID
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetValidationDataSize of unified storage group structure.
|
|
||||||
func (s *StorageGroup) GetValidationDataSize() uint64 {
|
|
||||||
if s != nil {
|
|
||||||
return s.size
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetValidationDataSize into unified storage group structure.
|
|
||||||
func (s *StorageGroup) SetValidationDataSize(v uint64) {
|
|
||||||
s.size = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetValidationHash of unified storage group structure.
|
|
||||||
func (s *StorageGroup) GetValidationHash() *refs.Checksum {
|
|
||||||
if s != nil {
|
|
||||||
return s.hash
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetValidationHash into unified storage group structure.
|
|
||||||
func (s *StorageGroup) SetValidationHash(v *refs.Checksum) {
|
|
||||||
s.hash = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetExpirationEpoch of unified storage group structure.
|
|
||||||
//
|
|
||||||
// Deprecated: Do not use.
|
|
||||||
func (s *StorageGroup) GetExpirationEpoch() uint64 {
|
|
||||||
if s != nil {
|
|
||||||
return s.exp
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetExpirationEpoch into unified storage group structure.
|
|
||||||
//
|
|
||||||
// Deprecated: Do not use.
|
|
||||||
func (s *StorageGroup) SetExpirationEpoch(v uint64) {
|
|
||||||
s.exp = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetMembers of unified storage group structure. Members are objects of
|
|
||||||
// storage group.
|
|
||||||
func (s *StorageGroup) GetMembers() []refs.ObjectID {
|
|
||||||
if s != nil {
|
|
||||||
return s.members
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetMembers into unified storage group structure. Members are objects of
|
|
||||||
// storage group.
|
|
||||||
func (s *StorageGroup) SetMembers(v []refs.ObjectID) {
|
|
||||||
s.members = v
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue