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

@ -106,6 +106,12 @@ want to use `git annex renameremote`.
when the special remote does not need anything special to be done to get
it enabled.
* `cost`
Specify this to override the default cost of the special remote.
This configuration can be overridden by the local git config,
eg remote.name.annex-cost.
* `uuid`
Normally, git-annex initremote generates a new UUID for the new special

View file

@ -128,13 +128,12 @@ about, and git-annex may use any of those urls for downloading a file.
If some urls are especially fast, or especially slow, you might want to
configure which urls git-annex prefers to use first, or should only use as
a last resory. To accomplish that, you can create additional remotes, that
are web special remotes, and are configured to only be used for some urls.
Then it's simply a matter of configuring the cost of those remotes.
are web special remotes, and are configured to only be used for some urls,
and have a different cost than the web special remote.
For example, suppose that you want to prioritize using urls on "fasthost.com".
git-annex initremote --sameas=web fasthost type=web urlinclude='*//fasthost.com/*'
git config remote.fasthost.annex-cost 150
git-annex initremote --sameas=web fasthost type=web urlinclude='*//fasthost.com/*' cost=150
Now, `git-annex get` of a file that is on both fasthost.com and another url
will prefer to use the fasthost special remote, rather than the web special
@ -145,8 +144,7 @@ remote, and use the other url.
Suppose that you want to avoid using urls on "slowhost.com", except
as a last resort.
git-annex initremote --sameas=web slowhost type=web urlinclude='*//slowhost.com/*'
git config remote.slowhost.annex-cost 300
git-annex initremote --sameas=web slowhost type=web urlinclude='*//slowhost.com/*' cost=300
Now, `git-annex get` of a file that is on both slowhost.com and another url
will first try the fasthost remote. If fasthost does not support the url,

View file

@ -30,3 +30,5 @@ PS somehow I have some odd memory of seeing some config option to provide git-an
[[!meta author=yoh]]
[[!tag projects/dandi]]
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,9 @@
[[!comment format=mdwn
username="joey"
subject="""comment 11"""
date="2023-01-12T17:38:38Z"
content="""
Went ahead and implememented cost=, so now all you need is:
git-annex initremote --sameas=web dandiapi type=web urlinclude='*//api.dandiarchive.org/*' cost=300
"""]]