Added SETURIPRESENT and SETURIMISSING to external special remote protocol

Useful for things like ipfs that don't use regular urls.

An external special remote can add a regular url to a key, and then
git-annex get will download it from the web. But for ipfs, we want to
instead tell git-annex that the uri uses OtherDownloader. Before this
change, the external special remote protocol lacked a way to do that.
This commit is contained in:
Joey Hess 2015-03-05 13:50:15 -04:00
parent 9b4b190739
commit 6045406deb
7 changed files with 32 additions and 6 deletions

View file

@ -274,10 +274,19 @@ in control.
Gets any state that has been stored for the key.
(git-annex replies with VALUE followed by the state.)
* `SETURLPRESENT Key Url`
Records an url (or uri) where the Key can be downloaded from.
Records an URL where the Key can be downloaded from.
* `SETURLMISSING Key Url`
Records that the key can no longer be downloaded from the specified
url (or uri).
URL.
* `SETURIPRESENT Key Uri`
Records a special URI where the Key can be downloaded from.
For example, "ipfs:ADDRESS" is used for the ipfs special remote;
its CLAIMURL handler checks for such URIS and claims them. Setting
it present as an URI makes `git annex whereis` display the URI
as belonging to the special remote.
* `SETURIMISSING Key Uri`
Records that the key can no longer be downloaded from the specified
URI.
* `GETURLS Key Prefix`
Gets the recorded urls where a Key can be downloaded from.
Only urls that start with the Prefix will be returned. The Prefix

View file

@ -89,7 +89,7 @@ while read line; do
if [ -z "$addr" ]; then
echo TRANSFER-FAILURE STORE "$key" "ipfs add failed"
else
echo "SETURLPRESENT" "$key" "$(addresstourl "$addr")"
echo "SETURIPRESENT" "$key" "$(addresstourl "$addr")"
echo TRANSFER-SUCCESS STORE "$key"
fi
;;

View file

@ -7,8 +7,7 @@ keep your data safe while you're using ipfs.
## prerequisites
* git-annex version 5.20141219 or newer, which has [[external]] special remote
support.
* git-annex version 5.20150305 or newer.
* Install [[external/git-annex-remote-ipfs]] somewhere in PATH
and `chmod +x` the script.
* Install [go-ipfs](https://github.com/jbenet/go-ipfs) somewhere in PATH.