From a5c69030c8809fe18e79b4a5802636cab357704f Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 14 Jun 2023 14:21:58 +0300 Subject: [PATCH] [#31] netmap: Add unique field marshaling for PlacementPolicy Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- netmap/marshal.go | 5 +++++ netmap/types.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/netmap/marshal.go b/netmap/marshal.go index f707665..51de050 100644 --- a/netmap/marshal.go +++ b/netmap/marshal.go @@ -26,6 +26,7 @@ const ( backupPolicyField = 2 selectorsPolicyField = 3 filtersPolicyField = 4 + uniquePolicyField = 5 keyAttributeField = 1 valueAttributeField = 2 @@ -166,6 +167,8 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) []byte { offset += protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i]) } + offset += protoutil.BoolMarshal(uniquePolicyField, buf[offset:], p.unique) + return buf } @@ -184,6 +187,8 @@ func (p *PlacementPolicy) StableSize() (size int) { size += protoutil.NestedStructureSize(filtersPolicyField, &p.filters[i]) } + size += protoutil.BoolSize(uniquePolicyField, p.unique) + return size } diff --git a/netmap/types.go b/netmap/types.go index aece7cf..bda9ec6 100644 --- a/netmap/types.go +++ b/netmap/types.go @@ -55,11 +55,11 @@ type Replica struct { type Operation uint32 type PlacementPolicy struct { - unique bool replicas []Replica backupFactor uint32 selectors []Selector filters []Filter + unique bool } // Attribute of storage node.