frostfs-api-go-pogpp/service/role.go
Leonard Lyubich b2543c0739 fix comments
2020-05-11 17:44:59 +03:00

37 lines
734 B
Go

package service
import "encoding/binary"
const (
_ NodeRole = iota
// InnerRingNode that work like IR node.
InnerRingNode
// StorageNode that work like a storage node.
StorageNode
)
// String is method, that represent NodeRole as string.
func (nt NodeRole) String() string {
switch nt {
case InnerRingNode:
return "InnerRingNode"
case StorageNode:
return "StorageNode"
default:
return "Unknown"
}
}
// Size returns the size necessary for a binary representation of the NodeRole.
func (nt NodeRole) Size() int {
return 4
}
// Bytes returns a binary representation of the NodeRole.
func (nt NodeRole) Bytes() []byte {
data := make([]byte, nt.Size())
binary.BigEndian.PutUint32(data, uint32(nt))
return data
}