forked from TrueCloudLab/frostfs-api-go
[#45] api-go: Add PutSingle request wrappers
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
b17995a238
commit
2cb57a8835
6 changed files with 157 additions and 0 deletions
|
@ -110,6 +110,9 @@ const (
|
|||
|
||||
getRangeHashRespBodyTypeField = 1
|
||||
getRangeHashRespBodyHashListField = 2
|
||||
|
||||
putSingleReqObjectField = 1
|
||||
putSingleReqCopiesNumberField = 2
|
||||
)
|
||||
|
||||
func (h *ShortHeader) StableMarshal(buf []byte) []byte {
|
||||
|
@ -1063,3 +1066,35 @@ func (r *GetRangeHashResponseBody) StableSize() (size int) {
|
|||
func (r *GetRangeHashResponseBody) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(r, data, new(object.GetRangeHashResponse_Body))
|
||||
}
|
||||
|
||||
func (r *PutSingleRequestBody) StableMarshal(buf []byte) []byte {
|
||||
if r == nil {
|
||||
return []byte{}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue