[#47] types: Fix unique flag conversion #47

Merged
fyrchik merged 1 commit from aarifullin/frostfs-api-go:fix/policy_unique_convert into master 2023-07-19 11:25:34 +00:00
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