Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print total space saved on nix-store --optimise #2288 #2654

Closed
wants to merge 1 commit into from

Conversation

meg-codes
Copy link

This PR attempts to provide the functionality requested in #2288. I opted to follow the code used i nix-collect-garbage but factored it into a private method on LocalStorage to avoid cluttering optimiseStore.

I do have one question that might impact this PR beyond any organizational or stylistic blunders: How accurately is accurate enough for on disk storage? nix-collect-garbage uses st_blocks * 512ULL, which will be accurate for the usual case. optimiseStore uses st_size, which will be similar (though possibly less honest about the disk usage).

In a case with a block size that isn't the usual 512 (i.e. networked storages, etc.), the reported number could not reflect the actual size on disk well at all, which would beg for a query to st_blksize

For now, I used st_size to be consistent within optimise-store.cc, which means it gives a slightly different answer than the same text in used in gc.cc.

Happy to make any changes and correct rookie mistakes.

@stale
Copy link

stale bot commented Feb 13, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 13, 2021
@stale
Copy link

stale bot commented Apr 16, 2022

I closed this issue due to inactivity. → More info

@stale stale bot closed this Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant