bitrot: Verify file size inside storage interface (#7932)

This commit is contained in:
Anis Elleuch
2019-09-11 21:49:53 +01:00
committed by kannappanr
parent 3d65dc8d94
commit 3f258062d8
9 changed files with 39 additions and 19 deletions

View File

@@ -155,3 +155,11 @@ func bitrotWriterSum(w io.Writer) []byte {
}
return nil
}
// Returns the size of the file with bitrot protection
func bitrotShardFileSize(size int64, shardSize int64, algo BitrotAlgorithm) int64 {
if algo != HighwayHash256S {
return size
}
return ceilFrac(size, shardSize)*int64(algo.New().Size()) + size
}