FileCounts returns a FileCounts object for the current file set.
()
| 331 | |
| 332 | // FileCounts returns a FileCounts object for the current file set. |
| 333 | func (d *Decoder) FileCounts() FileCounts { |
| 334 | usableDataFileCount := 0 |
| 335 | unusableDataFileCount := 0 |
| 336 | |
| 337 | for _, data := range d.fileData { |
| 338 | if data == nil { |
| 339 | unusableDataFileCount++ |
| 340 | } else { |
| 341 | usableDataFileCount++ |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | usableParityFileCount := 0 |
| 346 | unusableParityFileCount := 0 |
| 347 | |
| 348 | for _, data := range d.parityData { |
| 349 | if data == nil { |
| 350 | unusableParityFileCount++ |
| 351 | } else { |
| 352 | usableParityFileCount++ |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | return FileCounts{ |
| 357 | UsableDataFileCount: usableDataFileCount, |
| 358 | UnusableDataFileCount: unusableDataFileCount, |
| 359 | UsableParityFileCount: usableParityFileCount, |
| 360 | UnusableParityFileCount: unusableParityFileCount, |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | // VerifyAllData checks and returns whether all data and parity files |
| 365 | // contain correct data. Note that this is worth calling only when |
no outgoing calls