forked from TrueCloudLab/frostfs-sdk-go
[#211] netmap: Introduce ReplicaDescriptor method
* Make ReplicaNumberByIndex deprecated. * Introduce ReplicaDescriptor method that access i-th replica directly. * Introduce new getters for ReplicaDescriptor. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
6d0da3f861
commit
425d48f68b
1 changed files with 30 additions and 0 deletions
|
@ -139,6 +139,14 @@ func (r *ReplicaDescriptor) SetNumberOfObjects(c uint32) {
|
||||||
r.m.SetCount(c)
|
r.m.SetCount(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r ReplicaDescriptor) SetECDataCount(v uint32) {
|
||||||
|
r.m.SetECDataCount(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r ReplicaDescriptor) SetECParityCount(v uint32) {
|
||||||
|
r.m.SetECParityCount(v)
|
||||||
|
}
|
||||||
|
|
||||||
// NumberOfObjects returns number set using SetNumberOfObjects.
|
// NumberOfObjects returns number set using SetNumberOfObjects.
|
||||||
//
|
//
|
||||||
// Zero ReplicaDescriptor has zero number of objects.
|
// Zero ReplicaDescriptor has zero number of objects.
|
||||||
|
@ -146,6 +154,19 @@ func (r ReplicaDescriptor) NumberOfObjects() uint32 {
|
||||||
return r.m.GetCount()
|
return r.m.GetCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r ReplicaDescriptor) GetECDataCount() uint32 {
|
||||||
|
return r.m.GetECDataCount()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r ReplicaDescriptor) GetECParityCount() uint32 {
|
||||||
|
return r.m.GetECParityCount()
|
||||||
|
}
|
||||||
|
|
||||||
|
// TotalECPartCount returns total sum of ECDataCount and ECParityCount.
|
||||||
|
func (r ReplicaDescriptor) TotalECPartCount() uint32 {
|
||||||
|
return r.m.GetECDataCount() + r.m.GetECParityCount()
|
||||||
|
}
|
||||||
|
|
||||||
// SetSelectorName sets name of the related Selector.
|
// SetSelectorName sets name of the related Selector.
|
||||||
//
|
//
|
||||||
// Zero ReplicaDescriptor references to the root bucket's selector: it contains
|
// Zero ReplicaDescriptor references to the root bucket's selector: it contains
|
||||||
|
@ -179,10 +200,19 @@ func (p PlacementPolicy) NumberOfReplicas() int {
|
||||||
// descriptor. Index MUST be in range [0; NumberOfReplicas()).
|
// descriptor. Index MUST be in range [0; NumberOfReplicas()).
|
||||||
//
|
//
|
||||||
// Zero PlacementPolicy has no replicas.
|
// Zero PlacementPolicy has no replicas.
|
||||||
|
//
|
||||||
|
// Deprecated: Use PlacementPolicy.ReplicaDescriptor(int).NumberOfObjects() instead.
|
||||||
func (p PlacementPolicy) ReplicaNumberByIndex(i int) uint32 {
|
func (p PlacementPolicy) ReplicaNumberByIndex(i int) uint32 {
|
||||||
return p.replicas[i].GetCount()
|
return p.replicas[i].GetCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReplicaDescriptor returns i-th replica descriptor. Index MUST be in range [0; NumberOfReplicas()).
|
||||||
|
func (p PlacementPolicy) ReplicaDescriptor(i int) ReplicaDescriptor {
|
||||||
|
return ReplicaDescriptor{
|
||||||
|
m: p.replicas[i],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SetContainerBackupFactor sets container backup factor: it controls how deep
|
// SetContainerBackupFactor sets container backup factor: it controls how deep
|
||||||
// FrostFS will search for nodes alternatives to include into container's nodes subset.
|
// FrostFS will search for nodes alternatives to include into container's nodes subset.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue