diff --git a/netmap/types.go b/netmap/types.go index af8fb6ff..dc328053 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -59,6 +59,7 @@ type PlacementPolicy struct { backupFactor uint32 selectors []*Selector filters []*Filter + subnetID *refs.SubnetID } // Attribute of storage node. @@ -330,6 +331,14 @@ func (p *PlacementPolicy) SetReplicas(replicas []*Replica) { 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 { if a != nil { return a.key diff --git a/refs/types.go b/refs/types.go index 0b902684..f3ce1455 100644 --- a/refs/types.go +++ b/refs/types.go @@ -30,6 +30,10 @@ type Signature struct { key, sign []byte } +type SubnetID struct { + value uint32 +} + type Version struct { 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 { if v != nil { return v.major