status: clean up for bare repositories

The backend usage graph shows present keys as well as keys found in the
repository tree, so it will also be populated for bare repositories.

Changed wording to "visible annex keys", which explains why it's 0 in
a bare repository (no keys visible as no tree), and also why it varies
depending on which branch is checked out. This seemed better than doing
something expensive to look up keys from the git-annex branch.
This commit is contained in:
Joey Hess 2011-10-29 19:03:43 -04:00
parent 61000904d7
commit c102e63595
2 changed files with 11 additions and 11 deletions

View file

@ -57,8 +57,8 @@ stats =
, bad_data_size , bad_data_size
, local_annex_keys , local_annex_keys
, local_annex_size , local_annex_size
, total_annex_keys , visible_annex_keys
, total_annex_size , visible_annex_size
, backend_usage , backend_usage
] ]
@ -99,16 +99,16 @@ local_annex_size :: Stat
local_annex_size = stat "local annex size" $ local_annex_size = stat "local annex size" $
keySizeSum <$> cachedKeysPresent keySizeSum <$> cachedKeysPresent
total_annex_size :: Stat
total_annex_size = stat "total annex size" $
keySizeSum <$> cachedKeysReferenced
local_annex_keys :: Stat local_annex_keys :: Stat
local_annex_keys = stat "local annex keys" $ local_annex_keys = stat "local annex keys" $
show . S.size <$> cachedKeysPresent show . S.size <$> cachedKeysPresent
total_annex_keys :: Stat visible_annex_size :: Stat
total_annex_keys = stat "total annex keys" $ visible_annex_size = stat "visible annex size" $
keySizeSum <$> cachedKeysReferenced
visible_annex_keys :: Stat
visible_annex_keys = stat "visible annex keys" $
show . S.size <$> cachedKeysReferenced show . S.size <$> cachedKeysReferenced
tmp_size :: Stat tmp_size :: Stat
@ -118,9 +118,9 @@ bad_data_size :: Stat
bad_data_size = staleSize "bad keys size" gitAnnexBadDir bad_data_size = staleSize "bad keys size" gitAnnexBadDir
backend_usage :: Stat backend_usage :: Stat
backend_usage = stat "backend usage" $ usage <$> cachedKeysReferenced backend_usage = stat "backend usage" $ usage <$> cachedKeysReferenced <*> cachedKeysPresent
where where
usage ks = pp "" $ reverse . sort $ map swap $ splits $ S.toList ks usage a b = pp "" $ reverse . sort $ map swap $ splits $ S.toList $ S.union a b
splits :: [Key] -> [(String, Integer)] splits :: [Key] -> [(String, Integer)]
splits ks = M.toList $ M.fromListWith (+) $ map tcount ks splits ks = M.toList $ M.fromListWith (+) $ map tcount ks
tcount k = (keyBackendName k, 1) tcount k = (keyBackendName k, 1)

View file

@ -12,4 +12,4 @@ What is says on the tin:
>> Fsck is done. Rest not done yet. --[[Joey]] >> Fsck is done. Rest not done yet. --[[Joey]]
[[!meta title="support status, unused, dropunused in bare repos"]] [[!meta title="support unused, dropunused in bare repos"]]