move new interface to git-annex transfer
This is to avoid breakage when upgrading or downgrading git-annex with a process running that uses the interface. It's better to keep the compatability code for a few years than worry about such breakage. This commit was sponsored by Brett Eisenberg on Patreon.
This commit is contained in:
parent
b9c1aa9258
commit
05c0543e8e
10 changed files with 238 additions and 60 deletions
|
@ -1,4 +1,4 @@
|
|||
{- A pool of "git-annex transferkeys" processes
|
||||
{- A pool of "git-annex transfer" processes
|
||||
-
|
||||
- Copyright 2013-2020 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
|
@ -197,12 +197,12 @@ detectStalls (Just (StallDetection minsz duration)) metervar onstall = go Nothin
|
|||
then onstall
|
||||
else go (Just sofar)
|
||||
|
||||
{- Starts a new git-annex transferkeys process, setting up handles
|
||||
{- Starts a new git-annex transfer process, setting up handles
|
||||
- that will be used to communicate with it. -}
|
||||
mkTransferrer :: FilePath -> BatchCommandMaker -> IO Transferrer
|
||||
mkTransferrer program batchmaker = do
|
||||
{- It runs as a batch job. -}
|
||||
let (program', params') = batchmaker (program, [Param "transferkeys"])
|
||||
let (program', params') = batchmaker (program, [Param "transfer"])
|
||||
{- It's put into its own group so that the whole group can be
|
||||
- killed to stop a transfer. -}
|
||||
(Just writeh, Just readh, _, pid) <- createProcess
|
||||
|
@ -243,10 +243,10 @@ readResponse h = do
|
|||
case readMaybe l of
|
||||
Just (TransferOutput so) -> return (Left so)
|
||||
Just (TransferResult r) -> return (Right r)
|
||||
Nothing -> transferKeysProtocolError l
|
||||
Nothing -> transferProtocolError l
|
||||
|
||||
transferKeysProtocolError :: String -> a
|
||||
transferKeysProtocolError l = error $ "transferkeys protocol error: " ++ show l
|
||||
transferProtocolError :: String -> a
|
||||
transferProtocolError l = error $ "transfer protocol error: " ++ show l
|
||||
|
||||
{- Closing the fds will shut down the transferrer, but only when it's
|
||||
- in between transfers. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue