added an optional cost= configuration to all special remotes

Note that when this is specified and an older git-annex is used to
enableremote such a special remote, it will simply ignore the cost= field
and use whatever the default cost is.

In passing, fixed adb to support the remote.name.cost and
remote.name.cost-command configs.

Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
Joey Hess 2023-01-12 13:42:28 -04:00
parent 400ce29a94
commit cfaae7e931
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
25 changed files with 83 additions and 42 deletions

View file

@ -15,6 +15,7 @@ import Types.Creds
import Types.Export
import Types.Import
import qualified Git
import Config
import Config.Cost
import Remote.Helper.Special
import Remote.Helper.ExportImport
@ -70,11 +71,12 @@ oldandroidField = Accepted "oldandroid"
gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> RemoteStateHandle -> Annex (Maybe Remote)
gen r u rc gc rs = do
c <- parsedRemoteConfig remote rc
-- adb operates over USB or wifi, so is not as cheap
-- as local, but not too expensive
cst <- remoteCost gc c semiExpensiveRemoteCost
let this = Remote
{ uuid = u
-- adb operates over USB or wifi, so is not as cheap
-- as local, but not too expensive
, cost = semiExpensiveRemoteCost
, cost = cst
, name = Git.repoDescribe r
, storeKey = storeKeyDummy
, retrieveKeyFile = retrieveKeyFileDummy