info: Added available to the info displayed for a remote

Sponsored-by: Kevin Mueller on Patreon
This commit is contained in:
Joey Hess 2023-08-16 14:52:51 -04:00
parent 9286769d2c
commit 67c99a4db7
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 8 additions and 0 deletions

View file

@ -43,6 +43,7 @@ import Logs.Transfer
import Types.Key
import Types.TrustLevel
import Types.FileMatcher
import Types.Availability
import qualified Limit
import Messages.JSON (DualDisp(..), ObjectMap(..))
import Annex.BloomFilter
@ -312,6 +313,7 @@ remote_fast_stats r = map (\s -> s r)
[ remote_name
, remote_cost
, remote_type
, remote_availabile
]
uuid_fast_stats :: UUID -> [Stat]
@ -397,6 +399,11 @@ remote_type :: Remote -> Stat
remote_type r = simpleStat "type" $ pure $
Remote.typename $ Remote.remotetype r
remote_availabile :: Remote -> Stat
remote_availabile r = simpleStat "available" $ lift $
either show (\av -> boolConfig (av /= Unavailable))
<$> tryNonAsync (Remote.availability r)
local_annex_keys :: Stat
local_annex_keys = stat "local annex keys" $ json show $
countKeys <$> cachedPresentData