let Remote.availability return Unavilable
This is groundwork for making special remotes like borg be skipped by sync when on an offline drive. Added AVAILABILITY UNAVAILABLE reponse and the UNAVAILABLERESPONSE extension to the external special remote protocol. The extension is needed because old git-annex, if it sees that response, will display a warning message. (It does continue as if the remote is globally available, which is acceptable, and the warning is only displayed at initremote due to remote.name.annex-availability caching, but still it seemed best to make this a protocol extension.) The remote.name.annex-availability git config is no longer used any more, and is documented as such. It was only used by external special remotes to cache the availability, to avoid needing to start the external process every time. Now that availability is queried as an Annex action, the external is only started by sync (and the assistant), when they actually check availability. Sponsored-by: Nicholas Golder-Manning on Patreon
This commit is contained in:
parent
7f7c95b771
commit
9286769d2c
28 changed files with 86 additions and 65 deletions
|
@ -13,6 +13,7 @@ import Assistant.Common
|
||||||
import Assistant.Alert.Utility
|
import Assistant.Alert.Utility
|
||||||
import Utility.Tmp
|
import Utility.Tmp
|
||||||
import Utility.NotificationBroadcaster
|
import Utility.NotificationBroadcaster
|
||||||
|
import Types.Availability
|
||||||
import Types.Transfer
|
import Types.Transfer
|
||||||
import Logs.Transfer
|
import Logs.Transfer
|
||||||
import Logs.Trust
|
import Logs.Trust
|
||||||
|
@ -59,6 +60,7 @@ calcSyncRemotes = do
|
||||||
let (exportremotes, nonexportremotes) = partition (exportTree . Remote.config) contentremotes
|
let (exportremotes, nonexportremotes) = partition (exportTree . Remote.config) contentremotes
|
||||||
let isimport r = importTree (Remote.config r) || Remote.thirdPartyPopulated (Remote.remotetype r)
|
let isimport r = importTree (Remote.config r) || Remote.thirdPartyPopulated (Remote.remotetype r)
|
||||||
let dataremotes = filter (not . isimport) nonexportremotes
|
let dataremotes = filter (not . isimport) nonexportremotes
|
||||||
|
tocloud <- anyM iscloud contentremotes
|
||||||
|
|
||||||
return $ \dstatus -> dstatus
|
return $ \dstatus -> dstatus
|
||||||
{ syncRemotes = syncable
|
{ syncRemotes = syncable
|
||||||
|
@ -66,10 +68,14 @@ calcSyncRemotes = do
|
||||||
, syncDataRemotes = dataremotes
|
, syncDataRemotes = dataremotes
|
||||||
, exportRemotes = exportremotes
|
, exportRemotes = exportremotes
|
||||||
, downloadRemotes = contentremotes
|
, downloadRemotes = contentremotes
|
||||||
, syncingToCloudRemote = any iscloud contentremotes
|
, syncingToCloudRemote = tocloud
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
iscloud r = not (Remote.readonly r) && Remote.availability r == Remote.GloballyAvailable
|
iscloud r
|
||||||
|
| Remote.readonly r = pure False
|
||||||
|
| otherwise = tryNonAsync (Remote.availability r) >>= return . \case
|
||||||
|
Right GloballyAvailable -> True
|
||||||
|
_ -> False
|
||||||
|
|
||||||
{- Updates the syncRemotes list from the list of all remotes in Annex state. -}
|
{- Updates the syncRemotes list from the list of all remotes in Annex state. -}
|
||||||
updateSyncRemotes :: Assistant ()
|
updateSyncRemotes :: Assistant ()
|
||||||
|
|
|
@ -8,6 +8,11 @@ git-annex (10.20230803) UNRELEASED; urgency=medium
|
||||||
directory does not exist. An empty tree was imported, rather than the
|
directory does not exist. An empty tree was imported, rather than the
|
||||||
import failing.
|
import failing.
|
||||||
* 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
|
||||||
|
are not present due to eg being on a drive that is offline.
|
||||||
|
* Added AVAILABILITY UNAVAILABLE and the UNAVAILABLERESPONSE extension
|
||||||
|
to the external special remote protocol.
|
||||||
|
* The remote.name.annex-availability git config is no longer used.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 07 Aug 2023 13:04:13 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 07 Aug 2023 13:04:13 -0400
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ import Annex.Import
|
||||||
import Annex.CheckIgnore
|
import Annex.CheckIgnore
|
||||||
import Types.FileMatcher
|
import Types.FileMatcher
|
||||||
import Types.GitConfig
|
import Types.GitConfig
|
||||||
|
import Types.Availability
|
||||||
import qualified Database.Export as Export
|
import qualified Database.Export as Export
|
||||||
import Utility.Bloom
|
import Utility.Bloom
|
||||||
import Utility.OptParse
|
import Utility.OptParse
|
||||||
|
@ -388,10 +389,9 @@ syncRemotes' ps available =
|
||||||
|
|
||||||
listed = concat <$> mapM Remote.byNameOrGroup ps
|
listed = concat <$> mapM Remote.byNameOrGroup ps
|
||||||
|
|
||||||
good r
|
good r = tryNonAsync (Remote.availability r) >>= return . \case
|
||||||
| Remote.gitSyncableRemoteType (Remote.remotetype r) =
|
Right Unavailable -> False
|
||||||
Remote.Git.repoAvail =<< Remote.getRepo r
|
_ -> True
|
||||||
| otherwise = return True
|
|
||||||
|
|
||||||
fastest = fromMaybe [] . headMaybe . Remote.byCost
|
fastest = fromMaybe [] . headMaybe . Remote.byCost
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ gen r u rc gc rs = do
|
||||||
, gitconfig = gc
|
, gitconfig = gc
|
||||||
, localpath = Nothing
|
, localpath = Nothing
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, availability = LocallyAvailable
|
, availability = pure LocallyAvailable
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
|
|
|
@ -88,7 +88,7 @@ gen r _ rc gc rs = do
|
||||||
, readonly = True
|
, readonly = True
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = return Nothing
|
, mkUnavailable = return Nothing
|
||||||
, getInfo = return []
|
, getInfo = return []
|
||||||
|
|
|
@ -112,7 +112,8 @@ gen r u rc gc rs = do
|
||||||
, gitconfig = gc
|
, gitconfig = gc
|
||||||
, localpath = borgRepoLocalPath borgrepo
|
, localpath = borgRepoLocalPath borgrepo
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, availability = if borgLocal borgrepo then LocallyAvailable else GloballyAvailable
|
, availability = pure $
|
||||||
|
if borgLocal borgrepo then LocallyAvailable else GloballyAvailable
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
-- When the user sets the appendonly field, they are
|
-- When the user sets the appendonly field, they are
|
||||||
|
|
|
@ -97,7 +97,8 @@ gen r u rc gc rs = do
|
||||||
then Just buprepo
|
then Just buprepo
|
||||||
else Nothing
|
else Nothing
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, availability = if bupLocal buprepo then LocallyAvailable else GloballyAvailable
|
, availability = pure $
|
||||||
|
if bupLocal buprepo then LocallyAvailable else GloballyAvailable
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
|
|
|
@ -98,7 +98,8 @@ gen r u rc gc rs = do
|
||||||
then Just $ ddarRepoLocation ddarrepo
|
then Just $ ddarRepoLocation ddarrepo
|
||||||
else Nothing
|
else Nothing
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, availability = if ddarLocal ddarrepo then LocallyAvailable else GloballyAvailable
|
, availability = pure $
|
||||||
|
if ddarLocal ddarrepo then LocallyAvailable else GloballyAvailable
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
|
|
|
@ -134,7 +134,7 @@ gen r u rc gc rs = do
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = LocallyAvailable
|
, availability = pure LocallyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = gen r u rc
|
, mkUnavailable = gen r u rc
|
||||||
(gc { remoteAnnexDirectory = Just "/dev/null" }) rs
|
(gc { remoteAnnexDirectory = Just "/dev/null" }) rs
|
||||||
|
|
|
@ -68,7 +68,7 @@ gen r u rc gc rs
|
||||||
| externaltype == "readonly" = do
|
| externaltype == "readonly" = do
|
||||||
c <- parsedRemoteConfig remote rc
|
c <- parsedRemoteConfig remote rc
|
||||||
cst <- remoteCost gc c expensiveRemoteCost
|
cst <- remoteCost gc c expensiveRemoteCost
|
||||||
let rmt = mk c cst GloballyAvailable
|
let rmt = mk c cst (pure GloballyAvailable)
|
||||||
Nothing
|
Nothing
|
||||||
(externalInfo externaltype)
|
(externalInfo externaltype)
|
||||||
Nothing
|
Nothing
|
||||||
|
@ -87,7 +87,6 @@ gen r u rc gc rs
|
||||||
(Git.remoteName r) (Just rs)
|
(Git.remoteName r) (Just rs)
|
||||||
Annex.addCleanupAction (RemoteCleanup u) $ stopExternal external
|
Annex.addCleanupAction (RemoteCleanup u) $ stopExternal external
|
||||||
cst <- getCost external r gc c
|
cst <- getCost external r gc c
|
||||||
avail <- getAvailability external r gc
|
|
||||||
exportsupported <- if exportTree c
|
exportsupported <- if exportTree c
|
||||||
then checkExportSupported' external
|
then checkExportSupported' external
|
||||||
else return False
|
else return False
|
||||||
|
@ -107,7 +106,7 @@ gen r u rc gc rs
|
||||||
let cheapexportsupported = if exportsupported
|
let cheapexportsupported = if exportsupported
|
||||||
then exportIsSupported
|
then exportIsSupported
|
||||||
else exportUnsupported
|
else exportUnsupported
|
||||||
let rmt = mk c cst avail
|
let rmt = mk c cst (getAvailability external)
|
||||||
(Just (whereisKeyM external))
|
(Just (whereisKeyM external))
|
||||||
(getInfoM external)
|
(getInfoM external)
|
||||||
(Just (claimUrlM external))
|
(Just (claimUrlM external))
|
||||||
|
@ -777,25 +776,16 @@ getCost external r gc pc =
|
||||||
return c
|
return c
|
||||||
defcst = expensiveRemoteCost
|
defcst = expensiveRemoteCost
|
||||||
|
|
||||||
{- Caches the availability in the git config to avoid needing to start up an
|
{- Most remotes do not bother to implement a reply to this request;
|
||||||
- external special remote every time time just to ask it what its
|
|
||||||
- availability is.
|
|
||||||
-
|
|
||||||
- Most remotes do not bother to implement a reply to this request;
|
|
||||||
- globally available is the default.
|
- globally available is the default.
|
||||||
-}
|
-}
|
||||||
getAvailability :: External -> Git.Repo -> RemoteGitConfig -> Annex Availability
|
getAvailability :: External -> Annex Availability
|
||||||
getAvailability external r gc =
|
getAvailability external = catchNonAsync query (const (pure defavail))
|
||||||
maybe (catchNonAsync query (const (pure defavail))) return
|
|
||||||
(remoteAnnexAvailability gc)
|
|
||||||
where
|
where
|
||||||
query = do
|
query = handleRequest external GETAVAILABILITY Nothing $ \req -> case req of
|
||||||
avail <- handleRequest external GETAVAILABILITY Nothing $ \req -> case req of
|
|
||||||
AVAILABILITY avail -> result avail
|
AVAILABILITY avail -> result avail
|
||||||
UNSUPPORTED_REQUEST -> result defavail
|
UNSUPPORTED_REQUEST -> result defavail
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
setRemoteAvailability r avail
|
|
||||||
return avail
|
|
||||||
defavail = GloballyAvailable
|
defavail = GloballyAvailable
|
||||||
|
|
||||||
claimUrlM :: External -> URLString -> Annex Bool
|
claimUrlM :: External -> URLString -> Annex Bool
|
||||||
|
|
3
Remote/External/Types.hs
vendored
3
Remote/External/Types.hs
vendored
|
@ -110,6 +110,7 @@ supportedExtensionList :: ExtensionList
|
||||||
supportedExtensionList = ExtensionList
|
supportedExtensionList = ExtensionList
|
||||||
[ "INFO"
|
[ "INFO"
|
||||||
, "GETGITREMOTENAME"
|
, "GETGITREMOTENAME"
|
||||||
|
, "UNAVAILABLERESPONSE"
|
||||||
, asyncExtension
|
, asyncExtension
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -447,9 +448,11 @@ instance Proto.Serializable Size where
|
||||||
instance Proto.Serializable Availability where
|
instance Proto.Serializable Availability where
|
||||||
serialize GloballyAvailable = "GLOBAL"
|
serialize GloballyAvailable = "GLOBAL"
|
||||||
serialize LocallyAvailable = "LOCAL"
|
serialize LocallyAvailable = "LOCAL"
|
||||||
|
serialize Unavailable = "UNAVAILABLE"
|
||||||
|
|
||||||
deserialize "GLOBAL" = Just GloballyAvailable
|
deserialize "GLOBAL" = Just GloballyAvailable
|
||||||
deserialize "LOCAL" = Just LocallyAvailable
|
deserialize "LOCAL" = Just LocallyAvailable
|
||||||
|
deserialize "UNAVAILABLE" = Just Unavailable
|
||||||
deserialize _ = Nothing
|
deserialize _ = Nothing
|
||||||
|
|
||||||
instance Proto.Serializable [(URLString, Size, FilePath)] where
|
instance Proto.Serializable [(URLString, Size, FilePath)] where
|
||||||
|
|
|
@ -158,7 +158,7 @@ gen' r u c gc rs = do
|
||||||
, readonly = Git.repoIsHttp r
|
, readonly = Git.repoIsHttp r
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = availabilityCalc r
|
, availability = pure (availabilityCalc r)
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = return Nothing
|
, mkUnavailable = return Nothing
|
||||||
, getInfo = gitRepoInfo this
|
, getInfo = gitRepoInfo this
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{- Standard git remotes.
|
{- Standard git remotes.
|
||||||
-
|
-
|
||||||
- Copyright 2011-2021 Joey Hess <id@joeyh.name>
|
- Copyright 2011-2023 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU AGPL version 3 or higher.
|
- Licensed under the GNU AGPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -11,7 +11,6 @@
|
||||||
module Remote.Git (
|
module Remote.Git (
|
||||||
remote,
|
remote,
|
||||||
configRead,
|
configRead,
|
||||||
repoAvail,
|
|
||||||
onLocalRepo,
|
onLocalRepo,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
@ -210,7 +209,7 @@ gen r u rc gc rs
|
||||||
, readonly = Git.repoIsHttp r
|
, readonly = Git.repoIsHttp r
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = availabilityCalc r
|
, availability = repoAvail r
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = unavailable r u rc gc rs
|
, mkUnavailable = unavailable r u rc gc rs
|
||||||
, getInfo = gitRepoInfo new
|
, getInfo = gitRepoInfo new
|
||||||
|
@ -233,20 +232,24 @@ unavailable r = gen r'
|
||||||
_ -> r -- already unavailable
|
_ -> r -- already unavailable
|
||||||
|
|
||||||
{- Checks relatively inexpensively if a repository is available for use. -}
|
{- Checks relatively inexpensively if a repository is available for use. -}
|
||||||
repoAvail :: Git.Repo -> Annex Bool
|
repoAvail :: Git.Repo -> Annex Availability
|
||||||
repoAvail r
|
repoAvail r
|
||||||
| Git.repoIsHttp r = return True
|
| Git.repoIsHttp r = return GloballyAvailable
|
||||||
| Git.GCrypt.isEncrypted r = do
|
| Git.GCrypt.isEncrypted r = do
|
||||||
g <- gitRepo
|
g <- gitRepo
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
er <- Git.GCrypt.encryptedRemote g r
|
er <- Git.GCrypt.encryptedRemote g r
|
||||||
if Git.repoIsLocal er || Git.repoIsLocalUnknown er
|
if Git.repoIsLocal er || Git.repoIsLocalUnknown er
|
||||||
then catchBoolIO $
|
then checklocal er
|
||||||
void (Git.Config.read er) >> return True
|
else return GloballyAvailable
|
||||||
else return True
|
| Git.repoIsUrl r = return GloballyAvailable
|
||||||
| Git.repoIsUrl r = return True
|
| Git.repoIsLocalUnknown r = return Unavailable
|
||||||
| Git.repoIsLocalUnknown r = return False
|
| otherwise = checklocal r
|
||||||
| otherwise = liftIO $ isJust <$> catchMaybeIO (Git.Config.read r)
|
where
|
||||||
|
checklocal r' = ifM (liftIO $ isJust <$> catchMaybeIO (Git.Config.read r'))
|
||||||
|
( return LocallyAvailable
|
||||||
|
, return Unavailable
|
||||||
|
)
|
||||||
|
|
||||||
{- Tries to read the config for a specified remote, updates state, and
|
{- Tries to read the config for a specified remote, updates state, and
|
||||||
- returns the updated repo. -}
|
- returns the updated repo. -}
|
||||||
|
|
|
@ -130,7 +130,7 @@ gen r u rc gc rs = do
|
||||||
, gitconfig = gc
|
, gitconfig = gc
|
||||||
, localpath = Nothing
|
, localpath = Nothing
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, readonly = False
|
, readonly = False
|
||||||
-- content cannot be removed from a git-lfs repo
|
-- content cannot be removed from a git-lfs repo
|
||||||
, appendonly = True
|
, appendonly = True
|
||||||
|
|
|
@ -103,7 +103,7 @@ gen r u rc gc rs = do
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = return Nothing
|
, mkUnavailable = return Nothing
|
||||||
, getInfo = includeCredsInfo c (AWS.creds u) $
|
, getInfo = includeCredsInfo c (AWS.creds u) $
|
||||||
|
|
|
@ -82,7 +82,7 @@ gen r u rc gc rs = do
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = gen r u rc
|
, mkUnavailable = gen r u rc
|
||||||
(gc { remoteAnnexHookType = Just "!dne!" })
|
(gc { remoteAnnexHookType = Just "!dne!" })
|
||||||
|
|
|
@ -95,7 +95,7 @@ gen r u rc gc rs = do
|
||||||
, readonly = True
|
, readonly = True
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = return Nothing
|
, mkUnavailable = return Nothing
|
||||||
, getInfo = return []
|
, getInfo = return []
|
||||||
|
|
|
@ -77,7 +77,7 @@ chainGen addr r u rc gc rs = do
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = return Nothing
|
, mkUnavailable = return Nothing
|
||||||
, getInfo = gitRepoInfo this
|
, getInfo = gitRepoInfo this
|
||||||
|
|
|
@ -120,7 +120,8 @@ gen r u rc gc rs = do
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = if islocal then LocallyAvailable else GloballyAvailable
|
, availability = pure $
|
||||||
|
if islocal then LocallyAvailable else GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = return Nothing
|
, mkUnavailable = return Nothing
|
||||||
, getInfo = return [("url", url)]
|
, getInfo = return [("url", url)]
|
||||||
|
|
|
@ -249,7 +249,7 @@ gen r u rc gc rs = do
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = gen r u (M.insert hostField (Proposed "!dne!") rc) gc rs
|
, mkUnavailable = gen r u (M.insert hostField (Proposed "!dne!") rc) gc rs
|
||||||
, getInfo = includeCredsInfo c (AWS.creds u) (s3Info c info)
|
, getInfo = includeCredsInfo c (AWS.creds u) (s3Info c info)
|
||||||
|
|
|
@ -108,7 +108,7 @@ gen r u rc gc rs = do
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = return Nothing
|
, mkUnavailable = return Nothing
|
||||||
, getInfo = return []
|
, getInfo = return []
|
||||||
|
|
|
@ -93,7 +93,7 @@ gen r u rc gc rs = do
|
||||||
, readonly = True
|
, readonly = True
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = return Nothing
|
, mkUnavailable = return Nothing
|
||||||
, getInfo = return []
|
, getInfo = return []
|
||||||
|
|
|
@ -117,7 +117,7 @@ gen r u rc gc rs = do
|
||||||
, readonly = False
|
, readonly = False
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = False
|
, untrustworthy = False
|
||||||
, availability = GloballyAvailable
|
, availability = pure GloballyAvailable
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = gen r u (M.insert urlField (Proposed "http://!dne!/") rc) gc rs
|
, mkUnavailable = gen r u (M.insert urlField (Proposed "http://!dne!/") rc) gc rs
|
||||||
, getInfo = includeCredsInfo c (davCreds u) $
|
, getInfo = includeCredsInfo c (davCreds u) $
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
|
|
||||||
module Types.Availability where
|
module Types.Availability where
|
||||||
|
|
||||||
data Availability = GloballyAvailable | LocallyAvailable
|
data Availability = GloballyAvailable | LocallyAvailable | Unavailable
|
||||||
deriving (Eq, Show, Read)
|
deriving (Eq, Show)
|
||||||
|
|
|
@ -37,7 +37,6 @@ import Utility.DataUnits
|
||||||
import Config.Cost
|
import Config.Cost
|
||||||
import Types.UUID
|
import Types.UUID
|
||||||
import Types.Distribution
|
import Types.Distribution
|
||||||
import Types.Availability
|
|
||||||
import Types.Concurrency
|
import Types.Concurrency
|
||||||
import Types.NumCopies
|
import Types.NumCopies
|
||||||
import Types.Difference
|
import Types.Difference
|
||||||
|
@ -351,7 +350,6 @@ data RemoteGitConfig = RemoteGitConfig
|
||||||
, remoteAnnexTrustLevel :: Maybe String
|
, remoteAnnexTrustLevel :: Maybe String
|
||||||
, remoteAnnexStartCommand :: Maybe String
|
, remoteAnnexStartCommand :: Maybe String
|
||||||
, remoteAnnexStopCommand :: Maybe String
|
, remoteAnnexStopCommand :: Maybe String
|
||||||
, remoteAnnexAvailability :: Maybe Availability
|
|
||||||
, remoteAnnexSpeculatePresent :: Bool
|
, remoteAnnexSpeculatePresent :: Bool
|
||||||
, remoteAnnexBare :: Maybe Bool
|
, remoteAnnexBare :: Maybe Bool
|
||||||
, remoteAnnexRetry :: Maybe Integer
|
, remoteAnnexRetry :: Maybe Integer
|
||||||
|
@ -416,7 +414,6 @@ extractRemoteGitConfig r remotename = do
|
||||||
, remoteAnnexTrustLevel = notempty $ getmaybe "trustlevel"
|
, remoteAnnexTrustLevel = notempty $ getmaybe "trustlevel"
|
||||||
, remoteAnnexStartCommand = notempty $ getmaybe "start-command"
|
, remoteAnnexStartCommand = notempty $ getmaybe "start-command"
|
||||||
, remoteAnnexStopCommand = notempty $ getmaybe "stop-command"
|
, remoteAnnexStopCommand = notempty $ getmaybe "stop-command"
|
||||||
, remoteAnnexAvailability = getmayberead "availability"
|
|
||||||
, remoteAnnexSpeculatePresent = getbool "speculate-present" False
|
, remoteAnnexSpeculatePresent = getbool "speculate-present" False
|
||||||
, remoteAnnexBare = getmaybebool "bare"
|
, remoteAnnexBare = getmaybebool "bare"
|
||||||
, remoteAnnexRetry = getmayberead "retry"
|
, remoteAnnexRetry = getmayberead "retry"
|
||||||
|
|
|
@ -152,7 +152,8 @@ data RemoteA a = Remote
|
||||||
-- decide.
|
-- decide.
|
||||||
, untrustworthy :: Bool
|
, untrustworthy :: Bool
|
||||||
-- a Remote can be globally available. (Ie, "in the cloud".)
|
-- a Remote can be globally available. (Ie, "in the cloud".)
|
||||||
, availability :: Availability
|
-- Some Remotes can mark themselves unavailable.
|
||||||
|
, availability :: a Availability
|
||||||
-- the type of the remote
|
-- the type of the remote
|
||||||
, remotetype :: RemoteTypeA a
|
, remotetype :: RemoteTypeA a
|
||||||
-- For testing, makes a version of this remote that is not
|
-- For testing, makes a version of this remote that is not
|
||||||
|
|
|
@ -45,7 +45,7 @@ Recent versions of git-annex respond with a message indicating
|
||||||
protocol extensions that it supports. Older versions of
|
protocol extensions that it supports. Older versions of
|
||||||
git-annex do not send this message.
|
git-annex do not send this message.
|
||||||
|
|
||||||
EXTENSIONS INFO ASYNC GETGITREMOTENAME
|
EXTENSIONS INFO ASYNC GETGITREMOTENAME UNAVAILABLERESPONSE
|
||||||
|
|
||||||
The special remote can respond to that with its own EXTENSIONS message, listing
|
The special remote can respond to that with its own EXTENSIONS message, listing
|
||||||
any extensions it wants to use.
|
any extensions it wants to use.
|
||||||
|
@ -208,8 +208,18 @@ the special remote can reply with `UNSUPPORTED-REQUEST`.
|
||||||
If the remote replies with `UNSUPPORTED-REQUEST`, its availability
|
If the remote replies with `UNSUPPORTED-REQUEST`, its availability
|
||||||
is assumed to be global. So, only remotes that are only reachable
|
is assumed to be global. So, only remotes that are only reachable
|
||||||
locally need to worry about implementing this.
|
locally need to worry about implementing this.
|
||||||
|
This is queried at remote startup, so should avoid doing anything that
|
||||||
|
can take long to run or is expensive. Checking if a directory where the
|
||||||
|
remote stores files is currently mounted is the kind of thing it makes
|
||||||
|
sense to do here.
|
||||||
* `AVAILABILITY GLOBAL|LOCAL`
|
* `AVAILABILITY GLOBAL|LOCAL`
|
||||||
Indicates if the remote is globally or only locally available.
|
Indicates if the remote is globally or only locally available.
|
||||||
|
* `AVAILABILITY UNAVAILABLE`
|
||||||
|
Indicates that the remote is not currently available.
|
||||||
|
This will prevent some git-annex commands like `git-annex sync` from
|
||||||
|
trying to use the remote.
|
||||||
|
Older versions of git-annex do not support this response, so avoid
|
||||||
|
sending it unless the `UNAVAILABLERESPONSE` extension is enabled.
|
||||||
* `CLAIMURL Url`
|
* `CLAIMURL Url`
|
||||||
Asks the remote if it wishes to claim responsibility for downloading
|
Asks the remote if it wishes to claim responsibility for downloading
|
||||||
an url.
|
an url.
|
||||||
|
@ -445,13 +455,16 @@ avoid talking to the buggy old version of git-annex.
|
||||||
These protocol extensions are currently supported.
|
These protocol extensions are currently supported.
|
||||||
|
|
||||||
* `INFO`
|
* `INFO`
|
||||||
This makes the `INFO` message available to use.
|
This allows using the `INFO` message.
|
||||||
* `ASYNC`
|
* `ASYNC`
|
||||||
This lets multiple actions be performed at the same time by
|
This lets multiple actions be performed at the same time by
|
||||||
a single external special remote program, rather than starting multiple
|
a single external special remote program, rather than starting multiple
|
||||||
programs. See the [[async_appendix]] for details.
|
programs. See the [[async_appendix]] for details.
|
||||||
* `GETGITREMOTENAME`
|
* `GETGITREMOTENAME`
|
||||||
This makes the `GETGITREMOTENAME` message available to use.
|
This allows using the `GETGITREMOTENAME` message.
|
||||||
|
* `UNAVAILABLERESPONSE`
|
||||||
|
This allows the `AVAILABILITY UNAVAILABLE` response to be used
|
||||||
|
in reply to `GETAVAILABILITY`.
|
||||||
|
|
||||||
## signals
|
## signals
|
||||||
|
|
||||||
|
|
|
@ -1565,8 +1565,7 @@ Remotes are configured using these settings in `.git/config`.
|
||||||
|
|
||||||
* `remote.<name>.annex-availability`
|
* `remote.<name>.annex-availability`
|
||||||
|
|
||||||
Can be used to tell git-annex whether a remote is LocallyAvailable
|
This configuration setting is no longer used.
|
||||||
or GloballyAvailable. Normally, git-annex determines this automatically.
|
|
||||||
|
|
||||||
* `remote.<name>.annex-speculate-present`
|
* `remote.<name>.annex-speculate-present`
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue