forked from TrueCloudLab/frostfs-api-go
state: implement SignedDataSource on ChangeStateRequest message
This commit is contained in:
parent
5545b25a95
commit
ab198b4049
4 changed files with 89 additions and 0 deletions
24
state/types.go
Normal file
24
state/types.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package state
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
)
|
||||
|
||||
// SetState is a State field setter.
|
||||
func (m *ChangeStateRequest) SetState(st ChangeStateRequest_State) {
|
||||
m.State = st
|
||||
}
|
||||
|
||||
// Size returns the size of the state binary representation.
|
||||
func (ChangeStateRequest_State) Size() int {
|
||||
return 4
|
||||
}
|
||||
|
||||
// Bytes returns the state binary representation.
|
||||
func (x ChangeStateRequest_State) Bytes() []byte {
|
||||
data := make([]byte, x.Size())
|
||||
|
||||
binary.BigEndian.PutUint32(data, uint32(x))
|
||||
|
||||
return data
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue