rsync special remote
Fully tested and working, including resuming and encryption. (Though not resuming when sending *with* encryption; gpg doesn't produce identical output each time.) Uses same layout as the directory special remote and the .git/annex/objects/ directory.
This commit is contained in:
parent
4381ac062f
commit
e68f128a9b
11 changed files with 265 additions and 19 deletions
12
Content.hs
12
Content.hs
|
@ -12,6 +12,7 @@ module Content (
|
|||
logStatusFor,
|
||||
getViaTmp,
|
||||
getViaTmpUnchecked,
|
||||
withTmp,
|
||||
checkDiskSpace,
|
||||
preventWrite,
|
||||
allowWrite,
|
||||
|
@ -127,6 +128,17 @@ getViaTmpUnchecked key action = do
|
|||
-- to resume its transfer
|
||||
return False
|
||||
|
||||
{- Creates a temp file, runs an action on it, and cleans up the temp file. -}
|
||||
withTmp :: Key -> (FilePath -> Annex a) -> Annex a
|
||||
withTmp key action = do
|
||||
g <- Annex.gitRepo
|
||||
let tmp = gitAnnexTmpLocation g key
|
||||
liftIO $ createDirectoryIfMissing True (parentDir tmp)
|
||||
res <- action tmp
|
||||
tmp_exists <- liftIO $ doesFileExist tmp
|
||||
when tmp_exists $ liftIO $ removeFile tmp
|
||||
return res
|
||||
|
||||
{- Checks that there is disk space available to store a given key,
|
||||
- throwing an error if not. -}
|
||||
checkDiskSpace :: Key -> Annex ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue