[#47] types: Fix unique flag conversion
Tests and linters / Tests (1.19) (pull_request) Successful in 1m26s Details
Tests and linters / Tests (1.20) (pull_request) Successful in 2m6s Details
Tests and linters / Tests with -race (pull_request) Successful in 2m23s Details
Tests and linters / Lint (pull_request) Successful in 9m12s Details

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
pull/47/head
Airat Arifullin 2023-07-19 13:00:26 +03:00
parent 285516a94e
commit 582d94c81c
3 changed files with 9 additions and 0 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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