From 68f28a1918238922c47c300393f7dd2a58488ae1 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 17 Nov 2021 16:58:38 +0300 Subject: [PATCH] [#355] v2/refs: add subnetwork ID Signed-off-by: Evgenii Stratonikov --- netmap/types.go | 9 +++++++++ refs/types.go | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/netmap/types.go b/netmap/types.go index af8fb6f..dc32805 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 0b90268..f3ce145 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