diff --git a/docs/object.md b/docs/object.md index 8407733..9e7efe6 100644 --- a/docs/object.md +++ b/docs/object.md @@ -34,8 +34,6 @@ - [Link](#object.Link) - [Object](#object.Object) - [Range](#object.Range) - - [StorageGroup](#object.StorageGroup) - - [StorageGroup.Lifetime](#object.StorageGroup.Lifetime) - [SystemHeader](#object.SystemHeader) - [Tombstone](#object.Tombstone) - [Transform](#object.Transform) @@ -369,7 +367,7 @@ in distributed system. | HomoHash | [bytes](#bytes) | | HomoHash is a homomorphic hash of original object payload | | PayloadChecksum | [bytes](#bytes) | | PayloadChecksum of actual object's payload | | Integrity | [IntegrityHeader](#object.IntegrityHeader) | | Integrity header with checksum of all above headers in the object | -| StorageGroup | [StorageGroup](#object.StorageGroup) | | StorageGroup contains meta information for the data audit | +| StorageGroup | [storagegroup.StorageGroup](#storagegroup.StorageGroup) | | StorageGroup contains meta information for the data audit | @@ -421,31 +419,6 @@ in distributed system. | Length | [uint64](#uint64) | | Length of the data range | - - -### Message StorageGroup - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ValidationDataSize | [uint64](#uint64) | | ValidationDataSize is size of the all object's payloads included into storage group | -| ValidationHash | [bytes](#bytes) | | ValidationHash is homomorphic hash of all object's payloads included into storage group | -| lifetime | [StorageGroup.Lifetime](#object.StorageGroup.Lifetime) | | Lifetime is time until storage group is valid | - - - - -### Message StorageGroup.Lifetime - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| unit | [StorageGroup.Lifetime.Unit](#object.StorageGroup.Lifetime.Unit) | | Unit is lifetime type | -| Value | [int64](#int64) | | Value for lifetime | - - ### Message SystemHeader @@ -514,19 +487,6 @@ in distributed system. - - -### StorageGroup.Lifetime.Unit - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unlimited | 0 | Unlimited set if storage group always valid | -| NeoFSEpoch | 1 | NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch | -| UnixTime | 2 | UnixTime set if storage group is valid until lifetime unix timestamp | - - - ### Transform.Type diff --git a/docs/storagegroup.md b/docs/storagegroup.md new file mode 100644 index 0000000..7522902 --- /dev/null +++ b/docs/storagegroup.md @@ -0,0 +1,88 @@ +# Protocol Documentation + + +## Table of Contents + +- [storagegroup/types.proto](#storagegroup/types.proto) + + - Messages + - [StorageGroup](#storagegroup.StorageGroup) + - [StorageGroup.Lifetime](#storagegroup.StorageGroup.Lifetime) + + +- [Scalar Value Types](#scalar-value-types) + + + + +
+ +## storagegroup/types.proto + + + + + + + +### Message StorageGroup + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| ValidationDataSize | [uint64](#uint64) | | ValidationDataSize is size of the all object's payloads included into storage group | +| ValidationHash | [bytes](#bytes) | | ValidationHash is homomorphic hash of all object's payloads included into storage group | +| lifetime | [StorageGroup.Lifetime](#storagegroup.StorageGroup.Lifetime) | | Lifetime is time until storage group is valid | + + + + +### Message StorageGroup.Lifetime + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| unit | [StorageGroup.Lifetime.Unit](#storagegroup.StorageGroup.Lifetime.Unit) | | Unit is lifetime type | +| Value | [int64](#int64) | | Value for lifetime | + + + + + + +### StorageGroup.Lifetime.Unit + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unlimited | 0 | Unlimited set if storage group always valid | +| NeoFSEpoch | 1 | NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch | +| UnixTime | 2 | UnixTime set if storage group is valid until lifetime unix timestamp | + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/object/extensions.go b/object/extensions.go index 1d89683..7427079 100644 --- a/object/extensions.go +++ b/object/extensions.go @@ -1,8 +1,6 @@ package object -import ( - "github.com/nspcc-dev/neofs-proto/hash" -) +import "github.com/nspcc-dev/neofs-proto/storagegroup" // IsLinking checks if object has children links to another objects. // We have to check payload size because zero-object must have zero @@ -64,7 +62,7 @@ func (m Object) IsTombstone() bool { } // StorageGroup returns storage group structure if it is presented in extended headers. -func (m Object) StorageGroup() (*StorageGroup, error) { +func (m Object) StorageGroup() (*storagegroup.StorageGroup, error) { _, sgHdr := m.LastHeader(HeaderType(StorageGroupHdr)) if sgHdr == nil { return nil, ErrHeaderNotFound @@ -74,11 +72,6 @@ func (m Object) StorageGroup() (*StorageGroup, error) { // SetStorageGroup sets storage group header in the object. // It will replace existing storage group header or add a new one. -func (m *Object) SetStorageGroup(sg *StorageGroup) { - m.SetHeader(&Header{Value: &Header_StorageGroup{StorageGroup: sg}}) -} - -// Empty checks if storage group has some data for validation. -func (m StorageGroup) Empty() bool { - return m.ValidationDataSize == 0 && m.ValidationHash.Equal(hash.Hash{}) +func (m *Object) SetStorageGroup(group *storagegroup.StorageGroup) { + m.SetHeader(&Header{Value: &Header_StorageGroup{StorageGroup: group}}) } diff --git a/object/sg.go b/object/sg.go index 1b48b3e..620d24d 100644 --- a/object/sg.go +++ b/object/sg.go @@ -1,54 +1,31 @@ package object import ( - "bytes" "sort" + + "github.com/nspcc-dev/neofs-proto/refs" + "github.com/nspcc-dev/neofs-proto/storagegroup" ) // Here are defined getter functions for objects that contain storage group // information. -type ( - // IDList is a slice of object ids, that can be sorted. - IDList []ID - - // ZoneInfo provides validation info of storage group. - ZoneInfo struct { - Hash - Size uint64 - } - - // IdentificationInfo provides meta information about storage group. - IdentificationInfo struct { - SGID - CID - OwnerID - } -) - -// Len returns amount of object ids in IDList. -func (s IDList) Len() int { return len(s) } - -// Less returns byte comparision between IDList[i] and IDList[j]. -func (s IDList) Less(i, j int) bool { return bytes.Compare(s[i].Bytes(), s[j].Bytes()) == -1 } - -// Swap swaps element with i and j index in IDList. -func (s IDList) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +var _ storagegroup.Provider = (*Object)(nil) // Group returns slice of object ids that are part of a storage group. -func (m *Object) Group() []ID { +func (m *Object) Group() []refs.ObjectID { sgLinks := m.Links(Link_StorageGroup) - sort.Sort(IDList(sgLinks)) + sort.Sort(storagegroup.IDList(sgLinks)) return sgLinks } // Zones returns validation zones of storage group. -func (m *Object) Zones() []ZoneInfo { +func (m *Object) Zones() []storagegroup.ZoneInfo { sgInfo, err := m.StorageGroup() if err != nil { return nil } - return []ZoneInfo{ + return []storagegroup.ZoneInfo{ { Hash: sgInfo.ValidationHash, Size: sgInfo.ValidationDataSize, @@ -57,8 +34,8 @@ func (m *Object) Zones() []ZoneInfo { } // IDInfo returns meta information about storage group. -func (m *Object) IDInfo() *IdentificationInfo { - return &IdentificationInfo{ +func (m *Object) IDInfo() *storagegroup.IdentificationInfo { + return &storagegroup.IdentificationInfo{ SGID: m.SystemHeader.ID, CID: m.SystemHeader.CID, OwnerID: m.SystemHeader.OwnerID, diff --git a/object/sg_test.go b/object/sg_test.go index 58e2042..15cc21b 100644 --- a/object/sg_test.go +++ b/object/sg_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-proto/hash" + "github.com/nspcc-dev/neofs-proto/storagegroup" "github.com/stretchr/testify/require" ) @@ -28,7 +29,7 @@ func TestObject_StorageGroup(t *testing.T) { } rand.Shuffle(len(obj.Headers), func(i, j int) { obj.Headers[i], obj.Headers[j] = obj.Headers[j], obj.Headers[i] }) - sort.Sort(IDList(idList)) + sort.Sort(storagegroup.IDList(idList)) require.Equal(t, idList, obj.Group()) }) t.Run("identification method", func(t *testing.T) { @@ -58,7 +59,7 @@ func TestObject_StorageGroup(t *testing.T) { Headers: []Header{ { Value: &Header_StorageGroup{ - StorageGroup: &StorageGroup{ + StorageGroup: &storagegroup.StorageGroup{ ValidationDataSize: sgSize, ValidationHash: sgHash, }, diff --git a/object/types.pb.go b/object/types.pb.go index 217ef09..459e124 100644 --- a/object/types.pb.go +++ b/object/types.pb.go @@ -9,6 +9,7 @@ import ( proto "github.com/golang/protobuf/proto" refs "github.com/nspcc-dev/neofs-proto/refs" session "github.com/nspcc-dev/neofs-proto/session" + storagegroup "github.com/nspcc-dev/neofs-proto/storagegroup" io "io" math "math" math_bits "math/bits" @@ -101,37 +102,6 @@ func (Transform_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor_02021a1d39b1aee0, []int{8, 0} } -type StorageGroup_Lifetime_Unit int32 - -const ( - // Unlimited set if storage group always valid - StorageGroup_Lifetime_Unlimited StorageGroup_Lifetime_Unit = 0 - // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch - StorageGroup_Lifetime_NeoFSEpoch StorageGroup_Lifetime_Unit = 1 - // UnixTime set if storage group is valid until lifetime unix timestamp - StorageGroup_Lifetime_UnixTime StorageGroup_Lifetime_Unit = 2 -) - -var StorageGroup_Lifetime_Unit_name = map[int32]string{ - 0: "Unlimited", - 1: "NeoFSEpoch", - 2: "UnixTime", -} - -var StorageGroup_Lifetime_Unit_value = map[string]int32{ - "Unlimited": 0, - "NeoFSEpoch": 1, - "UnixTime": 2, -} - -func (x StorageGroup_Lifetime_Unit) String() string { - return proto.EnumName(StorageGroup_Lifetime_Unit_name, int32(x)) -} - -func (StorageGroup_Lifetime_Unit) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{10, 0, 0} -} - type Range struct { // Offset of the data range Offset uint64 `protobuf:"varint,1,opt,name=Offset,proto3" json:"Offset,omitempty"` @@ -319,7 +289,7 @@ type Header_Integrity struct { Integrity *IntegrityHeader `protobuf:"bytes,9,opt,name=Integrity,proto3,oneof" json:"Integrity,omitempty"` } type Header_StorageGroup struct { - StorageGroup *StorageGroup `protobuf:"bytes,10,opt,name=StorageGroup,proto3,oneof" json:"StorageGroup,omitempty"` + StorageGroup *storagegroup.StorageGroup `protobuf:"bytes,10,opt,name=StorageGroup,proto3,oneof" json:"StorageGroup,omitempty"` } func (*Header_Link) isHeader_Value() {} @@ -396,7 +366,7 @@ func (m *Header) GetIntegrity() *IntegrityHeader { return nil } -func (m *Header) GetStorageGroup() *StorageGroup { +func (m *Header) GetStorageGroup() *storagegroup.StorageGroup { if x, ok := m.GetValue().(*Header_StorageGroup); ok { return x.StorageGroup } @@ -789,118 +759,9 @@ func (m *Object) GetPayload() []byte { return nil } -type StorageGroup struct { - // ValidationDataSize is size of the all object's payloads included into storage group - ValidationDataSize uint64 `protobuf:"varint,1,opt,name=ValidationDataSize,proto3" json:"ValidationDataSize,omitempty"` - // ValidationHash is homomorphic hash of all object's payloads included into storage group - ValidationHash Hash `protobuf:"bytes,2,opt,name=ValidationHash,proto3,customtype=Hash" json:"ValidationHash"` - // Lifetime is time until storage group is valid - Lifetime *StorageGroup_Lifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StorageGroup) Reset() { *m = StorageGroup{} } -func (m *StorageGroup) String() string { return proto.CompactTextString(m) } -func (*StorageGroup) ProtoMessage() {} -func (*StorageGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{10} -} -func (m *StorageGroup) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *StorageGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_StorageGroup.Merge(m, src) -} -func (m *StorageGroup) XXX_Size() int { - return m.Size() -} -func (m *StorageGroup) XXX_DiscardUnknown() { - xxx_messageInfo_StorageGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_StorageGroup proto.InternalMessageInfo - -func (m *StorageGroup) GetValidationDataSize() uint64 { - if m != nil { - return m.ValidationDataSize - } - return 0 -} - -func (m *StorageGroup) GetLifetime() *StorageGroup_Lifetime { - if m != nil { - return m.Lifetime - } - return nil -} - -type StorageGroup_Lifetime struct { - // Unit is lifetime type - Unit StorageGroup_Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=object.StorageGroup_Lifetime_Unit" json:"unit,omitempty"` - // Value for lifetime - Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StorageGroup_Lifetime) Reset() { *m = StorageGroup_Lifetime{} } -func (m *StorageGroup_Lifetime) String() string { return proto.CompactTextString(m) } -func (*StorageGroup_Lifetime) ProtoMessage() {} -func (*StorageGroup_Lifetime) Descriptor() ([]byte, []int) { - return fileDescriptor_02021a1d39b1aee0, []int{10, 0} -} -func (m *StorageGroup_Lifetime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StorageGroup_Lifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *StorageGroup_Lifetime) XXX_Merge(src proto.Message) { - xxx_messageInfo_StorageGroup_Lifetime.Merge(m, src) -} -func (m *StorageGroup_Lifetime) XXX_Size() int { - return m.Size() -} -func (m *StorageGroup_Lifetime) XXX_DiscardUnknown() { - xxx_messageInfo_StorageGroup_Lifetime.DiscardUnknown(m) -} - -var xxx_messageInfo_StorageGroup_Lifetime proto.InternalMessageInfo - -func (m *StorageGroup_Lifetime) GetUnit() StorageGroup_Lifetime_Unit { - if m != nil { - return m.Unit - } - return StorageGroup_Lifetime_Unlimited -} - -func (m *StorageGroup_Lifetime) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - func init() { proto.RegisterEnum("object.Link_Type", Link_Type_name, Link_Type_value) proto.RegisterEnum("object.Transform_Type", Transform_Type_name, Transform_Type_value) - proto.RegisterEnum("object.StorageGroup_Lifetime_Unit", StorageGroup_Lifetime_Unit_name, StorageGroup_Lifetime_Unit_value) proto.RegisterType((*Range)(nil), "object.Range") proto.RegisterType((*UserHeader)(nil), "object.UserHeader") proto.RegisterType((*Header)(nil), "object.Header") @@ -911,77 +772,67 @@ func init() { proto.RegisterType((*Link)(nil), "object.Link") proto.RegisterType((*Transform)(nil), "object.Transform") proto.RegisterType((*Object)(nil), "object.Object") - proto.RegisterType((*StorageGroup)(nil), "object.StorageGroup") - proto.RegisterType((*StorageGroup_Lifetime)(nil), "object.StorageGroup.Lifetime") } func init() { proto.RegisterFile("object/types.proto", fileDescriptor_02021a1d39b1aee0) } var fileDescriptor_02021a1d39b1aee0 = []byte{ - // 996 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xdf, 0x6e, 0xe3, 0xc4, - 0x17, 0xb6, 0x1d, 0x27, 0x71, 0x4e, 0xdd, 0xd6, 0x3b, 0xbf, 0xfd, 0x2d, 0x56, 0xd1, 0xb6, 0xc5, - 0xe2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3, 0x5d, 0xf3, 0xcf, 0xf9, 0xae, 0xf9, 0xcb, 0x5f, 0xbb, 0xc6, 0xf7, 0x1f, 0xac, 0x7c, 0x76, - 0x59, 0x3a, 0xee, 0x76, 0x0f, 0x63, 0xf2, 0xfc, 0x88, 0x11, 0xde, 0x4b, 0x0f, 0xb3, 0x8f, 0x6e, - 0x56, 0x74, 0xa7, 0xa2, 0xa2, 0x93, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x65, 0xf4, 0xeb, - 0xeb, 0x07, 0x00, 0x00, + // 867 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x55, 0x4d, 0x73, 0xdb, 0x44, + 0x18, 0x96, 0x64, 0xf9, 0xeb, 0xb5, 0xd2, 0xa8, 0x4b, 0x29, 0x1a, 0x33, 0x38, 0x41, 0xc3, 0x47, + 0x28, 0x44, 0x19, 0x52, 0x98, 0x0e, 0x07, 0x18, 0xe2, 0x98, 0x41, 0x1e, 0x0a, 0xc9, 0x6c, 0x3e, + 0x0e, 0xdc, 0x64, 0x6b, 0x2d, 0x8b, 0xd8, 0xbb, 0x9e, 0xdd, 0x75, 0x5b, 0xdf, 0xf9, 0x05, 0x9c, + 0xb8, 0xf1, 0x77, 0x7a, 0xe4, 0xc8, 0xf4, 0x90, 0x61, 0xc2, 0x0f, 0xe0, 0x2f, 0x74, 0x76, 0x25, + 0xd9, 0x92, 0xdb, 0x8b, 0x67, 0xdf, 0xe7, 0x63, 0xfd, 0xea, 0xdd, 0x67, 0x25, 0x40, 0x6c, 0xf4, + 0x1b, 0x19, 0xcb, 0x23, 0xb9, 0x5a, 0x10, 0x11, 0x2c, 0x38, 0x93, 0x0c, 0x35, 0x32, 0xac, 0xeb, + 0x72, 0x32, 0x11, 0x65, 0xa6, 0xfb, 0x8e, 0x20, 0x42, 0xa4, 0x8c, 0x56, 0x40, 0x4f, 0x48, 0xc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x8f, 0x5f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x40, 0x7d, 0xa2, 0x84, 0xb1, + 0x06, 0x00, 0x00, } func (m *Range) Marshal() (dAtA []byte, err error) { @@ -1620,97 +1471,6 @@ func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *StorageGroup) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Lifetime != nil { - { - size, err := m.Lifetime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - { - size := m.ValidationHash.Size() - i -= size - if _, err := m.ValidationHash.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.ValidationDataSize != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ValidationDataSize)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *StorageGroup_Lifetime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StorageGroup_Lifetime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StorageGroup_Lifetime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Value != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x10 - } - if m.Unit != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Unit)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -2028,45 +1788,6 @@ func (m *Object) Size() (n int) { return n } -func (m *StorageGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ValidationDataSize != 0 { - n += 1 + sovTypes(uint64(m.ValidationDataSize)) - } - l = m.ValidationHash.Size() - n += 1 + l + sovTypes(uint64(l)) - if m.Lifetime != nil { - l = m.Lifetime.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StorageGroup_Lifetime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Unit != 0 { - n += 1 + sovTypes(uint64(m.Unit)) - } - if m.Value != 0 { - n += 1 + sovTypes(uint64(m.Value)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2655,7 +2376,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &StorageGroup{} + v := &storagegroup.StorageGroup{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3531,240 +3252,6 @@ func (m *Object) Unmarshal(dAtA []byte) error { } return nil } -func (m *StorageGroup) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StorageGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StorageGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidationDataSize", wireType) - } - m.ValidationDataSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidationDataSize |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ValidationHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lifetime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Lifetime == nil { - m.Lifetime = &StorageGroup_Lifetime{} - } - if err := m.Lifetime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StorageGroup_Lifetime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Lifetime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Lifetime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) - } - m.Unit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Unit |= StorageGroup_Lifetime_Unit(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/object/types.proto b/object/types.proto index f3313a3..d2bbaab 100644 --- a/object/types.proto +++ b/object/types.proto @@ -4,6 +4,7 @@ option go_package = "github.com/nspcc-dev/neofs-proto/object"; import "refs/types.proto"; import "session/types.proto"; +import "storagegroup/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -25,25 +26,25 @@ message UserHeader { message Header { oneof Value { // Link to other objects - Link Link = 1; + Link Link = 1; // Redirect not used yet - refs.Address Redirect = 2; + refs.Address Redirect = 2; // UserHeader is a set of KV headers defined by user - UserHeader UserHeader = 3; + UserHeader UserHeader = 3; // Transform defines transform operation (e.g. payload split) - Transform Transform = 4; + Transform Transform = 4; // Tombstone header that set up in deleted objects - Tombstone Tombstone = 5; + Tombstone Tombstone = 5; // Verify header that contains session public key and user's signature - session.VerificationHeader Verify = 6; + session.VerificationHeader Verify = 6; // HomoHash is a homomorphic hash of original object payload - bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; + bytes HomoHash = 7 [(gogoproto.customtype) = "Hash"]; // PayloadChecksum of actual object's payload - bytes PayloadChecksum = 8; + bytes PayloadChecksum = 8; // Integrity header with checksum of all above headers in the object - IntegrityHeader Integrity = 9; + IntegrityHeader Integrity = 9; // StorageGroup contains meta information for the data audit - StorageGroup StorageGroup = 10; + storagegroup.StorageGroup StorageGroup = 10; } } @@ -124,29 +125,3 @@ message Object { // Payload is an object's payload bytes Payload = 3; } - -message StorageGroup { - // ValidationDataSize is size of the all object's payloads included into storage group - uint64 ValidationDataSize = 1; - // ValidationHash is homomorphic hash of all object's payloads included into storage group - bytes ValidationHash = 2 [(gogoproto.customtype) = "Hash", (gogoproto.nullable) = false]; - - message Lifetime { - enum Unit { - // Unlimited set if storage group always valid - Unlimited = 0; - // NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch - NeoFSEpoch = 1; - // UnixTime set if storage group is valid until lifetime unix timestamp - UnixTime = 2; - } - - // Unit is lifetime type - Unit unit = 1 [(gogoproto.customname) = "Unit"]; - // Value for lifetime - int64 Value = 2; - } - - // Lifetime is time until storage group is valid - Lifetime lifetime = 3 [(gogoproto.customname) = "Lifetime"]; -} diff --git a/storagegroup/storage.go b/storagegroup/storage.go new file mode 100644 index 0000000..a23ef74 --- /dev/null +++ b/storagegroup/storage.go @@ -0,0 +1,39 @@ +package storagegroup + +import ( + "context" + + "github.com/nspcc-dev/neofs-proto/refs" +) + +type ( + // Store is a interface for storing users storage group + Store interface { + Lister + Receiver + Receptacle + } + + // Lister defines list function that returns all storage groups + // created for the passed container + Lister interface { + List(ctx context.Context, cid refs.CID) ([]refs.SGID, error) + } + + // Receiver defines get function that returns asked storage group + Receiver interface { + Get(ctx context.Context, cid refs.CID, sgid refs.SGID) (Provider, error) + } + + // Receptacle defines put function that places storage group in the + // store. + Receptacle interface { + Put(ctx context.Context, sg Provider) error + } + + // InfoReceiver defines GetSGInfo function that returns storage group + // that contains passed object ids. + InfoReceiver interface { + GetSGInfo(ctx context.Context, cid refs.CID, group []refs.ObjectID) (*StorageGroup, error) + } +) diff --git a/storagegroup/types.go b/storagegroup/types.go new file mode 100644 index 0000000..6c6f775 --- /dev/null +++ b/storagegroup/types.go @@ -0,0 +1,97 @@ +package storagegroup + +import ( + "bytes" + "strconv" + "strings" + + "github.com/gogo/protobuf/proto" + "github.com/mr-tron/base58" + "github.com/nspcc-dev/neofs-proto/hash" + "github.com/nspcc-dev/neofs-proto/refs" +) + +type ( + // Hash is alias of hash.Hash for proto definition. + Hash = hash.Hash + + // Provider is an interface that defines storage group instance. + // There was different storage group implementation. Right now it + // is implemented as extended header in the object. + Provider interface { + // Group returns list of object ids of the storage group. + // This list **should be** sorted. + Group() []refs.ObjectID + + IDInfo() *IdentificationInfo + Zones() []ZoneInfo + } + + // ZoneInfo provides validation information of storage group. + ZoneInfo struct { + hash.Hash + Size uint64 + } + + // IdentificationInfo provides meta information about storage group. + IdentificationInfo struct { + CID refs.CID + SGID refs.SGID + OwnerID refs.OwnerID + } + + // IDList is a slice of object ids, that can be sorted. + IDList []refs.ObjectID +) + +var _ proto.Message = (*StorageGroup)(nil) + +// String returns string representation of StorageGroup. +func (m *StorageGroup) String() string { + b := new(strings.Builder) + b.WriteString("