forked from TrueCloudLab/frostfs-api-go
[#274] reputation: Adapt converters and encoding methods on messages
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
1076478b29
commit
541a56aae1
4 changed files with 38 additions and 1 deletions
|
@ -277,6 +277,7 @@ func (x *SendLocalTrustResponseBody) Unmarshal(data []byte) error {
|
|||
|
||||
const (
|
||||
_ = iota
|
||||
sendInterResBodyEpochFNum
|
||||
sendInterResBodyIterFNum
|
||||
sendInterResBodyTrustFNum
|
||||
)
|
||||
|
@ -290,11 +291,25 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e
|
|||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
|
||||
offset, err := protoutil.UInt32Marshal(sendInterResBodyIterFNum, buf, x.iter)
|
||||
var (
|
||||
offset, n int
|
||||
err error
|
||||
)
|
||||
|
||||
n, err = protoutil.UInt64Marshal(sendInterResBodyEpochFNum, buf, x.epoch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
offset += n
|
||||
|
||||
n, err = protoutil.UInt32Marshal(sendInterResBodyIterFNum, buf[offset:], x.iter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
offset += n
|
||||
|
||||
_, err = protoutil.NestedStructureMarshal(sendInterResBodyTrustFNum, buf[offset:], x.trust)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -304,6 +319,7 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e
|
|||
}
|
||||
|
||||
func (x *SendIntermediateResultRequestBody) StableSize() (size int) {
|
||||
size += protoutil.UInt64Size(sendInterResBodyEpochFNum, x.epoch)
|
||||
size += protoutil.UInt32Size(sendInterResBodyIterFNum, x.iter)
|
||||
size += protoutil.NestedStructureSize(sendInterResBodyTrustFNum, x.trust)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue