refactor: optimize actual storage calculation to use PDP leaf counts#383
Conversation
|
@ameeetgaikwad this is close but not quite - see FilOzone/filecoin-services#451 where I discuss the FR32 expansion, so leaf count x 32 inflates the actual size by a little bit. The fix to that would be But, I think now the right approach might be to use the new So this is roughly correct, but looking back at #281 and my comments there, I think the third option I mentioned might be the right one. There'll be a newer Synapse release soon that has a better iterating Are you still able to take this on? |
Closes #281
calculateActualStorage() was computing total stored bytes by creating a storage context for each dataset,
fetching every piece, and summing piece sizes. That path was doing much more work than needed for an aggregate storage total.
This change switches the calculation to use PDPVerifier.getDataSetLeafCount(dataSetId) and converts the result to bytes with PDP_LEAF_SIZE. This keeps the same public result shape and progress/abort behavior, but avoids the per-piece retrieval path.