github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/object/marshal.go (about)

     1  package object
     2  
     3  import (
     4  	object "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc"
     5  	"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
     6  	"github.com/TrueCloudLab/frostfs-api-go/v2/rpc/message"
     7  	"github.com/TrueCloudLab/frostfs-api-go/v2/util/proto"
     8  )
     9  
    10  const (
    11  	shortHdrVersionField    = 1
    12  	shortHdrEpochField      = 2
    13  	shortHdrOwnerField      = 3
    14  	shortHdrObjectTypeField = 4
    15  	shortHdrPayloadLength   = 5
    16  	shortHdrHashField       = 6
    17  	shortHdrHomoHashField   = 7
    18  
    19  	attributeKeyField   = 1
    20  	attributeValueField = 2
    21  
    22  	splitHdrParentField          = 1
    23  	splitHdrPreviousField        = 2
    24  	splitHdrParentSignatureField = 3
    25  	splitHdrParentHeaderField    = 4
    26  	splitHdrChildrenField        = 5
    27  	splitHdrSplitIDField         = 6
    28  
    29  	hdrVersionField         = 1
    30  	hdrContainerIDField     = 2
    31  	hdrOwnerIDField         = 3
    32  	hdrEpochField           = 4
    33  	hdrPayloadLengthField   = 5
    34  	hdrPayloadHashField     = 6
    35  	hdrObjectTypeField      = 7
    36  	hdrHomomorphicHashField = 8
    37  	hdrSessionTokenField    = 9
    38  	hdrAttributesField      = 10
    39  	hdrSplitField           = 11
    40  
    41  	hdrWithSigHeaderField    = 1
    42  	hdrWithSigSignatureField = 2
    43  
    44  	objIDField        = 1
    45  	objSignatureField = 2
    46  	objHeaderField    = 3
    47  	objPayloadField   = 4
    48  
    49  	splitInfoSplitIDField  = 1
    50  	splitInfoLastPartField = 2
    51  	splitInfoLinkField     = 3
    52  
    53  	getReqBodyAddressField = 1
    54  	getReqBodyRawFlagField = 2
    55  
    56  	getRespInitObjectIDField  = 1
    57  	getRespInitSignatureField = 2
    58  	getRespInitHeaderField    = 3
    59  
    60  	getRespBodyInitField      = 1
    61  	getRespBodyChunkField     = 2
    62  	getRespBodySplitInfoField = 3
    63  
    64  	putReqInitObjectIDField  = 1
    65  	putReqInitSignatureField = 2
    66  	putReqInitHeaderField    = 3
    67  	putReqInitCopiesNumField = 4
    68  
    69  	putReqBodyInitField  = 1
    70  	putReqBodyChunkField = 2
    71  
    72  	putRespBodyObjectIDField = 1
    73  
    74  	deleteReqBodyAddressField = 1
    75  
    76  	deleteRespBodyTombstoneFNum = 1
    77  
    78  	headReqBodyAddressField  = 1
    79  	headReqBodyMainFlagField = 2
    80  	headReqBodyRawFlagField  = 3
    81  
    82  	headRespBodyHeaderField      = 1
    83  	headRespBodyShortHeaderField = 2
    84  	headRespBodySplitInfoField   = 3
    85  
    86  	searchFilterMatchField = 1
    87  	searchFilterNameField  = 2
    88  	searchFilterValueField = 3
    89  
    90  	searchReqBodyContainerIDField = 1
    91  	searchReqBodyVersionField     = 2
    92  	searchReqBodyFiltersField     = 3
    93  
    94  	searchRespBodyObjectIDsField = 1
    95  
    96  	rangeOffsetField = 1
    97  	rangeLengthField = 2
    98  
    99  	getRangeReqBodyAddressField = 1
   100  	getRangeReqBodyRangeField   = 2
   101  	getRangeReqBodyRawField     = 3
   102  
   103  	getRangeRespChunkField     = 1
   104  	getRangeRespSplitInfoField = 2
   105  
   106  	getRangeHashReqBodyAddressField = 1
   107  	getRangeHashReqBodyRangesField  = 2
   108  	getRangeHashReqBodySaltField    = 3
   109  	getRangeHashReqBodyTypeField    = 4
   110  
   111  	getRangeHashRespBodyTypeField     = 1
   112  	getRangeHashRespBodyHashListField = 2
   113  )
   114  
   115  func (h *ShortHeader) StableMarshal(buf []byte) []byte {
   116  	if h == nil {
   117  		return []byte{}
   118  	}
   119  
   120  	if buf == nil {
   121  		buf = make([]byte, h.StableSize())
   122  	}
   123  
   124  	var offset int
   125  
   126  	offset += proto.NestedStructureMarshal(shortHdrVersionField, buf[offset:], h.version)
   127  	offset += proto.UInt64Marshal(shortHdrEpochField, buf[offset:], h.creatEpoch)
   128  	offset += proto.NestedStructureMarshal(shortHdrOwnerField, buf[offset:], h.ownerID)
   129  	offset += proto.EnumMarshal(shortHdrObjectTypeField, buf[offset:], int32(h.typ))
   130  	offset += proto.UInt64Marshal(shortHdrPayloadLength, buf[offset:], h.payloadLen)
   131  	offset += proto.NestedStructureMarshal(shortHdrHashField, buf[offset:], h.payloadHash)
   132  	proto.NestedStructureMarshal(shortHdrHomoHashField, buf[offset:], h.homoHash)
   133  
   134  	return buf
   135  }
   136  
   137  func (h *ShortHeader) StableSize() (size int) {
   138  	if h == nil {
   139  		return 0
   140  	}
   141  
   142  	size += proto.NestedStructureSize(shortHdrVersionField, h.version)
   143  	size += proto.UInt64Size(shortHdrEpochField, h.creatEpoch)
   144  	size += proto.NestedStructureSize(shortHdrOwnerField, h.ownerID)
   145  	size += proto.EnumSize(shortHdrObjectTypeField, int32(h.typ))
   146  	size += proto.UInt64Size(shortHdrPayloadLength, h.payloadLen)
   147  	size += proto.NestedStructureSize(shortHdrHashField, h.payloadHash)
   148  	size += proto.NestedStructureSize(shortHdrHomoHashField, h.homoHash)
   149  
   150  	return size
   151  }
   152  
   153  func (h *ShortHeader) Unmarshal(data []byte) error {
   154  	return message.Unmarshal(h, data, new(object.ShortHeader))
   155  }
   156  
   157  func (a *Attribute) StableMarshal(buf []byte) []byte {
   158  	if a == nil {
   159  		return []byte{}
   160  	}
   161  
   162  	if buf == nil {
   163  		buf = make([]byte, a.StableSize())
   164  	}
   165  
   166  	var offset int
   167  
   168  	offset += proto.StringMarshal(attributeKeyField, buf[offset:], a.key)
   169  	proto.StringMarshal(attributeValueField, buf[offset:], a.val)
   170  
   171  	return buf
   172  }
   173  
   174  func (a *Attribute) StableSize() (size int) {
   175  	if a == nil {
   176  		return 0
   177  	}
   178  
   179  	size += proto.StringSize(shortHdrVersionField, a.key)
   180  	size += proto.StringSize(shortHdrEpochField, a.val)
   181  
   182  	return size
   183  }
   184  
   185  func (a *Attribute) Unmarshal(data []byte) error {
   186  	return message.Unmarshal(a, data, new(object.Header_Attribute))
   187  }
   188  
   189  func (h *SplitHeader) StableMarshal(buf []byte) []byte {
   190  	if h == nil {
   191  		return []byte{}
   192  	}
   193  
   194  	if buf == nil {
   195  		buf = make([]byte, h.StableSize())
   196  	}
   197  
   198  	var offset int
   199  
   200  	offset += proto.NestedStructureMarshal(splitHdrParentField, buf[offset:], h.par)
   201  	offset += proto.NestedStructureMarshal(splitHdrPreviousField, buf[offset:], h.prev)
   202  	offset += proto.NestedStructureMarshal(splitHdrParentSignatureField, buf[offset:], h.parSig)
   203  	offset += proto.NestedStructureMarshal(splitHdrParentHeaderField, buf[offset:], h.parHdr)
   204  	offset += refs.ObjectIDNestedListMarshal(splitHdrChildrenField, buf[offset:], h.children)
   205  	proto.BytesMarshal(splitHdrSplitIDField, buf[offset:], h.splitID)
   206  
   207  	return buf
   208  }
   209  
   210  func (h *SplitHeader) StableSize() (size int) {
   211  	if h == nil {
   212  		return 0
   213  	}
   214  
   215  	size += proto.NestedStructureSize(splitHdrParentField, h.par)
   216  	size += proto.NestedStructureSize(splitHdrPreviousField, h.prev)
   217  	size += proto.NestedStructureSize(splitHdrParentSignatureField, h.parSig)
   218  	size += proto.NestedStructureSize(splitHdrParentHeaderField, h.parHdr)
   219  	size += refs.ObjectIDNestedListSize(splitHdrChildrenField, h.children)
   220  	size += proto.BytesSize(splitHdrSplitIDField, h.splitID)
   221  
   222  	return size
   223  }
   224  
   225  func (h *SplitHeader) Unmarshal(data []byte) error {
   226  	return message.Unmarshal(h, data, new(object.Header_Split))
   227  }
   228  
   229  func (h *Header) StableMarshal(buf []byte) []byte {
   230  	if h == nil {
   231  		return []byte{}
   232  	}
   233  
   234  	if buf == nil {
   235  		buf = make([]byte, h.StableSize())
   236  	}
   237  
   238  	var offset int
   239  
   240  	offset += proto.NestedStructureMarshal(hdrVersionField, buf[offset:], h.version)
   241  	offset += proto.NestedStructureMarshal(hdrContainerIDField, buf[offset:], h.cid)
   242  	offset += proto.NestedStructureMarshal(hdrOwnerIDField, buf[offset:], h.ownerID)
   243  	offset += proto.UInt64Marshal(hdrEpochField, buf[offset:], h.creatEpoch)
   244  	offset += proto.UInt64Marshal(hdrPayloadLengthField, buf[offset:], h.payloadLen)
   245  	offset += proto.NestedStructureMarshal(hdrPayloadHashField, buf[offset:], h.payloadHash)
   246  	offset += proto.EnumMarshal(hdrObjectTypeField, buf[offset:], int32(h.typ))
   247  	offset += proto.NestedStructureMarshal(hdrHomomorphicHashField, buf[offset:], h.homoHash)
   248  	offset += proto.NestedStructureMarshal(hdrSessionTokenField, buf[offset:], h.sessionToken)
   249  
   250  	for i := range h.attr {
   251  		offset += proto.NestedStructureMarshal(hdrAttributesField, buf[offset:], &h.attr[i])
   252  	}
   253  
   254  	proto.NestedStructureMarshal(hdrSplitField, buf[offset:], h.split)
   255  
   256  	return buf
   257  }
   258  
   259  func (h *Header) StableSize() (size int) {
   260  	if h == nil {
   261  		return 0
   262  	}
   263  
   264  	size += proto.NestedStructureSize(hdrVersionField, h.version)
   265  	size += proto.NestedStructureSize(hdrContainerIDField, h.cid)
   266  	size += proto.NestedStructureSize(hdrOwnerIDField, h.ownerID)
   267  	size += proto.UInt64Size(hdrEpochField, h.creatEpoch)
   268  	size += proto.UInt64Size(hdrPayloadLengthField, h.payloadLen)
   269  	size += proto.NestedStructureSize(hdrPayloadHashField, h.payloadHash)
   270  	size += proto.EnumSize(hdrObjectTypeField, int32(h.typ))
   271  	size += proto.NestedStructureSize(hdrHomomorphicHashField, h.homoHash)
   272  	size += proto.NestedStructureSize(hdrSessionTokenField, h.sessionToken)
   273  	for i := range h.attr {
   274  		size += proto.NestedStructureSize(hdrAttributesField, &h.attr[i])
   275  	}
   276  	size += proto.NestedStructureSize(hdrSplitField, h.split)
   277  
   278  	return size
   279  }
   280  
   281  func (h *Header) Unmarshal(data []byte) error {
   282  	return message.Unmarshal(h, data, new(object.Header))
   283  }
   284  
   285  func (h *HeaderWithSignature) StableMarshal(buf []byte) []byte {
   286  	if h == nil {
   287  		return []byte{}
   288  	}
   289  
   290  	if buf == nil {
   291  		buf = make([]byte, h.StableSize())
   292  	}
   293  
   294  	var offset int
   295  
   296  	offset += proto.NestedStructureMarshal(hdrWithSigHeaderField, buf[offset:], h.header)
   297  	proto.NestedStructureMarshal(hdrWithSigSignatureField, buf[offset:], h.signature)
   298  
   299  	return buf
   300  }
   301  
   302  func (h *HeaderWithSignature) StableSize() (size int) {
   303  	if h == nil {
   304  		return 0
   305  	}
   306  
   307  	size += proto.NestedStructureSize(hdrVersionField, h.header)
   308  	size += proto.NestedStructureSize(hdrContainerIDField, h.signature)
   309  
   310  	return size
   311  }
   312  
   313  func (h *HeaderWithSignature) Unmarshal(data []byte) error {
   314  	return message.Unmarshal(h, data, new(object.HeaderWithSignature))
   315  }
   316  
   317  func (o *Object) StableMarshal(buf []byte) []byte {
   318  	if o == nil {
   319  		return []byte{}
   320  	}
   321  
   322  	if buf == nil {
   323  		buf = make([]byte, o.StableSize())
   324  	}
   325  
   326  	var offset int
   327  
   328  	offset += proto.NestedStructureMarshal(objIDField, buf[offset:], o.objectID)
   329  	offset += proto.NestedStructureMarshal(objSignatureField, buf[offset:], o.idSig)
   330  	offset += proto.NestedStructureMarshal(objHeaderField, buf[offset:], o.header)
   331  	proto.BytesMarshal(objPayloadField, buf[offset:], o.payload)
   332  
   333  	return buf
   334  }
   335  
   336  func (o *Object) StableSize() (size int) {
   337  	if o == nil {
   338  		return 0
   339  	}
   340  
   341  	size += proto.NestedStructureSize(objIDField, o.objectID)
   342  	size += proto.NestedStructureSize(objSignatureField, o.idSig)
   343  	size += proto.NestedStructureSize(objHeaderField, o.header)
   344  	size += proto.BytesSize(objPayloadField, o.payload)
   345  
   346  	return size
   347  }
   348  
   349  func (o *Object) Unmarshal(data []byte) error {
   350  	return message.Unmarshal(o, data, new(object.Object))
   351  }
   352  
   353  func (s *SplitInfo) StableMarshal(buf []byte) []byte {
   354  	if s == nil {
   355  		return []byte{}
   356  	}
   357  
   358  	if buf == nil {
   359  		buf = make([]byte, s.StableSize())
   360  	}
   361  
   362  	var offset int
   363  
   364  	offset += proto.BytesMarshal(splitInfoSplitIDField, buf[offset:], s.splitID)
   365  	offset += proto.NestedStructureMarshal(splitInfoLastPartField, buf[offset:], s.lastPart)
   366  	proto.NestedStructureMarshal(splitInfoLinkField, buf[offset:], s.link)
   367  
   368  	return buf
   369  }
   370  
   371  func (s *SplitInfo) StableSize() (size int) {
   372  	if s == nil {
   373  		return 0
   374  	}
   375  
   376  	size += proto.BytesSize(splitInfoSplitIDField, s.splitID)
   377  	size += proto.NestedStructureSize(splitInfoLastPartField, s.lastPart)
   378  	size += proto.NestedStructureSize(splitInfoLinkField, s.link)
   379  
   380  	return size
   381  }
   382  
   383  func (s *SplitInfo) Unmarshal(data []byte) error {
   384  	return message.Unmarshal(s, data, new(object.SplitInfo))
   385  }
   386  
   387  func (r *GetRequestBody) StableMarshal(buf []byte) []byte {
   388  	if r == nil {
   389  		return []byte{}
   390  	}
   391  
   392  	if buf == nil {
   393  		buf = make([]byte, r.StableSize())
   394  	}
   395  
   396  	var offset int
   397  
   398  	offset += proto.NestedStructureMarshal(getReqBodyAddressField, buf[offset:], r.addr)
   399  	proto.BoolMarshal(getReqBodyRawFlagField, buf[offset:], r.raw)
   400  
   401  	return buf
   402  }
   403  
   404  func (r *GetRequestBody) StableSize() (size int) {
   405  	if r == nil {
   406  		return 0
   407  	}
   408  
   409  	size += proto.NestedStructureSize(getReqBodyAddressField, r.addr)
   410  	size += proto.BoolSize(getReqBodyRawFlagField, r.raw)
   411  
   412  	return size
   413  }
   414  
   415  func (r *GetRequestBody) Unmarshal(data []byte) error {
   416  	return message.Unmarshal(r, data, new(object.GetRequest_Body))
   417  }
   418  
   419  func (r *GetObjectPartInit) StableMarshal(buf []byte) []byte {
   420  	if r == nil {
   421  		return []byte{}
   422  	}
   423  
   424  	if buf == nil {
   425  		buf = make([]byte, r.StableSize())
   426  	}
   427  
   428  	var offset int
   429  
   430  	offset += proto.NestedStructureMarshal(getRespInitObjectIDField, buf[offset:], r.id)
   431  	offset += proto.NestedStructureMarshal(getRespInitSignatureField, buf[offset:], r.sig)
   432  	proto.NestedStructureMarshal(getRespInitHeaderField, buf[offset:], r.hdr)
   433  
   434  	return buf
   435  }
   436  
   437  func (r *GetObjectPartInit) StableSize() (size int) {
   438  	if r == nil {
   439  		return 0
   440  	}
   441  
   442  	size += proto.NestedStructureSize(getRespInitObjectIDField, r.id)
   443  	size += proto.NestedStructureSize(getRespInitSignatureField, r.sig)
   444  	size += proto.NestedStructureSize(getRespInitHeaderField, r.hdr)
   445  
   446  	return size
   447  }
   448  
   449  func (r *GetObjectPartInit) Unmarshal(data []byte) error {
   450  	return message.Unmarshal(r, data, new(object.GetResponse_Body_Init))
   451  }
   452  
   453  func (r *GetResponseBody) StableMarshal(buf []byte) []byte {
   454  	if r == nil {
   455  		return []byte{}
   456  	}
   457  
   458  	if buf == nil {
   459  		buf = make([]byte, r.StableSize())
   460  	}
   461  
   462  	switch v := r.objPart.(type) {
   463  	case nil:
   464  	case *GetObjectPartInit:
   465  		proto.NestedStructureMarshal(getRespBodyInitField, buf, v)
   466  	case *GetObjectPartChunk:
   467  		if v != nil {
   468  			proto.BytesMarshal(getRespBodyChunkField, buf, v.chunk)
   469  		}
   470  	case *SplitInfo:
   471  		proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v)
   472  	default:
   473  		panic("unknown one of object get response body type")
   474  	}
   475  
   476  	return buf
   477  }
   478  
   479  func (r *GetResponseBody) StableSize() (size int) {
   480  	if r == nil {
   481  		return 0
   482  	}
   483  
   484  	switch v := r.objPart.(type) {
   485  	case nil:
   486  	case *GetObjectPartInit:
   487  		size += proto.NestedStructureSize(getRespBodyInitField, v)
   488  	case *GetObjectPartChunk:
   489  		if v != nil {
   490  			size += proto.BytesSize(getRespBodyChunkField, v.chunk)
   491  		}
   492  	case *SplitInfo:
   493  		size += proto.NestedStructureSize(getRespBodySplitInfoField, v)
   494  	default:
   495  		panic("unknown one of object get response body type")
   496  	}
   497  
   498  	return
   499  }
   500  
   501  func (r *GetResponseBody) Unmarshal(data []byte) error {
   502  	return message.Unmarshal(r, data, new(object.GetResponse_Body))
   503  }
   504  
   505  func (r *PutObjectPartInit) StableMarshal(buf []byte) []byte {
   506  	if r == nil {
   507  		return []byte{}
   508  	}
   509  
   510  	if buf == nil {
   511  		buf = make([]byte, r.StableSize())
   512  	}
   513  
   514  	var offset int
   515  
   516  	offset += proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id)
   517  	offset += proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig)
   518  	offset += proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr)
   519  	proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum)
   520  
   521  	return buf
   522  }
   523  
   524  func (r *PutObjectPartInit) StableSize() (size int) {
   525  	if r == nil {
   526  		return 0
   527  	}
   528  
   529  	size += proto.NestedStructureSize(putReqInitObjectIDField, r.id)
   530  	size += proto.NestedStructureSize(putReqInitSignatureField, r.sig)
   531  	size += proto.NestedStructureSize(putReqInitHeaderField, r.hdr)
   532  	size += proto.UInt32Size(putReqInitCopiesNumField, r.copyNum)
   533  
   534  	return size
   535  }
   536  
   537  func (r *PutObjectPartInit) Unmarshal(data []byte) error {
   538  	return message.Unmarshal(r, data, new(object.PutRequest_Body_Init))
   539  }
   540  
   541  func (r *PutRequestBody) StableMarshal(buf []byte) []byte {
   542  	if r == nil {
   543  		return []byte{}
   544  	}
   545  
   546  	if buf == nil {
   547  		buf = make([]byte, r.StableSize())
   548  	}
   549  
   550  	switch v := r.objPart.(type) {
   551  	case nil:
   552  	case *PutObjectPartInit:
   553  		proto.NestedStructureMarshal(putReqBodyInitField, buf, v)
   554  	case *PutObjectPartChunk:
   555  		if v != nil {
   556  			proto.BytesMarshal(putReqBodyChunkField, buf, v.chunk)
   557  		}
   558  	default:
   559  		panic("unknown one of object put request body type")
   560  	}
   561  
   562  	return buf
   563  }
   564  
   565  func (r *PutRequestBody) StableSize() (size int) {
   566  	if r == nil {
   567  		return 0
   568  	}
   569  
   570  	switch v := r.objPart.(type) {
   571  	case nil:
   572  	case *PutObjectPartInit:
   573  		size += proto.NestedStructureSize(putReqBodyInitField, v)
   574  	case *PutObjectPartChunk:
   575  		if v != nil {
   576  			size += proto.BytesSize(putReqBodyChunkField, v.chunk)
   577  		}
   578  	default:
   579  		panic("unknown one of object get response body type")
   580  	}
   581  
   582  	return size
   583  }
   584  
   585  func (r *PutRequestBody) Unmarshal(data []byte) error {
   586  	return message.Unmarshal(r, data, new(object.PutRequest_Body))
   587  }
   588  
   589  func (r *PutResponseBody) StableMarshal(buf []byte) []byte {
   590  	if r == nil {
   591  		return []byte{}
   592  	}
   593  
   594  	if buf == nil {
   595  		buf = make([]byte, r.StableSize())
   596  	}
   597  
   598  	proto.NestedStructureMarshal(putRespBodyObjectIDField, buf, r.id)
   599  
   600  	return buf
   601  }
   602  
   603  func (r *PutResponseBody) StableSize() (size int) {
   604  	if r == nil {
   605  		return 0
   606  	}
   607  
   608  	size += proto.NestedStructureSize(putRespBodyObjectIDField, r.id)
   609  
   610  	return size
   611  }
   612  
   613  func (r *PutResponseBody) Unmarshal(data []byte) error {
   614  	return message.Unmarshal(r, data, new(object.PutResponse_Body))
   615  }
   616  
   617  func (r *DeleteRequestBody) StableMarshal(buf []byte) []byte {
   618  	if r == nil {
   619  		return []byte{}
   620  	}
   621  
   622  	if buf == nil {
   623  		buf = make([]byte, r.StableSize())
   624  	}
   625  
   626  	proto.NestedStructureMarshal(deleteReqBodyAddressField, buf, r.addr)
   627  
   628  	return buf
   629  }
   630  
   631  func (r *DeleteRequestBody) StableSize() (size int) {
   632  	if r == nil {
   633  		return 0
   634  	}
   635  
   636  	size += proto.NestedStructureSize(deleteReqBodyAddressField, r.addr)
   637  
   638  	return size
   639  }
   640  
   641  func (r *DeleteRequestBody) Unmarshal(data []byte) error {
   642  	return message.Unmarshal(r, data, new(object.DeleteRequest_Body))
   643  }
   644  
   645  func (r *DeleteResponseBody) StableMarshal(buf []byte) []byte {
   646  	if r == nil {
   647  		return []byte{}
   648  	}
   649  
   650  	if buf == nil {
   651  		buf = make([]byte, r.StableSize())
   652  	}
   653  
   654  	proto.NestedStructureMarshal(deleteRespBodyTombstoneFNum, buf, r.tombstone)
   655  
   656  	return buf
   657  }
   658  
   659  func (r *DeleteResponseBody) StableSize() (size int) {
   660  	if r == nil {
   661  		return 0
   662  	}
   663  
   664  	size += proto.NestedStructureSize(deleteRespBodyTombstoneFNum, r.tombstone)
   665  
   666  	return size
   667  }
   668  
   669  func (r *DeleteResponseBody) Unmarshal(data []byte) error {
   670  	return message.Unmarshal(r, data, new(object.DeleteResponse_Body))
   671  }
   672  
   673  func (r *HeadRequestBody) StableMarshal(buf []byte) []byte {
   674  	if r == nil {
   675  		return []byte{}
   676  	}
   677  
   678  	if buf == nil {
   679  		buf = make([]byte, r.StableSize())
   680  	}
   681  
   682  	var offset int
   683  
   684  	offset += proto.NestedStructureMarshal(headReqBodyAddressField, buf[offset:], r.addr)
   685  	offset += proto.BoolMarshal(headReqBodyMainFlagField, buf[offset:], r.mainOnly)
   686  	proto.BoolMarshal(headReqBodyRawFlagField, buf[offset:], r.raw)
   687  
   688  	return buf
   689  }
   690  
   691  func (r *HeadRequestBody) StableSize() (size int) {
   692  	if r == nil {
   693  		return 0
   694  	}
   695  
   696  	size += proto.NestedStructureSize(headReqBodyAddressField, r.addr)
   697  	size += proto.BoolSize(headReqBodyMainFlagField, r.mainOnly)
   698  	size += proto.BoolSize(headReqBodyRawFlagField, r.raw)
   699  
   700  	return size
   701  }
   702  
   703  func (r *HeadRequestBody) Unmarshal(data []byte) error {
   704  	return message.Unmarshal(r, data, new(object.HeadRequest_Body))
   705  }
   706  
   707  func (r *HeadResponseBody) StableMarshal(buf []byte) []byte {
   708  	if r == nil {
   709  		return []byte{}
   710  	}
   711  
   712  	if buf == nil {
   713  		buf = make([]byte, r.StableSize())
   714  	}
   715  
   716  	switch v := r.hdrPart.(type) {
   717  	case nil:
   718  	case *HeaderWithSignature:
   719  		if v != nil {
   720  			proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v)
   721  		}
   722  	case *ShortHeader:
   723  		if v != nil {
   724  			proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v)
   725  		}
   726  	case *SplitInfo:
   727  		if v != nil {
   728  			proto.NestedStructureMarshal(headRespBodySplitInfoField, buf, v)
   729  		}
   730  	default:
   731  		panic("unknown one of object put request body type")
   732  	}
   733  
   734  	return buf
   735  }
   736  
   737  func (r *HeadResponseBody) StableSize() (size int) {
   738  	if r == nil {
   739  		return 0
   740  	}
   741  
   742  	switch v := r.hdrPart.(type) {
   743  	case nil:
   744  	case *HeaderWithSignature:
   745  		if v != nil {
   746  			size += proto.NestedStructureSize(headRespBodyHeaderField, v)
   747  		}
   748  	case *ShortHeader:
   749  		if v != nil {
   750  			size += proto.NestedStructureSize(headRespBodyShortHeaderField, v)
   751  		}
   752  	case *SplitInfo:
   753  		if v != nil {
   754  			size += proto.NestedStructureSize(headRespBodySplitInfoField, v)
   755  		}
   756  	default:
   757  		panic("unknown one of object put request body type")
   758  	}
   759  
   760  	return
   761  }
   762  
   763  func (r *HeadResponseBody) Unmarshal(data []byte) error {
   764  	return message.Unmarshal(r, data, new(object.HeadResponse_Body))
   765  }
   766  
   767  func (f *SearchFilter) StableMarshal(buf []byte) []byte {
   768  	if f == nil {
   769  		return []byte{}
   770  	}
   771  
   772  	if buf == nil {
   773  		buf = make([]byte, f.StableSize())
   774  	}
   775  
   776  	var offset int
   777  
   778  	offset += proto.EnumMarshal(searchFilterMatchField, buf[offset:], int32(f.matchType))
   779  	offset += proto.StringMarshal(searchFilterNameField, buf[offset:], f.key)
   780  	proto.StringMarshal(searchFilterValueField, buf[offset:], f.val)
   781  
   782  	return buf
   783  }
   784  
   785  func (f *SearchFilter) StableSize() (size int) {
   786  	if f == nil {
   787  		return 0
   788  	}
   789  
   790  	size += proto.EnumSize(searchFilterMatchField, int32(f.matchType))
   791  	size += proto.StringSize(searchFilterNameField, f.key)
   792  	size += proto.StringSize(searchFilterValueField, f.val)
   793  
   794  	return size
   795  }
   796  
   797  func (f *SearchFilter) Unmarshal(data []byte) error {
   798  	return message.Unmarshal(f, data, new(object.SearchRequest_Body_Filter))
   799  }
   800  
   801  func (r *SearchRequestBody) StableMarshal(buf []byte) []byte {
   802  	if r == nil {
   803  		return []byte{}
   804  	}
   805  
   806  	if buf == nil {
   807  		buf = make([]byte, r.StableSize())
   808  	}
   809  
   810  	var offset int
   811  
   812  	offset += proto.NestedStructureMarshal(searchReqBodyContainerIDField, buf[offset:], r.cid)
   813  	offset += proto.UInt32Marshal(searchReqBodyVersionField, buf[offset:], r.version)
   814  
   815  	for i := range r.filters {
   816  		offset += proto.NestedStructureMarshal(searchReqBodyFiltersField, buf[offset:], &r.filters[i])
   817  	}
   818  
   819  	return buf
   820  }
   821  
   822  func (r *SearchRequestBody) StableSize() (size int) {
   823  	if r == nil {
   824  		return 0
   825  	}
   826  
   827  	size += proto.NestedStructureSize(searchReqBodyContainerIDField, r.cid)
   828  	size += proto.UInt32Size(searchReqBodyVersionField, r.version)
   829  
   830  	for i := range r.filters {
   831  		size += proto.NestedStructureSize(searchReqBodyFiltersField, &r.filters[i])
   832  	}
   833  
   834  	return size
   835  }
   836  
   837  func (r *SearchRequestBody) Unmarshal(data []byte) error {
   838  	return message.Unmarshal(r, data, new(object.SearchRequest_Body))
   839  }
   840  
   841  func (r *SearchResponseBody) StableMarshal(buf []byte) []byte {
   842  	if r == nil {
   843  		return []byte{}
   844  	}
   845  
   846  	if buf == nil {
   847  		buf = make([]byte, r.StableSize())
   848  	}
   849  
   850  	var offset int
   851  
   852  	refs.ObjectIDNestedListMarshal(searchRespBodyObjectIDsField, buf[offset:], r.idList)
   853  
   854  	return buf
   855  }
   856  
   857  func (r *SearchResponseBody) StableSize() (size int) {
   858  	if r == nil {
   859  		return 0
   860  	}
   861  
   862  	size += refs.ObjectIDNestedListSize(searchRespBodyObjectIDsField, r.idList)
   863  
   864  	return size
   865  }
   866  
   867  func (r *SearchResponseBody) Unmarshal(data []byte) error {
   868  	return message.Unmarshal(r, data, new(object.SearchResponse_Body))
   869  }
   870  
   871  func (r *Range) StableMarshal(buf []byte) []byte {
   872  	if r == nil {
   873  		return []byte{}
   874  	}
   875  
   876  	if buf == nil {
   877  		buf = make([]byte, r.StableSize())
   878  	}
   879  
   880  	var offset int
   881  
   882  	offset += proto.UInt64Marshal(rangeOffsetField, buf[offset:], r.off)
   883  	proto.UInt64Marshal(rangeLengthField, buf[offset:], r.len)
   884  
   885  	return buf
   886  }
   887  
   888  func (r *Range) StableSize() (size int) {
   889  	if r == nil {
   890  		return 0
   891  	}
   892  
   893  	size += proto.UInt64Size(rangeOffsetField, r.off)
   894  	size += proto.UInt64Size(rangeLengthField, r.len)
   895  
   896  	return size
   897  }
   898  
   899  func (r *Range) Unmarshal(data []byte) error {
   900  	return message.Unmarshal(r, data, new(object.Range))
   901  }
   902  
   903  func (r *GetRangeRequestBody) StableMarshal(buf []byte) []byte {
   904  	if r == nil {
   905  		return []byte{}
   906  	}
   907  
   908  	if buf == nil {
   909  		buf = make([]byte, r.StableSize())
   910  	}
   911  
   912  	var offset int
   913  
   914  	offset += proto.NestedStructureMarshal(getRangeReqBodyAddressField, buf[offset:], r.addr)
   915  	offset += proto.NestedStructureMarshal(getRangeReqBodyRangeField, buf[offset:], r.rng)
   916  	proto.BoolMarshal(getRangeReqBodyRawField, buf[offset:], r.raw)
   917  
   918  	return buf
   919  }
   920  
   921  func (r *GetRangeRequestBody) StableSize() (size int) {
   922  	if r == nil {
   923  		return 0
   924  	}
   925  
   926  	size += proto.NestedStructureSize(getRangeReqBodyAddressField, r.addr)
   927  	size += proto.NestedStructureSize(getRangeReqBodyRangeField, r.rng)
   928  	size += proto.BoolSize(getRangeReqBodyRawField, r.raw)
   929  
   930  	return size
   931  }
   932  
   933  func (r *GetRangeRequestBody) Unmarshal(data []byte) error {
   934  	return message.Unmarshal(r, data, new(object.GetRangeRequest_Body))
   935  }
   936  
   937  func (r *GetRangeResponseBody) StableMarshal(buf []byte) []byte {
   938  	if r == nil {
   939  		return []byte{}
   940  	}
   941  
   942  	if buf == nil {
   943  		buf = make([]byte, r.StableSize())
   944  	}
   945  
   946  	switch v := r.rngPart.(type) {
   947  	case nil:
   948  	case *GetRangePartChunk:
   949  		if v != nil {
   950  			proto.BytesMarshal(getRangeRespChunkField, buf, v.chunk)
   951  		}
   952  	case *SplitInfo:
   953  		if v != nil {
   954  			proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v)
   955  		}
   956  	default:
   957  		panic("unknown one of object get range request body type")
   958  	}
   959  
   960  	return buf
   961  }
   962  
   963  func (r *GetRangeResponseBody) StableSize() (size int) {
   964  	if r == nil {
   965  		return 0
   966  	}
   967  
   968  	switch v := r.rngPart.(type) {
   969  	case nil:
   970  	case *GetRangePartChunk:
   971  		if v != nil {
   972  			size += proto.BytesSize(getRangeRespChunkField, v.chunk)
   973  		}
   974  	case *SplitInfo:
   975  		if v != nil {
   976  			size = proto.NestedStructureSize(getRangeRespSplitInfoField, v)
   977  		}
   978  	default:
   979  		panic("unknown one of object get range request body type")
   980  	}
   981  
   982  	return
   983  }
   984  
   985  func (r *GetRangeResponseBody) Unmarshal(data []byte) error {
   986  	return message.Unmarshal(r, data, new(object.GetRangeResponse_Body))
   987  }
   988  
   989  func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) []byte {
   990  	if r == nil {
   991  		return []byte{}
   992  	}
   993  
   994  	if buf == nil {
   995  		buf = make([]byte, r.StableSize())
   996  	}
   997  
   998  	var offset int
   999  
  1000  	offset += proto.NestedStructureMarshal(getRangeHashReqBodyAddressField, buf[offset:], r.addr)
  1001  
  1002  	for i := range r.rngs {
  1003  		offset += proto.NestedStructureMarshal(getRangeHashReqBodyRangesField, buf[offset:], &r.rngs[i])
  1004  	}
  1005  
  1006  	offset += proto.BytesMarshal(getRangeHashReqBodySaltField, buf[offset:], r.salt)
  1007  	proto.EnumMarshal(getRangeHashReqBodyTypeField, buf[offset:], int32(r.typ))
  1008  
  1009  	return buf
  1010  }
  1011  
  1012  func (r *GetRangeHashRequestBody) StableSize() (size int) {
  1013  	if r == nil {
  1014  		return 0
  1015  	}
  1016  
  1017  	size += proto.NestedStructureSize(getRangeHashReqBodyAddressField, r.addr)
  1018  
  1019  	for i := range r.rngs {
  1020  		size += proto.NestedStructureSize(getRangeHashReqBodyRangesField, &r.rngs[i])
  1021  	}
  1022  
  1023  	size += proto.BytesSize(getRangeHashReqBodySaltField, r.salt)
  1024  	size += proto.EnumSize(getRangeHashReqBodyTypeField, int32(r.typ))
  1025  
  1026  	return size
  1027  }
  1028  
  1029  func (r *GetRangeHashRequestBody) Unmarshal(data []byte) error {
  1030  	return message.Unmarshal(r, data, new(object.GetRangeHashRequest_Body))
  1031  }
  1032  
  1033  func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) []byte {
  1034  	if r == nil {
  1035  		return []byte{}
  1036  	}
  1037  
  1038  	if buf == nil {
  1039  		buf = make([]byte, r.StableSize())
  1040  	}
  1041  
  1042  	var offset int
  1043  
  1044  	offset += proto.EnumMarshal(getRangeHashRespBodyTypeField, buf, int32(r.typ))
  1045  	proto.RepeatedBytesMarshal(getRangeHashRespBodyHashListField, buf[offset:], r.hashList)
  1046  
  1047  	return buf
  1048  }
  1049  
  1050  func (r *GetRangeHashResponseBody) StableSize() (size int) {
  1051  	if r == nil {
  1052  		return 0
  1053  	}
  1054  
  1055  	size += proto.EnumSize(getRangeHashRespBodyTypeField, int32(r.typ))
  1056  	size += proto.RepeatedBytesSize(getRangeHashRespBodyHashListField, r.hashList)
  1057  
  1058  	return size
  1059  }
  1060  
  1061  func (r *GetRangeHashResponseBody) Unmarshal(data []byte) error {
  1062  	return message.Unmarshal(r, data, new(object.GetRangeHashResponse_Body))
  1063  }