Skip to content

refactor: optimize actual storage calculation to use PDP leaf counts#383

Open
ameeetgaikwad wants to merge 1 commit intofilecoin-project:masterfrom
ameeetgaikwad:fix/improve-calculate-actual-storage2
Open

refactor: optimize actual storage calculation to use PDP leaf counts#383
ameeetgaikwad wants to merge 1 commit intofilecoin-project:masterfrom
ameeetgaikwad:fix/improve-calculate-actual-storage2

Conversation

@ameeetgaikwad
Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: calculate-actual-storage.ts can be improved.

1 participant