From 582d94c81c74cff8b0338603a50a296bee34871e Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 19 Jul 2023 13:00:26 +0300 Subject: [PATCH] [#47] types: Fix unique flag conversion Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- netmap/convert.go | 3 +++ netmap/grpc/types.go | 5 +++++ netmap/test/generate.go | 1 + 3 files changed, 9 insertions(+) diff --git a/netmap/convert.go b/netmap/convert.go index 6bb1525..0e25949 100644 --- a/netmap/convert.go +++ b/netmap/convert.go @@ -198,6 +198,7 @@ func (p *PlacementPolicy) ToGRPCMessage() grpc.Message { m.SetSelectors(SelectorsToGRPC(p.selectors)) m.SetReplicas(ReplicasToGRPC(p.replicas)) m.SetContainerBackupFactor(p.backupFactor) + m.SetUnique(p.unique) } return m @@ -228,6 +229,8 @@ func (p *PlacementPolicy) FromGRPCMessage(m grpc.Message) error { p.backupFactor = v.GetContainerBackupFactor() + p.unique = v.GetUnique() + return nil } diff --git a/netmap/grpc/types.go b/netmap/grpc/types.go index f312bbb..f4e90f8 100644 --- a/netmap/grpc/types.go +++ b/netmap/grpc/types.go @@ -20,6 +20,11 @@ func (m *PlacementPolicy) SetFilters(v []*Filter) { m.Filters = v } +// SetUnique of placement policy. +func (m *PlacementPolicy) SetUnique(unique bool) { + m.Unique = unique +} + // SetName of placement filter. func (m *Filter) SetName(v string) { m.Name = v diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 400d24c..260a024 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -102,6 +102,7 @@ func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy { m.SetFilters(GenerateFilters(false)) m.SetSelectors(GenerateSelectors(false)) m.SetReplicas(GenerateReplicas(false)) + m.SetUnique(true) } return m