internal/charmstore: copy stats logic from _old and update
sortimports
internal/v4: update for NewStore error return
Merge pull request #51 from rogpeppe/022-store-stats

internal/charmstore: copy stats logic from _old

Please note that almost all the code and tests in this PR are already reviewed
and battle-tested.