[#31] netmap: Add unique field marshaling for PlacementPolicy
Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
parent
8266b31092
commit
a5c69030c8
2 changed files with 6 additions and 1 deletions
|
@ -26,6 +26,7 @@ const (
|
||||||
backupPolicyField = 2
|
backupPolicyField = 2
|
||||||
selectorsPolicyField = 3
|
selectorsPolicyField = 3
|
||||||
filtersPolicyField = 4
|
filtersPolicyField = 4
|
||||||
|
uniquePolicyField = 5
|
||||||
|
|
||||||
keyAttributeField = 1
|
keyAttributeField = 1
|
||||||
valueAttributeField = 2
|
valueAttributeField = 2
|
||||||
|
@ -166,6 +167,8 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) []byte {
|
||||||
offset += protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i])
|
offset += protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
offset += protoutil.BoolMarshal(uniquePolicyField, buf[offset:], p.unique)
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,6 +187,8 @@ func (p *PlacementPolicy) StableSize() (size int) {
|
||||||
size += protoutil.NestedStructureSize(filtersPolicyField, &p.filters[i])
|
size += protoutil.NestedStructureSize(filtersPolicyField, &p.filters[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size += protoutil.BoolSize(uniquePolicyField, p.unique)
|
||||||
|
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,11 +55,11 @@ type Replica struct {
|
||||||
type Operation uint32
|
type Operation uint32
|
||||||
|
|
||||||
type PlacementPolicy struct {
|
type PlacementPolicy struct {
|
||||||
unique bool
|
|
||||||
replicas []Replica
|
replicas []Replica
|
||||||
backupFactor uint32
|
backupFactor uint32
|
||||||
selectors []Selector
|
selectors []Selector
|
||||||
filters []Filter
|
filters []Filter
|
||||||
|
unique bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attribute of storage node.
|
// Attribute of storage node.
|
||||||
|
|
Loading…
Reference in a new issue