import downloader complete (untested)

Made some api changes.

listImportableContents needs to provide the size
of the data, so the downloader can check disk free space.

retrieveExportWithContentIdentifier is passed the filepath to write to

Use temporary "CID" key during download of a ContentIdentifier from a
remote, so withTmp can be used and then move the content to the real key
once it's known.
This commit is contained in:
Joey Hess 2019-02-27 13:15:02 -04:00
parent f4b773e9a1
commit 45aacd888b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 64 additions and 36 deletions

View file

@ -253,7 +253,7 @@ seekRemote remote branch msubdir = allowConcurrentOutput $ do
parentcommit <- frombranch Git.Ref.sha
let importcommitconfig = ImportCommitConfig parentcommit ManualCommit importmessage
importable <- download =<< enumerate
importable <- download importtreeconfig =<< enumerate
void $ includeCommandAction $
commitRemote remote branch tb parentcommit importtreeconfig importcommitconfig importable
where
@ -275,9 +275,10 @@ seekRemote remote branch msubdir = allowConcurrentOutput $ do
showEndOk
return importable
download importablecontents = downloadImport remote importablecontents >>= \case
Nothing -> giveup $ "Failed to import some files from " ++ Remote.name remote ++ ". Re-run command to resume import."
Just importable -> return importable
download importtreeconfig importablecontents =
downloadImport remote importtreeconfig importablecontents >>= \case
Nothing -> giveup $ "Failed to import some files from " ++ Remote.name remote ++ ". Re-run command to resume import."
Just importable -> return importable
commitRemote :: Remote -> Branch -> RemoteTrackingBranch -> Maybe Sha -> ImportTreeConfig -> ImportCommitConfig -> ImportableContents Key -> CommandStart
commitRemote remote branch tb parentcommit importtreeconfig importcommitconfig importable = do