frostfs-api-go-pogpp/v2/netmap/types.go
Alex Vanin edd0004b93 [#129] v2: Add unified structure for NodeInfo
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-09-18 10:45:11 +03:00

97 lines
1.2 KiB
Go

package netmap
type PlacementPolicy struct {
// TODO: fill me
}
// Attribute of storage node.
type Attribute struct {
key string
value string
}
// NodeInfo of storage node.
type NodeInfo struct {
publicKey []byte
address string
attributes []*Attribute
}
// NodeState of storage node.
type NodeState uint32
const (
Unspecified NodeState = iota
Online
Offline
)
func (a *Attribute) GetKey() string {
if a != nil {
return a.key
}
return ""
}
func (a *Attribute) SetKey(v string) {
if a != nil {
a.key = v
}
}
func (a *Attribute) GetValue() string {
if a != nil {
return a.value
}
return ""
}
func (a *Attribute) SetValue(v string) {
if a != nil {
a.value = v
}
}
func (ni *NodeInfo) GetPublicKey() []byte {
if ni != nil {
return ni.publicKey
}
return nil
}
func (ni *NodeInfo) SetPublicKey(v []byte) {
if ni != nil {
ni.publicKey = v
}
}
func (ni *NodeInfo) GetAddress() string {
if ni != nil {
return ni.address
}
return ""
}
func (ni *NodeInfo) SetAddress(v string) {
if ni != nil {
ni.address = v
}
}
func (ni *NodeInfo) GetAttributes() []*Attribute {
if ni != nil {
return ni.attributes
}
return nil
}
func (ni *NodeInfo) SetAttributes(v []*Attribute) {
if ni != nil {
ni.attributes = v
}
}