show amount of reserved space

This commit is contained in:
Joey Hess 2012-04-23 10:37:05 -04:00
parent 3911b2db13
commit eedde34549

View file

@ -69,6 +69,7 @@ fast_stats =
, remote_list SemiTrusted "semitrusted" , remote_list SemiTrusted "semitrusted"
, remote_list UnTrusted "untrusted" , remote_list UnTrusted "untrusted"
, remote_list DeadTrusted "dead" , remote_list DeadTrusted "dead"
, disk_size
] ]
slow_stats :: [Stat] slow_stats :: [Stat]
slow_stats = slow_stats =
@ -78,7 +79,6 @@ slow_stats =
, local_annex_size , local_annex_size
, known_annex_keys , known_annex_keys
, known_annex_size , known_annex_size
, disk_size
, bloom_info , bloom_info
, backend_usage , backend_usage
] ]
@ -175,8 +175,12 @@ disk_size = stat "available local disk space" $ json id $ lift $
<$> getDiskReserve <$> getDiskReserve
<*> inRepo (getDiskFree . gitAnnexDir) <*> inRepo (getDiskFree . gitAnnexDir)
where where
calcfree reserve (Just have) = calcfree reserve (Just have) = unwords
roughSize storageUnits False $ nonneg $ have - reserve [ roughSize storageUnits False $ nonneg $ have - reserve
, "(+" ++ roughSize storageUnits False reserve
, "reserved)"
]
calcfree _ _ = "unknown" calcfree _ _ = "unknown"
nonneg x nonneg x
| x >= 0 = x | x >= 0 = x