datalad.customremotes.archives¶
Custom remote to support getting the load from archives present under annex
-
class
datalad.customremotes.archives.
ArchiveAnnexCustomRemote
(persistent_cache=True, **kwargs)[source]¶ Bases:
datalad.customremotes.base.AnnexCustomRemote
Special custom remote allowing to obtain files from archives
Archives should also be under annex control.
-
AVAILABILITY
= 'local'¶
-
COST
= 500¶
-
CUSTOM_REMOTE_NAME
= 'archive'¶
-
SUPPORTED_SCHEMES
= ('dl+archive',)¶
-
URL_PREFIX
= 'dl+archive:'¶
-
URL_SCHEME
= 'dl+archive'¶
-
cache
¶
-
get_file_url
(archive_file=None, archive_key=None, file=None, size=None)[source]¶ Given archive (file or a key) and a file – compose URL for access
Examples
- dl+archive:SHA256E-s176–69…3e.tar.gz#path=1/d2/2d&size=123
- when size of file within archive was known to be 123
- dl+archive:SHA256E-s176–69…3e.tar.gz#path=1/d2/2d
- when size of file within archive was not provided
Parameters: size (int, optional) – Size of the file. If not provided, will simply be empty
-
req_CHECKPRESENT
(key)[source]¶ Check if copy is available
TODO: just proxy the call to annex for underlying tarball
Replies
- CHECKPRESENT-SUCCESS Key
- Indicates that a key has been positively verified to be present in the remote.
- CHECKPRESENT-FAILURE Key
- Indicates that a key has been positively verified to not be present in the remote.
- CHECKPRESENT-UNKNOWN Key ErrorMsg
- Indicates that it is not currently possible to verify if the key is present in the remote. (Perhaps the remote cannot be contacted.)
-
req_CHECKURL
(url)[source]¶ Replies
- CHECKURL-CONTENTS Size|UNKNOWN Filename
- Indicates that the requested url has been verified to exist. The Size is the size in bytes, or use “UNKNOWN” if the size could not be determined. The Filename can be empty (in which case a default is used), or can specify a filename that is suggested to be used for this url.
- CHECKURL-MULTI Url Size|UNKNOWN Filename …
- Indicates that the requested url has been verified to exist, and contains multiple files, which can each be accessed using their own url. Note that since a list is returned, neither the Url nor the Filename can contain spaces.
- CHECKURL-FAILURE
- Indicates that the requested url could not be accessed.
-
req_REMOVE
(key)[source]¶ - REMOVE-SUCCESS Key
- Indicates the key has been removed from the remote. May be returned if the remote didn’t have the key at the point removal was requested
- REMOVE-FAILURE Key ErrorMsg
- Indicates that the key was unable to be removed from the remote.
-