Put non-object tmp files in .git/annex/misctmp, leaving .git/annex/tmp for only partially transferred objects.

This allows eg, putting .git/annex/tmp on a ram disk, if the disk IO
of temp object files is too annoying (and if you don't want to keep
partially transferred objects across reboots).

.git/annex/misctmp must be on the same filesystem as the git work tree,
since files are moved to there in a way that will not work cross-device,
as well as symlinked into there.

I first wanted to put the tmp objects in .git/annex/objects/tmp, but
that would pose transition problems on upgrade when partially transferred
objects existed.

git annex info does not currently show the size of .git/annex/misctemp,
since it should stay small. It would also be ok to make something clean it
out, periodically.
This commit is contained in:
Joey Hess 2014-02-26 16:52:56 -04:00
parent a19ad12018
commit a1432bce2f
18 changed files with 35 additions and 28 deletions

View file

@ -114,7 +114,7 @@ addUrlFileQuvi relaxed quviurl videourl file = do
- it later. -}
sizedkey <- addSizeUrlKey videourl key
prepGetViaTmpChecked sizedkey $ do
tmp <- fromRepo $ gitAnnexTmpLocation key
tmp <- fromRepo $ gitAnnexTmpObjectLocation key
showOutput
ok <- Transfer.download webUUID key (Just file) Transfer.forwardRetry $ const $ do
liftIO $ createDirectoryIfMissing True (parentDir tmp)
@ -162,7 +162,7 @@ download url file = do
- downloads, as the dummy key for a given url is stable. -}
dummykey <- addSizeUrlKey url =<< Backend.URL.fromUrl url Nothing
prepGetViaTmpChecked dummykey $ do
tmp <- fromRepo $ gitAnnexTmpLocation dummykey
tmp <- fromRepo $ gitAnnexTmpObjectLocation dummykey
showOutput
ifM (runtransfer dummykey tmp)
( do