forked from TrueCloudLab/frostfs-node
21 lines
680 B
Go
21 lines
680 B
Go
|
package policy
|
||
|
|
||
|
import (
|
||
|
netmapSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||
|
)
|
||
|
|
||
|
// IsECPlacement returns True if policy is erasure coding policy.
|
||
|
func IsECPlacement(policy netmapSDK.PlacementPolicy) bool {
|
||
|
return policy.NumberOfReplicas() == 1 && policy.ReplicaDescriptor(0).GetECDataCount() > 0
|
||
|
}
|
||
|
|
||
|
// ECDataCount returns EC data count for EC placement policy.
|
||
|
func ECDataCount(policy netmapSDK.PlacementPolicy) int {
|
||
|
return int(policy.ReplicaDescriptor(0).GetECDataCount())
|
||
|
}
|
||
|
|
||
|
// ECParityCount returns EC parity count for EC placement policy.
|
||
|
func ECParityCount(policy netmapSDK.PlacementPolicy) int {
|
||
|
return int(policy.ReplicaDescriptor(0).GetECParityCount())
|
||
|
}
|