2020-08-18 15:28:02 +00:00
|
|
|
package object
|
|
|
|
|
|
|
|
import (
|
2023-03-07 10:38:56 +00:00
|
|
|
object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
|
2020-08-18 15:28:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
shortHdrVersionField = 1
|
|
|
|
shortHdrEpochField = 2
|
|
|
|
shortHdrOwnerField = 3
|
|
|
|
shortHdrObjectTypeField = 4
|
|
|
|
shortHdrPayloadLength = 5
|
2020-12-17 10:18:07 +00:00
|
|
|
shortHdrHashField = 6
|
|
|
|
shortHdrHomoHashField = 7
|
2020-08-18 15:28:02 +00:00
|
|
|
|
|
|
|
attributeKeyField = 1
|
|
|
|
attributeValueField = 2
|
|
|
|
|
|
|
|
splitHdrParentField = 1
|
|
|
|
splitHdrPreviousField = 2
|
|
|
|
splitHdrParentSignatureField = 3
|
|
|
|
splitHdrParentHeaderField = 4
|
|
|
|
splitHdrChildrenField = 5
|
2020-11-24 17:14:03 +00:00
|
|
|
splitHdrSplitIDField = 6
|
2020-08-18 15:28:02 +00:00
|
|
|
|
2024-05-16 09:03:42 +00:00
|
|
|
ecHdrParentField = 1
|
|
|
|
ecHdrIndexField = 2
|
|
|
|
ecHdrTotalField = 3
|
|
|
|
ecHdrHeaderLengthField = 4
|
|
|
|
ecHdrHeaderField = 5
|
|
|
|
ecHdrParentSplitID = 6
|
|
|
|
ecHdrParentSplitParentID = 7
|
2024-05-27 09:13:49 +00:00
|
|
|
ecHdrParentAttributes = 8
|
2024-03-19 06:55:23 +00:00
|
|
|
|
2020-08-18 15:28:02 +00:00
|
|
|
hdrVersionField = 1
|
|
|
|
hdrContainerIDField = 2
|
|
|
|
hdrOwnerIDField = 3
|
|
|
|
hdrEpochField = 4
|
|
|
|
hdrPayloadLengthField = 5
|
|
|
|
hdrPayloadHashField = 6
|
|
|
|
hdrObjectTypeField = 7
|
|
|
|
hdrHomomorphicHashField = 8
|
|
|
|
hdrSessionTokenField = 9
|
|
|
|
hdrAttributesField = 10
|
|
|
|
hdrSplitField = 11
|
2024-03-19 06:55:23 +00:00
|
|
|
hdrECField = 12
|
2020-08-18 15:28:02 +00:00
|
|
|
|
2020-09-08 10:39:13 +00:00
|
|
|
hdrWithSigHeaderField = 1
|
|
|
|
hdrWithSigSignatureField = 2
|
|
|
|
|
2020-08-18 15:28:02 +00:00
|
|
|
objIDField = 1
|
|
|
|
objSignatureField = 2
|
|
|
|
objHeaderField = 3
|
|
|
|
objPayloadField = 4
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2020-12-02 10:10:43 +00:00
|
|
|
splitInfoSplitIDField = 1
|
|
|
|
splitInfoLastPartField = 2
|
|
|
|
splitInfoLinkField = 3
|
|
|
|
|
2024-04-22 10:25:29 +00:00
|
|
|
ecInfoChunksField = 1
|
|
|
|
|
|
|
|
ecChunkIDField = 1
|
|
|
|
ecChunkIndexField = 2
|
|
|
|
ecChunkTotalField = 3
|
|
|
|
|
2020-08-18 16:46:55 +00:00
|
|
|
getReqBodyAddressField = 1
|
|
|
|
getReqBodyRawFlagField = 2
|
|
|
|
|
|
|
|
getRespInitObjectIDField = 1
|
|
|
|
getRespInitSignatureField = 2
|
|
|
|
getRespInitHeaderField = 3
|
|
|
|
|
2020-12-02 10:10:43 +00:00
|
|
|
getRespBodyInitField = 1
|
|
|
|
getRespBodyChunkField = 2
|
|
|
|
getRespBodySplitInfoField = 3
|
2024-04-22 10:25:29 +00:00
|
|
|
getRespBodyECInfoField = 4
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
putReqInitObjectIDField = 1
|
|
|
|
putReqInitSignatureField = 2
|
|
|
|
putReqInitHeaderField = 3
|
|
|
|
putReqInitCopiesNumField = 4
|
|
|
|
|
|
|
|
putReqBodyInitField = 1
|
|
|
|
putReqBodyChunkField = 2
|
|
|
|
|
|
|
|
putRespBodyObjectIDField = 1
|
|
|
|
|
|
|
|
deleteReqBodyAddressField = 1
|
|
|
|
|
2020-12-10 09:15:17 +00:00
|
|
|
deleteRespBodyTombstoneFNum = 1
|
|
|
|
|
2020-08-18 16:46:55 +00:00
|
|
|
headReqBodyAddressField = 1
|
|
|
|
headReqBodyMainFlagField = 2
|
|
|
|
headReqBodyRawFlagField = 3
|
|
|
|
|
|
|
|
headRespBodyHeaderField = 1
|
|
|
|
headRespBodyShortHeaderField = 2
|
2020-12-07 15:59:01 +00:00
|
|
|
headRespBodySplitInfoField = 3
|
2024-04-22 10:25:29 +00:00
|
|
|
headRespBodyECInfoField = 4
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
searchFilterMatchField = 1
|
|
|
|
searchFilterNameField = 2
|
|
|
|
searchFilterValueField = 3
|
|
|
|
|
|
|
|
searchReqBodyContainerIDField = 1
|
|
|
|
searchReqBodyVersionField = 2
|
|
|
|
searchReqBodyFiltersField = 3
|
|
|
|
|
|
|
|
searchRespBodyObjectIDsField = 1
|
|
|
|
|
|
|
|
rangeOffsetField = 1
|
|
|
|
rangeLengthField = 2
|
|
|
|
|
|
|
|
getRangeReqBodyAddressField = 1
|
|
|
|
getRangeReqBodyRangeField = 2
|
2020-12-07 15:59:01 +00:00
|
|
|
getRangeReqBodyRawField = 3
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2020-12-07 15:59:01 +00:00
|
|
|
getRangeRespChunkField = 1
|
|
|
|
getRangeRespSplitInfoField = 2
|
2024-04-27 20:03:26 +00:00
|
|
|
getRangeRespECInfoField = 3
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
getRangeHashReqBodyAddressField = 1
|
|
|
|
getRangeHashReqBodyRangesField = 2
|
|
|
|
getRangeHashReqBodySaltField = 3
|
2020-08-20 08:48:35 +00:00
|
|
|
getRangeHashReqBodyTypeField = 4
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2020-08-20 08:48:35 +00:00
|
|
|
getRangeHashRespBodyTypeField = 1
|
|
|
|
getRangeHashRespBodyHashListField = 2
|
2023-06-30 12:00:51 +00:00
|
|
|
|
|
|
|
putSingleReqObjectField = 1
|
|
|
|
putSingleReqCopiesNumberField = 2
|
2024-07-24 14:40:47 +00:00
|
|
|
|
|
|
|
patchRequestBodyPatchRangeField = 1
|
|
|
|
patchRequestBodyPatchChunkField = 2
|
|
|
|
|
|
|
|
patchRequestBodyAddrField = 1
|
|
|
|
patchRequestBodyNewAttrsField = 2
|
|
|
|
patchRequestBodyReplaceAttrField = 3
|
|
|
|
patchRequestBodyPatchField = 4
|
|
|
|
|
|
|
|
patchResponseBodyObjectIDField = 1
|
2020-08-18 15:28:02 +00:00
|
|
|
)
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (h *ShortHeader) StableMarshal(buf []byte) []byte {
|
2020-08-18 15:28:02 +00:00
|
|
|
if h == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, h.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 15:28:02 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(shortHdrVersionField, buf[offset:], h.version)
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.UInt64Marshal(shortHdrEpochField, buf[offset:], h.creatEpoch)
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(shortHdrOwnerField, buf[offset:], h.ownerID)
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.EnumMarshal(shortHdrObjectTypeField, buf[offset:], int32(h.typ))
|
|
|
|
offset += proto.UInt64Marshal(shortHdrPayloadLength, buf[offset:], h.payloadLen)
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(shortHdrHashField, buf[offset:], h.payloadHash)
|
|
|
|
proto.NestedStructureMarshal(shortHdrHomoHashField, buf[offset:], h.homoHash)
|
2020-12-17 10:18:07 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (h *ShortHeader) StableSize() (size int) {
|
|
|
|
if h == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(shortHdrVersionField, h.version)
|
|
|
|
size += proto.UInt64Size(shortHdrEpochField, h.creatEpoch)
|
|
|
|
size += proto.NestedStructureSize(shortHdrOwnerField, h.ownerID)
|
|
|
|
size += proto.EnumSize(shortHdrObjectTypeField, int32(h.typ))
|
|
|
|
size += proto.UInt64Size(shortHdrPayloadLength, h.payloadLen)
|
2020-12-17 10:18:07 +00:00
|
|
|
size += proto.NestedStructureSize(shortHdrHashField, h.payloadHash)
|
|
|
|
size += proto.NestedStructureSize(shortHdrHomoHashField, h.homoHash)
|
2020-08-18 15:28:02 +00:00
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2020-11-13 12:26:23 +00:00
|
|
|
func (h *ShortHeader) Unmarshal(data []byte) error {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.Unmarshal(h, data, new(object.ShortHeader))
|
2020-11-13 12:26:23 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (a *Attribute) StableMarshal(buf []byte) []byte {
|
2020-08-18 15:28:02 +00:00
|
|
|
if a == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, a.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
var offset int
|
2020-08-18 15:28:02 +00:00
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.StringMarshal(attributeKeyField, buf[offset:], a.key)
|
|
|
|
proto.StringMarshal(attributeValueField, buf[offset:], a.val)
|
2020-08-18 15:28:02 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Attribute) StableSize() (size int) {
|
|
|
|
if a == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.StringSize(shortHdrVersionField, a.key)
|
|
|
|
size += proto.StringSize(shortHdrEpochField, a.val)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2020-11-13 12:31:15 +00:00
|
|
|
func (a *Attribute) Unmarshal(data []byte) error {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.Unmarshal(a, data, new(object.Header_Attribute))
|
2020-11-13 12:31:15 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (h *SplitHeader) StableMarshal(buf []byte) []byte {
|
2020-08-18 15:28:02 +00:00
|
|
|
if h == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, h.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-12-21 07:51:45 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(splitHdrParentField, buf[offset:], h.par)
|
|
|
|
offset += proto.NestedStructureMarshal(splitHdrPreviousField, buf[offset:], h.prev)
|
|
|
|
offset += proto.NestedStructureMarshal(splitHdrParentSignatureField, buf[offset:], h.parSig)
|
|
|
|
offset += proto.NestedStructureMarshal(splitHdrParentHeaderField, buf[offset:], h.parHdr)
|
|
|
|
offset += refs.ObjectIDNestedListMarshal(splitHdrChildrenField, buf[offset:], h.children)
|
2022-03-12 12:20:19 +00:00
|
|
|
proto.BytesMarshal(splitHdrSplitIDField, buf[offset:], h.splitID)
|
2020-11-24 17:14:03 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (h *SplitHeader) StableSize() (size int) {
|
|
|
|
if h == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(splitHdrParentField, h.par)
|
|
|
|
size += proto.NestedStructureSize(splitHdrPreviousField, h.prev)
|
|
|
|
size += proto.NestedStructureSize(splitHdrParentSignatureField, h.parSig)
|
|
|
|
size += proto.NestedStructureSize(splitHdrParentHeaderField, h.parHdr)
|
2020-12-21 07:51:45 +00:00
|
|
|
size += refs.ObjectIDNestedListSize(splitHdrChildrenField, h.children)
|
2020-11-24 17:14:03 +00:00
|
|
|
size += proto.BytesSize(splitHdrSplitIDField, h.splitID)
|
|
|
|
|
2020-08-18 15:28:02 +00:00
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2020-11-13 12:34:13 +00:00
|
|
|
func (h *SplitHeader) Unmarshal(data []byte) error {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.Unmarshal(h, data, new(object.Header_Split))
|
2020-11-13 12:34:13 +00:00
|
|
|
}
|
|
|
|
|
2024-03-19 06:55:23 +00:00
|
|
|
func (h *ECHeader) StableMarshal(buf []byte) []byte {
|
|
|
|
if h == nil {
|
|
|
|
return []byte{}
|
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, h.StableSize())
|
|
|
|
}
|
|
|
|
|
|
|
|
var offset int
|
|
|
|
|
|
|
|
offset += proto.NestedStructureMarshal(ecHdrParentField, buf[offset:], h.Parent)
|
|
|
|
offset += proto.UInt32Marshal(ecHdrIndexField, buf[offset:], h.Index)
|
|
|
|
offset += proto.UInt32Marshal(ecHdrTotalField, buf[offset:], h.Total)
|
|
|
|
offset += proto.UInt32Marshal(ecHdrHeaderLengthField, buf[offset:], h.HeaderLength)
|
2024-05-08 12:03:29 +00:00
|
|
|
offset += proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header)
|
|
|
|
offset += proto.BytesMarshal(ecHdrParentSplitID, buf[offset:], h.ParentSplitID)
|
2024-05-27 09:13:49 +00:00
|
|
|
offset += proto.NestedStructureMarshal(ecHdrParentSplitParentID, buf[offset:], h.ParentSplitParentID)
|
|
|
|
for i := range h.ParentAttributes {
|
|
|
|
offset += proto.NestedStructureMarshal(ecHdrParentAttributes, buf[offset:], &h.ParentAttributes[i])
|
|
|
|
}
|
2024-03-19 06:55:23 +00:00
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *ECHeader) StableSize() (size int) {
|
|
|
|
if h == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(ecHdrParentField, h.Parent)
|
|
|
|
size += proto.UInt32Size(ecHdrIndexField, h.Index)
|
|
|
|
size += proto.UInt32Size(ecHdrTotalField, h.Total)
|
|
|
|
size += proto.UInt32Size(ecHdrHeaderLengthField, h.HeaderLength)
|
|
|
|
size += proto.BytesSize(ecHdrHeaderField, h.Header)
|
2024-05-08 12:03:29 +00:00
|
|
|
size += proto.BytesSize(ecHdrParentSplitID, h.ParentSplitID)
|
2024-05-16 09:03:42 +00:00
|
|
|
size += proto.NestedStructureSize(ecHdrParentSplitParentID, h.ParentSplitParentID)
|
2024-05-27 09:13:49 +00:00
|
|
|
for i := range h.ParentAttributes {
|
|
|
|
size += proto.NestedStructureSize(ecHdrParentAttributes, &h.ParentAttributes[i])
|
|
|
|
}
|
2024-03-19 06:55:23 +00:00
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *ECHeader) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(h, data, new(object.Header_EC))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (h *Header) StableMarshal(buf []byte) []byte {
|
2020-08-18 15:28:02 +00:00
|
|
|
if h == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, h.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 15:28:02 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(hdrVersionField, buf[offset:], h.version)
|
|
|
|
offset += proto.NestedStructureMarshal(hdrContainerIDField, buf[offset:], h.cid)
|
|
|
|
offset += proto.NestedStructureMarshal(hdrOwnerIDField, buf[offset:], h.ownerID)
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.UInt64Marshal(hdrEpochField, buf[offset:], h.creatEpoch)
|
|
|
|
offset += proto.UInt64Marshal(hdrPayloadLengthField, buf[offset:], h.payloadLen)
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(hdrPayloadHashField, buf[offset:], h.payloadHash)
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.EnumMarshal(hdrObjectTypeField, buf[offset:], int32(h.typ))
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(hdrHomomorphicHashField, buf[offset:], h.homoHash)
|
|
|
|
offset += proto.NestedStructureMarshal(hdrSessionTokenField, buf[offset:], h.sessionToken)
|
2020-08-18 15:28:02 +00:00
|
|
|
|
|
|
|
for i := range h.attr {
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(hdrAttributesField, buf[offset:], &h.attr[i])
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(hdrSplitField, buf[offset:], h.split)
|
2024-03-19 06:55:23 +00:00
|
|
|
proto.NestedStructureMarshal(hdrECField, buf[offset:], h.ec)
|
2020-08-18 15:28:02 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (h *Header) StableSize() (size int) {
|
|
|
|
if h == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(hdrVersionField, h.version)
|
|
|
|
size += proto.NestedStructureSize(hdrContainerIDField, h.cid)
|
|
|
|
size += proto.NestedStructureSize(hdrOwnerIDField, h.ownerID)
|
|
|
|
size += proto.UInt64Size(hdrEpochField, h.creatEpoch)
|
|
|
|
size += proto.UInt64Size(hdrPayloadLengthField, h.payloadLen)
|
2020-08-20 08:48:35 +00:00
|
|
|
size += proto.NestedStructureSize(hdrPayloadHashField, h.payloadHash)
|
2020-08-18 15:28:02 +00:00
|
|
|
size += proto.EnumSize(hdrObjectTypeField, int32(h.typ))
|
2020-08-20 08:48:35 +00:00
|
|
|
size += proto.NestedStructureSize(hdrHomomorphicHashField, h.homoHash)
|
2020-08-18 15:28:02 +00:00
|
|
|
size += proto.NestedStructureSize(hdrSessionTokenField, h.sessionToken)
|
|
|
|
for i := range h.attr {
|
2022-02-28 12:06:51 +00:00
|
|
|
size += proto.NestedStructureSize(hdrAttributesField, &h.attr[i])
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
size += proto.NestedStructureSize(hdrSplitField, h.split)
|
2024-03-19 06:55:23 +00:00
|
|
|
size += proto.NestedStructureSize(hdrECField, h.ec)
|
2020-08-18 15:28:02 +00:00
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2020-11-13 12:38:55 +00:00
|
|
|
func (h *Header) Unmarshal(data []byte) error {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.Unmarshal(h, data, new(object.Header))
|
2020-11-13 12:38:55 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (h *HeaderWithSignature) StableMarshal(buf []byte) []byte {
|
2020-09-08 10:39:13 +00:00
|
|
|
if h == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-09-08 10:39:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, h.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-09-08 10:39:13 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(hdrWithSigHeaderField, buf[offset:], h.header)
|
|
|
|
proto.NestedStructureMarshal(hdrWithSigSignatureField, buf[offset:], h.signature)
|
2020-09-08 10:39:13 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-09-08 10:39:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (h *HeaderWithSignature) StableSize() (size int) {
|
|
|
|
if h == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(hdrVersionField, h.header)
|
|
|
|
size += proto.NestedStructureSize(hdrContainerIDField, h.signature)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2020-11-13 12:43:02 +00:00
|
|
|
func (h *HeaderWithSignature) Unmarshal(data []byte) error {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.Unmarshal(h, data, new(object.HeaderWithSignature))
|
2020-11-13 12:43:02 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (o *Object) StableMarshal(buf []byte) []byte {
|
2020-08-18 15:28:02 +00:00
|
|
|
if o == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2023-10-06 12:05:30 +00:00
|
|
|
if o.marshalData != nil {
|
|
|
|
if buf == nil {
|
|
|
|
return o.marshalData
|
|
|
|
}
|
|
|
|
copy(buf, o.marshalData)
|
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
2020-08-18 15:28:02 +00:00
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, o.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 15:28:02 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(objIDField, buf[offset:], o.objectID)
|
|
|
|
offset += proto.NestedStructureMarshal(objSignatureField, buf[offset:], o.idSig)
|
|
|
|
offset += proto.NestedStructureMarshal(objHeaderField, buf[offset:], o.header)
|
2022-03-12 12:20:19 +00:00
|
|
|
proto.BytesMarshal(objPayloadField, buf[offset:], o.payload)
|
2020-08-18 15:28:02 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2023-10-06 12:05:30 +00:00
|
|
|
// SetMarshalData sets marshal data to reduce memory allocations.
|
|
|
|
//
|
2024-02-15 11:41:33 +00:00
|
|
|
// It is unsafe to modify/copy object data after setting marshal data.
|
2023-10-06 12:05:30 +00:00
|
|
|
func (o *Object) SetMarshalData(data []byte) {
|
|
|
|
if o == nil {
|
|
|
|
return
|
|
|
|
}
|
2024-02-15 11:41:33 +00:00
|
|
|
o.marshalData = data
|
2023-10-06 12:05:30 +00:00
|
|
|
}
|
|
|
|
|
2020-08-18 15:28:02 +00:00
|
|
|
func (o *Object) StableSize() (size int) {
|
|
|
|
if o == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(objIDField, o.objectID)
|
|
|
|
size += proto.NestedStructureSize(objSignatureField, o.idSig)
|
|
|
|
size += proto.NestedStructureSize(objHeaderField, o.header)
|
|
|
|
size += proto.BytesSize(objPayloadField, o.payload)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2020-11-13 12:51:27 +00:00
|
|
|
func (o *Object) Unmarshal(data []byte) error {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.Unmarshal(o, data, new(object.Object))
|
2020-11-13 12:51:27 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (s *SplitInfo) StableMarshal(buf []byte) []byte {
|
2020-12-02 10:10:43 +00:00
|
|
|
if s == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-12-02 10:10:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, s.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-12-02 10:10:43 +00:00
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.BytesMarshal(splitInfoSplitIDField, buf[offset:], s.splitID)
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(splitInfoLastPartField, buf[offset:], s.lastPart)
|
|
|
|
proto.NestedStructureMarshal(splitInfoLinkField, buf[offset:], s.link)
|
2020-12-02 10:10:43 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-12-02 10:10:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *SplitInfo) StableSize() (size int) {
|
|
|
|
if s == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.BytesSize(splitInfoSplitIDField, s.splitID)
|
|
|
|
size += proto.NestedStructureSize(splitInfoLastPartField, s.lastPart)
|
|
|
|
size += proto.NestedStructureSize(splitInfoLinkField, s.link)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2020-12-02 13:57:06 +00:00
|
|
|
func (s *SplitInfo) Unmarshal(data []byte) error {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.Unmarshal(s, data, new(object.SplitInfo))
|
2020-12-02 13:57:06 +00:00
|
|
|
}
|
|
|
|
|
2024-04-22 10:25:29 +00:00
|
|
|
func (e *ECInfo) StableMarshal(buf []byte) []byte {
|
|
|
|
if e == nil {
|
|
|
|
return []byte{}
|
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, e.StableSize())
|
|
|
|
}
|
|
|
|
|
|
|
|
var offset int
|
|
|
|
|
|
|
|
for i := range e.Chunks {
|
|
|
|
offset += proto.NestedStructureMarshal(ecInfoChunksField, buf[offset:], &e.Chunks[i])
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *ECInfo) StableSize() (size int) {
|
|
|
|
if e == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
for i := range e.Chunks {
|
|
|
|
size += proto.NestedStructureSize(ecInfoChunksField, &e.Chunks[i])
|
|
|
|
}
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *ECInfo) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(e, data, new(object.ECInfo))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ECChunk) StableMarshal(buf []byte) []byte {
|
|
|
|
if c == nil {
|
|
|
|
return []byte{}
|
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, c.StableSize())
|
|
|
|
}
|
|
|
|
|
|
|
|
var offset int
|
|
|
|
|
|
|
|
offset += proto.NestedStructureMarshal(ecChunkIDField, buf[offset:], &c.ID)
|
|
|
|
offset += proto.UInt32Marshal(ecChunkIndexField, buf[offset:], c.Index)
|
|
|
|
proto.UInt32Marshal(ecChunkTotalField, buf[offset:], c.Total)
|
|
|
|
|
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ECChunk) StableSize() (size int) {
|
|
|
|
if c == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(ecChunkIDField, &c.ID)
|
|
|
|
size += proto.UInt32Size(ecChunkIndexField, c.Index)
|
|
|
|
size += proto.UInt32Size(ecChunkTotalField, c.Total)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ECChunk) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(c, data, new(object.ECInfo_Chunk))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *GetRequestBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(getReqBodyAddressField, buf[offset:], r.addr)
|
2022-03-12 12:20:19 +00:00
|
|
|
proto.BoolMarshal(getReqBodyRawFlagField, buf[offset:], r.raw)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2020-08-18 16:46:55 +00:00
|
|
|
func (r *GetRequestBody) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(getReqBodyAddressField, r.addr)
|
|
|
|
size += proto.BoolSize(getReqBodyRawFlagField, r.raw)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *GetRequestBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.GetRequest_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *GetObjectPartInit) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(getRespInitObjectIDField, buf[offset:], r.id)
|
|
|
|
offset += proto.NestedStructureMarshal(getRespInitSignatureField, buf[offset:], r.sig)
|
|
|
|
proto.NestedStructureMarshal(getRespInitHeaderField, buf[offset:], r.hdr)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *GetObjectPartInit) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(getRespInitObjectIDField, r.id)
|
|
|
|
size += proto.NestedStructureSize(getRespInitSignatureField, r.sig)
|
|
|
|
size += proto.NestedStructureSize(getRespInitHeaderField, r.hdr)
|
|
|
|
|
|
|
|
return size
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *GetObjectPartInit) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.GetResponse_Body_Init))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *GetResponseBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
switch v := r.objPart.(type) {
|
|
|
|
case nil:
|
|
|
|
case *GetObjectPartInit:
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(getRespBodyInitField, buf, v)
|
2021-03-12 12:57:23 +00:00
|
|
|
case *GetObjectPartChunk:
|
|
|
|
if v != nil {
|
2022-03-12 12:20:19 +00:00
|
|
|
proto.BytesMarshal(getRespBodyChunkField, buf, v.chunk)
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
case *SplitInfo:
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v)
|
2024-04-22 10:25:29 +00:00
|
|
|
case *ECInfo:
|
|
|
|
proto.NestedStructureMarshal(getRespBodyECInfoField, buf, v)
|
2021-03-12 12:57:23 +00:00
|
|
|
default:
|
|
|
|
panic("unknown one of object get response body type")
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *GetResponseBody) StableSize() (size int) {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
switch v := r.objPart.(type) {
|
|
|
|
case nil:
|
|
|
|
case *GetObjectPartInit:
|
|
|
|
size += proto.NestedStructureSize(getRespBodyInitField, v)
|
|
|
|
case *GetObjectPartChunk:
|
|
|
|
if v != nil {
|
|
|
|
size += proto.BytesSize(getRespBodyChunkField, v.chunk)
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
case *SplitInfo:
|
|
|
|
size += proto.NestedStructureSize(getRespBodySplitInfoField, v)
|
2024-04-22 10:25:29 +00:00
|
|
|
case *ECInfo:
|
|
|
|
size += proto.NestedStructureSize(getRespBodyECInfoField, v)
|
2021-03-12 12:57:23 +00:00
|
|
|
default:
|
|
|
|
panic("unknown one of object get response body type")
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *GetResponseBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.GetResponse_Body))
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *PutObjectPartInit) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id)
|
|
|
|
offset += proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig)
|
|
|
|
offset += proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr)
|
2023-04-11 07:37:11 +00:00
|
|
|
proto.RepeatedUInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PutObjectPartInit) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(putReqInitObjectIDField, r.id)
|
|
|
|
size += proto.NestedStructureSize(putReqInitSignatureField, r.sig)
|
|
|
|
size += proto.NestedStructureSize(putReqInitHeaderField, r.hdr)
|
2023-04-11 07:37:11 +00:00
|
|
|
|
|
|
|
arrSize, _ := proto.RepeatedUInt32Size(putReqInitCopiesNumField, r.copyNum)
|
|
|
|
size += arrSize
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *PutObjectPartInit) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.PutRequest_Body_Init))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *PutRequestBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
switch v := r.objPart.(type) {
|
|
|
|
case nil:
|
|
|
|
case *PutObjectPartInit:
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(putReqBodyInitField, buf, v)
|
2021-03-12 12:57:23 +00:00
|
|
|
case *PutObjectPartChunk:
|
|
|
|
if v != nil {
|
2022-03-12 12:20:19 +00:00
|
|
|
proto.BytesMarshal(putReqBodyChunkField, buf, v.chunk)
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
default:
|
|
|
|
panic("unknown one of object put request body type")
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PutRequestBody) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
switch v := r.objPart.(type) {
|
|
|
|
case nil:
|
|
|
|
case *PutObjectPartInit:
|
|
|
|
size += proto.NestedStructureSize(putReqBodyInitField, v)
|
|
|
|
case *PutObjectPartChunk:
|
|
|
|
if v != nil {
|
|
|
|
size += proto.BytesSize(putReqBodyChunkField, v.chunk)
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
default:
|
|
|
|
panic("unknown one of object get response body type")
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return size
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *PutRequestBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.PutRequest_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *PutResponseBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(putRespBodyObjectIDField, buf, r.id)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PutResponseBody) StableSize() (size int) {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(putRespBodyObjectIDField, r.id)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *PutResponseBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.PutResponse_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *DeleteRequestBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(deleteReqBodyAddressField, buf, r.addr)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *DeleteRequestBody) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(deleteReqBodyAddressField, r.addr)
|
|
|
|
|
|
|
|
return size
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *DeleteRequestBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.DeleteRequest_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *DeleteResponseBody) StableMarshal(buf []byte) []byte {
|
2020-12-10 09:15:17 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-12-10 09:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(deleteRespBodyTombstoneFNum, buf, r.tombstone)
|
2020-12-10 09:15:17 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *DeleteResponseBody) StableSize() (size int) {
|
2020-12-10 09:15:17 +00:00
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(deleteRespBodyTombstoneFNum, r.tombstone)
|
|
|
|
|
|
|
|
return size
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *DeleteResponseBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.DeleteResponse_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *HeadRequestBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(headReqBodyAddressField, buf[offset:], r.addr)
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.BoolMarshal(headReqBodyMainFlagField, buf[offset:], r.mainOnly)
|
|
|
|
proto.BoolMarshal(headReqBodyRawFlagField, buf[offset:], r.raw)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *HeadRequestBody) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(headReqBodyAddressField, r.addr)
|
|
|
|
size += proto.BoolSize(headReqBodyMainFlagField, r.mainOnly)
|
|
|
|
size += proto.BoolSize(headReqBodyRawFlagField, r.raw)
|
|
|
|
|
|
|
|
return size
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *HeadRequestBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.HeadRequest_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *HeadResponseBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
switch v := r.hdrPart.(type) {
|
|
|
|
case nil:
|
|
|
|
case *HeaderWithSignature:
|
|
|
|
if v != nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v)
|
2021-03-12 12:57:23 +00:00
|
|
|
}
|
|
|
|
case *ShortHeader:
|
|
|
|
if v != nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v)
|
2021-03-12 12:57:23 +00:00
|
|
|
}
|
|
|
|
case *SplitInfo:
|
|
|
|
if v != nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(headRespBodySplitInfoField, buf, v)
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
2024-04-22 10:25:29 +00:00
|
|
|
case *ECInfo:
|
|
|
|
if v != nil {
|
|
|
|
proto.NestedStructureMarshal(headRespBodyECInfoField, buf, v)
|
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
default:
|
|
|
|
panic("unknown one of object put request body type")
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *HeadResponseBody) StableSize() (size int) {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
switch v := r.hdrPart.(type) {
|
|
|
|
case nil:
|
|
|
|
case *HeaderWithSignature:
|
|
|
|
if v != nil {
|
|
|
|
size += proto.NestedStructureSize(headRespBodyHeaderField, v)
|
|
|
|
}
|
|
|
|
case *ShortHeader:
|
|
|
|
if v != nil {
|
|
|
|
size += proto.NestedStructureSize(headRespBodyShortHeaderField, v)
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
case *SplitInfo:
|
|
|
|
if v != nil {
|
|
|
|
size += proto.NestedStructureSize(headRespBodySplitInfoField, v)
|
|
|
|
}
|
2024-04-22 10:25:29 +00:00
|
|
|
case *ECInfo:
|
|
|
|
if v != nil {
|
|
|
|
size += proto.NestedStructureSize(headRespBodyECInfoField, v)
|
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
default:
|
|
|
|
panic("unknown one of object put request body type")
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *HeadResponseBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.HeadResponse_Body))
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (f *SearchFilter) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if f == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, f.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
var offset int
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.EnumMarshal(searchFilterMatchField, buf[offset:], int32(f.matchType))
|
|
|
|
offset += proto.StringMarshal(searchFilterNameField, buf[offset:], f.key)
|
|
|
|
proto.StringMarshal(searchFilterValueField, buf[offset:], f.val)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (f *SearchFilter) StableSize() (size int) {
|
|
|
|
if f == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.EnumSize(searchFilterMatchField, int32(f.matchType))
|
2020-10-27 13:55:19 +00:00
|
|
|
size += proto.StringSize(searchFilterNameField, f.key)
|
2020-08-18 16:46:55 +00:00
|
|
|
size += proto.StringSize(searchFilterValueField, f.val)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (f *SearchFilter) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(f, data, new(object.SearchRequest_Body_Filter))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *SearchRequestBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(searchReqBodyContainerIDField, buf[offset:], r.cid)
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.UInt32Marshal(searchReqBodyVersionField, buf[offset:], r.version)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
for i := range r.filters {
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(searchReqBodyFiltersField, buf[offset:], &r.filters[i])
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *SearchRequestBody) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(searchReqBodyContainerIDField, r.cid)
|
|
|
|
size += proto.UInt32Size(searchReqBodyVersionField, r.version)
|
|
|
|
|
|
|
|
for i := range r.filters {
|
2022-03-02 08:03:56 +00:00
|
|
|
size += proto.NestedStructureSize(searchReqBodyFiltersField, &r.filters[i])
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return size
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *SearchRequestBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.SearchRequest_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *SearchResponseBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
refs.ObjectIDNestedListMarshal(searchRespBodyObjectIDsField, buf[offset:], r.idList)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *SearchResponseBody) StableSize() (size int) {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-12-21 07:51:45 +00:00
|
|
|
size += refs.ObjectIDNestedListSize(searchRespBodyObjectIDsField, r.idList)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *SearchResponseBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.SearchResponse_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *Range) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
var offset int
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.UInt64Marshal(rangeOffsetField, buf[offset:], r.off)
|
|
|
|
proto.UInt64Marshal(rangeLengthField, buf[offset:], r.len)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Range) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.UInt64Size(rangeOffsetField, r.off)
|
|
|
|
size += proto.UInt64Size(rangeLengthField, r.len)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *Range) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.Range))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *GetRangeRequestBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-12-07 15:59:01 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(getRangeReqBodyAddressField, buf[offset:], r.addr)
|
|
|
|
offset += proto.NestedStructureMarshal(getRangeReqBodyRangeField, buf[offset:], r.rng)
|
2022-03-12 12:20:19 +00:00
|
|
|
proto.BoolMarshal(getRangeReqBodyRawField, buf[offset:], r.raw)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *GetRangeRequestBody) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(getRangeReqBodyAddressField, r.addr)
|
|
|
|
size += proto.NestedStructureSize(getRangeReqBodyRangeField, r.rng)
|
2020-12-07 15:59:01 +00:00
|
|
|
size += proto.BoolSize(getRangeReqBodyRawField, r.raw)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
return size
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *GetRangeRequestBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.GetRangeRequest_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *GetRangeResponseBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
switch v := r.rngPart.(type) {
|
|
|
|
case nil:
|
|
|
|
case *GetRangePartChunk:
|
|
|
|
if v != nil {
|
2022-03-12 12:20:19 +00:00
|
|
|
proto.BytesMarshal(getRangeRespChunkField, buf, v.chunk)
|
2021-03-12 12:57:23 +00:00
|
|
|
}
|
|
|
|
case *SplitInfo:
|
|
|
|
if v != nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v)
|
2020-12-07 15:59:01 +00:00
|
|
|
}
|
2024-04-27 20:03:26 +00:00
|
|
|
case *ECInfo:
|
|
|
|
if v != nil {
|
|
|
|
proto.NestedStructureMarshal(getRangeRespECInfoField, buf, v)
|
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
default:
|
|
|
|
panic("unknown one of object get range request body type")
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *GetRangeResponseBody) StableSize() (size int) {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
switch v := r.rngPart.(type) {
|
|
|
|
case nil:
|
|
|
|
case *GetRangePartChunk:
|
|
|
|
if v != nil {
|
|
|
|
size += proto.BytesSize(getRangeRespChunkField, v.chunk)
|
|
|
|
}
|
|
|
|
case *SplitInfo:
|
|
|
|
if v != nil {
|
|
|
|
size = proto.NestedStructureSize(getRangeRespSplitInfoField, v)
|
2020-12-07 15:59:01 +00:00
|
|
|
}
|
2024-04-27 20:03:26 +00:00
|
|
|
case *ECInfo:
|
|
|
|
if v != nil {
|
|
|
|
size = proto.NestedStructureSize(getRangeRespECInfoField, v)
|
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
default:
|
|
|
|
panic("unknown one of object get range request body type")
|
2020-12-07 15:59:01 +00:00
|
|
|
}
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *GetRangeResponseBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.GetRangeResponse_Body))
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
var offset int
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(getRangeHashReqBodyAddressField, buf[offset:], r.addr)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
for i := range r.rngs {
|
2022-04-05 08:24:34 +00:00
|
|
|
offset += proto.NestedStructureMarshal(getRangeHashReqBodyRangesField, buf[offset:], &r.rngs[i])
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.BytesMarshal(getRangeHashReqBodySaltField, buf[offset:], r.salt)
|
|
|
|
proto.EnumMarshal(getRangeHashReqBodyTypeField, buf[offset:], int32(r.typ))
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *GetRangeHashRequestBody) StableSize() (size int) {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(getRangeHashReqBodyAddressField, r.addr)
|
|
|
|
|
|
|
|
for i := range r.rngs {
|
2022-03-02 08:03:56 +00:00
|
|
|
size += proto.NestedStructureSize(getRangeHashReqBodyRangesField, &r.rngs[i])
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size += proto.BytesSize(getRangeHashReqBodySaltField, r.salt)
|
2020-08-20 08:48:35 +00:00
|
|
|
size += proto.EnumSize(getRangeHashReqBodyTypeField, int32(r.typ))
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
return size
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
func (r *GetRangeHashRequestBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.GetRangeHashRequest_Body))
|
|
|
|
}
|
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) []byte {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
2022-04-05 08:24:34 +00:00
|
|
|
return []byte{}
|
2020-08-18 16:46:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
var offset int
|
2020-08-20 08:48:35 +00:00
|
|
|
|
2022-03-12 12:20:19 +00:00
|
|
|
offset += proto.EnumMarshal(getRangeHashRespBodyTypeField, buf, int32(r.typ))
|
|
|
|
proto.RepeatedBytesMarshal(getRangeHashRespBodyHashListField, buf[offset:], r.hashList)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
2022-04-05 08:24:34 +00:00
|
|
|
return buf
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *GetRangeHashResponseBody) StableSize() (size int) {
|
2020-08-18 16:46:55 +00:00
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-08-20 08:48:35 +00:00
|
|
|
size += proto.EnumSize(getRangeHashRespBodyTypeField, int32(r.typ))
|
|
|
|
size += proto.RepeatedBytesSize(getRangeHashRespBodyHashListField, r.hashList)
|
2020-08-18 16:46:55 +00:00
|
|
|
|
|
|
|
return size
|
2020-08-18 15:28:02 +00:00
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
|
|
|
|
func (r *GetRangeHashResponseBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.GetRangeHashResponse_Body))
|
|
|
|
}
|
2023-06-30 12:00:51 +00:00
|
|
|
|
|
|
|
func (r *PutSingleRequestBody) StableMarshal(buf []byte) []byte {
|
|
|
|
if r == nil {
|
|
|
|
return []byte{}
|
|
|
|
}
|
2023-10-06 12:05:30 +00:00
|
|
|
|
|
|
|
if r.marshalData != nil {
|
|
|
|
if buf == nil {
|
|
|
|
return r.marshalData
|
|
|
|
}
|
|
|
|
copy(buf, r.marshalData)
|
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
2023-06-30 12:00:51 +00:00
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
|
|
|
var offset int
|
|
|
|
offset += proto.NestedStructureMarshal(putSingleReqObjectField, buf[offset:], r.object)
|
|
|
|
proto.RepeatedUInt32Marshal(putSingleReqCopiesNumberField, buf[offset:], r.copyNum)
|
|
|
|
|
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
2023-10-06 12:05:30 +00:00
|
|
|
// SetMarshalData sets marshal data to reduce memory allocations.
|
|
|
|
//
|
2024-02-15 12:38:48 +00:00
|
|
|
// It is unsafe to modify/copy request data after setting marshal data.
|
2023-10-06 12:05:30 +00:00
|
|
|
func (r *PutSingleRequestBody) SetMarshalData(data []byte) {
|
|
|
|
if r == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-02-15 12:38:48 +00:00
|
|
|
r.marshalData = data
|
2023-10-06 12:05:30 +00:00
|
|
|
|
|
|
|
proto.NestedStructureSetMarshalData(putSingleReqObjectField, r.marshalData, r.object)
|
|
|
|
}
|
|
|
|
|
2023-06-30 12:00:51 +00:00
|
|
|
func (r *PutSingleRequestBody) StableSize() int {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
var size int
|
|
|
|
size += proto.NestedStructureSize(putSingleReqObjectField, r.object)
|
|
|
|
arrSize, _ := proto.RepeatedUInt32Size(putSingleReqCopiesNumberField, r.copyNum)
|
|
|
|
size += arrSize
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PutSingleRequestBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.PutSingleRequest_Body))
|
|
|
|
}
|
2023-06-30 13:05:37 +00:00
|
|
|
|
|
|
|
func (r *PutSingleResponseBody) StableMarshal(buf []byte) []byte {
|
|
|
|
if r == nil {
|
|
|
|
return []byte{}
|
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PutSingleResponseBody) StableSize() int {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PutSingleResponseBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.PutSingleResponse_Body))
|
|
|
|
}
|
2024-07-24 14:40:47 +00:00
|
|
|
|
|
|
|
func (r *PatchRequestBodyPatch) StableMarshal(buf []byte) []byte {
|
|
|
|
if r == nil {
|
|
|
|
return []byte{}
|
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
|
|
|
var offset int
|
|
|
|
offset += proto.NestedStructureMarshal(patchRequestBodyPatchRangeField, buf[offset:], r.Range)
|
|
|
|
offset += proto.BytesMarshal(patchRequestBodyPatchChunkField, buf[offset:], r.Chunk)
|
|
|
|
|
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PatchRequestBodyPatch) StableSize() int {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
var size int
|
|
|
|
size += proto.NestedStructureSize(patchRequestBodyPatchRangeField, r.Range)
|
|
|
|
size += proto.BytesSize(patchRequestBodyPatchChunkField, r.Chunk)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PatchRequestBodyPatch) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.PatchRequest_Body_Patch))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PatchRequestBody) StableMarshal(buf []byte) []byte {
|
|
|
|
if r == nil {
|
|
|
|
return []byte{}
|
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
|
|
|
var offset int
|
|
|
|
offset += proto.NestedStructureMarshal(patchRequestBodyAddrField, buf[offset:], r.Address)
|
|
|
|
for i := range r.NewAttributes {
|
|
|
|
offset += proto.NestedStructureMarshal(patchRequestBodyNewAttrsField, buf[offset:], &r.NewAttributes[i])
|
|
|
|
}
|
|
|
|
offset += proto.BoolMarshal(patchRequestBodyReplaceAttrField, buf[offset:], r.ReplaceAttributes)
|
|
|
|
offset += proto.NestedStructureMarshal(patchRequestBodyPatchField, buf[offset:], r.Patch)
|
|
|
|
|
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PatchRequestBody) StableSize() int {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
var size int
|
|
|
|
size += proto.NestedStructureSize(patchRequestBodyAddrField, r.Address)
|
|
|
|
for i := range r.NewAttributes {
|
|
|
|
size += proto.NestedStructureSize(patchRequestBodyNewAttrsField, &r.NewAttributes[i])
|
|
|
|
}
|
|
|
|
size += proto.BoolSize(patchRequestBodyReplaceAttrField, r.ReplaceAttributes)
|
|
|
|
size += proto.NestedStructureSize(patchRequestBodyPatchField, r.Patch)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PatchRequestBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.PatchRequest_Body))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PatchResponseBody) StableSize() int {
|
|
|
|
if r == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
var size int
|
|
|
|
size += proto.NestedStructureSize(patchResponseBodyObjectIDField, r.ObjectID)
|
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PatchResponseBody) StableMarshal(buf []byte) []byte {
|
|
|
|
if r == nil {
|
|
|
|
return []byte{}
|
|
|
|
}
|
|
|
|
|
|
|
|
if buf == nil {
|
|
|
|
buf = make([]byte, r.StableSize())
|
|
|
|
}
|
|
|
|
|
|
|
|
var offset int
|
|
|
|
offset += proto.NestedStructureMarshal(patchResponseBodyObjectIDField, buf[offset:], r.ObjectID)
|
|
|
|
|
|
|
|
return buf
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *PatchResponseBody) Unmarshal(data []byte) error {
|
|
|
|
return message.Unmarshal(r, data, new(object.PatchResponse_Body))
|
|
|
|
}
|