[#355] v2/refs: add subnetwork ID

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-11-17 16:58:38 +03:00 committed by LeL
parent ad6a7999cd
commit 68f28a1918
2 changed files with 26 additions and 0 deletions

View file

@ -59,6 +59,7 @@ type PlacementPolicy struct {
backupFactor uint32 backupFactor uint32
selectors []*Selector selectors []*Selector
filters []*Filter filters []*Filter
subnetID *refs.SubnetID
} }
// Attribute of storage node. // Attribute of storage node.
@ -330,6 +331,14 @@ func (p *PlacementPolicy) SetReplicas(replicas []*Replica) {
p.replicas = replicas p.replicas = replicas
} }
func (p *PlacementPolicy) GetSubnetID() *refs.SubnetID {
return p.subnetID
}
func (p *PlacementPolicy) SetSubnetID(id *refs.SubnetID) {
p.subnetID = id
}
func (a *Attribute) GetKey() string { func (a *Attribute) GetKey() string {
if a != nil { if a != nil {
return a.key return a.key

View file

@ -30,6 +30,10 @@ type Signature struct {
key, sign []byte key, sign []byte
} }
type SubnetID struct {
value uint32
}
type Version struct { type Version struct {
major, minor uint32 major, minor uint32
} }
@ -166,6 +170,19 @@ func (s *Signature) SetSign(v []byte) {
} }
} }
func (s *SubnetID) SetValue(id uint32) {
if s != nil {
s.value = id
}
}
func (s *SubnetID) GetValue() uint32 {
if s != nil {
return s.value
}
return 0
}
func (v *Version) GetMajor() uint32 { func (v *Version) GetMajor() uint32 {
if v != nil { if v != nil {
return v.major return v.major