Follow-up from "add some directory information to siac renter ls -v"
Basically HealthPercentage should be: (1.25-health); if result < 0, result = 0, if result > 100 result = 100
Make an equivalent field in directory, and use that in siac too.
The following discussion from !3720 (merged) should be addressed:
-
@MSevey started a discussion: We have a health percent method in the
siafile
package for thesiafile
metadata information. We should be consistent between thesiafile
andsiadir
. The main difference is you are using the 1.25 constant here which can lead to a negative health for directories that have a health of 1.5.I assume you are using the 1.25 constant from a UX decision standpoint. If that is the case we should export the
healthPercentage
method and handle the negative percentage cases there.// healthPercentage returns the health in a more human understandable format out // of 100% func healthPercentage(h, sh float64, ec modules.ErasureCoder) float64 { health := math.Max(h, sh) dataPieces := ec.MinPieces() parityPieces := ec.NumPieces() - dataPieces worstHealth := 1 + float64(dataPieces)/float64(parityPieces) return 100 * ((worstHealth - health) / worstHealth) }