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

@ -10,6 +10,7 @@ git-annex (10.20230803) UNRELEASED; urgency=medium
* Stop bundling curl in the OSX dmg and linux standalone image. * Stop bundling curl in the OSX dmg and linux standalone image.
* sync, assist, push, pull: Skip more types of remotes when they * sync, assist, push, pull: Skip more types of remotes when they
are not present due to eg being on a drive that is offline. are not present due to eg being on a drive that is offline.
* info: Added available to the info displayed for a remote.
* Added AVAILABILITY UNAVAILABLE and the UNAVAILABLERESPONSE extension * Added AVAILABILITY UNAVAILABLE and the UNAVAILABLERESPONSE extension
to the external special remote protocol. to the external special remote protocol.
* The remote.name.annex-availability git config is no longer used. * The remote.name.annex-availability git config is no longer used.

View file

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