]> dgit.raspbian.org Git - git-annex.git/commitdiff
rename helper
authorJoey Hess <joeyh@joeyh.name>
Wed, 9 Dec 2020 17:21:20 +0000 (13:21 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 9 Dec 2020 17:24:24 +0000 (13:24 -0400)
More consistent name with TransferrerPool

Annex/TransferrerPool.hs
CmdLine/GitAnnex.hs
Command/Transfer.hs [deleted file]
Command/Transferrer.hs [new file with mode: 0644]
doc/git-annex-transfer.mdwn [deleted file]
doc/git-annex-transferrer.mdwn [new file with mode: 0644]
doc/git-annex.mdwn
git-annex.cabal

index f6babdcc632be654dc536dc0ae49bf7f18f8fc9f..8e5894a59020ebc4435368c29fb129ee9106b555 100644 (file)
@@ -1,4 +1,4 @@
-{- A pool of "git-annex transfer" processes
+{- A pool of "git-annex transferrer" processes
  -
  - Copyright 2013-2020 Joey Hess <id@joeyh.name>
  -
@@ -205,7 +205,7 @@ detectStalls (Just (StallDetection minsz duration)) metervar onstall = go Nothin
 mkTransferrer :: FilePath -> BatchCommandMaker -> IO Transferrer
 mkTransferrer program batchmaker = do
        {- It runs as a batch job. -}
-       let (program', params') = batchmaker (program, [Param "transfer"])
+       let (program', params') = batchmaker (program, [Param "transferrer"])
        {- 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
@@ -246,10 +246,10 @@ readResponse h = do
        case readMaybe l of
                Just (TransferOutput so) -> return (Left so)
                Just (TransferResult r) -> return (Right r)
-               Nothing -> transferProtocolError l
+               Nothing -> transferrerProtocolError l
 
-transferProtocolError :: String -> a
-transferProtocolError l = error $ "transfer protocol error: " ++ show l
+transferrerProtocolError :: String -> a
+transferrerProtocolError l = error $ "transferrer protocol error: " ++ show l
 
 {- Closing the fds will shut down the transferrer, but only when it's
  - in between transfers. -}
index 2364df8bac3ea1c744fdb6cfd887be96c9d09cb3..6d9cc4a4389b8b3f8b231d298b8347bdb3d0e910 100644 (file)
@@ -35,7 +35,7 @@ import qualified Command.FromKey
 import qualified Command.RegisterUrl
 import qualified Command.SetKey
 import qualified Command.DropKey
-import qualified Command.Transfer
+import qualified Command.Transferrer
 import qualified Command.TransferKey
 import qualified Command.TransferKeys
 import qualified Command.SetPresentKey
@@ -178,7 +178,7 @@ cmds testoptparser testrunner mkbenchmarkgenerator =
        , Command.RegisterUrl.cmd
        , Command.SetKey.cmd
        , Command.DropKey.cmd
-       , Command.Transfer.cmd
+       , Command.Transferrer.cmd
        , Command.TransferKey.cmd
        , Command.TransferKeys.cmd
        , Command.SetPresentKey.cmd
diff --git a/Command/Transfer.hs b/Command/Transfer.hs
deleted file mode 100644 (file)
index f4a1cd2..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-{- git-annex command
- -
- - Copyright 2012-2020 Joey Hess <id@joeyh.name>
- -
- - Licensed under the GNU AGPL version 3 or higher.
- -}
-
-module Command.Transfer where
-
-import Command
-import qualified Annex
-import Annex.Content
-import Logs.Location
-import Annex.Transfer
-import qualified Remote
-import Utility.SimpleProtocol (dupIoHandles)
-import qualified Database.Keys
-import Annex.BranchState
-import Types.Messages
-import Annex.TransferrerPool
-
-import Text.Read (readMaybe)
-
-cmd :: Command
-cmd = command "transfer" SectionPlumbing "transfers content"
-       paramNothing (withParams seek)
-
-seek :: CmdParams -> CommandSeek
-seek = withNothing (commandAction start)
-
-start :: CommandStart
-start = do
-       enableInteractiveBranchAccess
-       (readh, writeh) <- liftIO dupIoHandles
-       Annex.setOutput $ SerializedOutput
-               (\v -> hPutStrLn writeh (show (TransferOutput v)) >> hFlush writeh)
-               (readMaybe <$> hGetLine readh)
-       runRequests readh writeh runner
-       stop
-  where
-       runner (TransferRequest AnnexLevel direction _ keydata file) remote
-               | direction == Upload =
-                       -- This is called by eg, Annex.Transfer.upload,
-                       -- so caller is responsible for doing notification,
-                       -- and for retrying.
-                       upload' (Remote.uuid remote) key file noRetry
-                               (Remote.action . Remote.storeKey remote key file)
-                               noNotification
-               | otherwise =
-                       -- This is called by eg, Annex.Transfer.download
-                       -- so caller is responsible for doing notification
-                       -- and for retrying.
-                       let go p = getViaTmp (Remote.retrievalSecurityPolicy remote) (RemoteVerify remote) key file $ \t -> do
-                               Remote.verifiedAction (Remote.retrieveKeyFile remote key file (fromRawFilePath t) p)
-                       in download' (Remote.uuid remote) key file noRetry go 
-                               noNotification
-         where
-               key = mkKey (const keydata)
-       runner (TransferRequest AssistantLevel direction _ keydata file) remote
-               | direction == Upload = notifyTransfer direction file $
-                       upload' (Remote.uuid remote) key file stdRetry $ \p -> do
-                               tryNonAsync (Remote.storeKey remote key file p) >>= \case
-                                       Left e -> do
-                                               warning (show e)
-                                               return False
-                                       Right () -> do
-                                               Remote.logStatus remote key InfoPresent
-                                               return True
-               | otherwise = notifyTransfer direction file $
-                       download' (Remote.uuid remote) key file stdRetry $ \p ->
-                               getViaTmp (Remote.retrievalSecurityPolicy remote) (RemoteVerify remote) key file $ \t -> do
-                                       r <- tryNonAsync (Remote.retrieveKeyFile remote key file (fromRawFilePath t) p) >>= \case
-                                               Left e -> do
-                                                       warning (show e)
-                                                       return (False, UnVerified)
-                                               Right v -> return (True, v)
-                                       -- Make sure we get the current
-                                       -- associated files data for the key,
-                                       -- not old cached data.
-                                       Database.Keys.closeDb                   
-                                       return r
-         where
-               key = mkKey (const keydata)
-
-runRequests
-       :: Handle
-       -> Handle
-       -> (TransferRequest -> Remote -> Annex Bool)
-       -> Annex ()
-runRequests readh writeh a = go Nothing Nothing
-  where
-       go lastremoteoruuid lastremote = unlessM (liftIO $ hIsEOF readh) $ do
-               l <- liftIO $ hGetLine readh
-               case readMaybe l of
-                       Just tr@(TransferRequest _ _ remoteoruuid _ _) -> do
-                               -- Often the same remote will be used
-                               -- repeatedly, so cache the last one to
-                               -- avoid looking up repeatedly.
-                               mremote <- if lastremoteoruuid == Just remoteoruuid
-                                       then pure lastremote
-                                       else eitherToMaybe <$> Remote.byName'
-                                               (either fromUUID id remoteoruuid)
-                               case mremote of
-                                       Just remote -> do
-                                               sendresult =<< a tr remote
-                                               go (Just remoteoruuid) mremote
-                                       Nothing -> transferProtocolError l
-                       Nothing -> transferProtocolError l
-
-       sendresult b = liftIO $ do
-               hPutStrLn writeh $ show $ TransferResult b
-               hFlush writeh
diff --git a/Command/Transferrer.hs b/Command/Transferrer.hs
new file mode 100644 (file)
index 0000000..0596c6c
--- /dev/null
@@ -0,0 +1,112 @@
+{- git-annex command
+ -
+ - Copyright 2012-2020 Joey Hess <id@joeyh.name>
+ -
+ - Licensed under the GNU AGPL version 3 or higher.
+ -}
+
+module Command.Transferrer where
+
+import Command
+import qualified Annex
+import Annex.Content
+import Logs.Location
+import Annex.Transfer
+import qualified Remote
+import Utility.SimpleProtocol (dupIoHandles)
+import qualified Database.Keys
+import Annex.BranchState
+import Types.Messages
+import Annex.TransferrerPool
+
+import Text.Read (readMaybe)
+
+cmd :: Command
+cmd = command "transferrer" SectionPlumbing "transfers content"
+       paramNothing (withParams seek)
+
+seek :: CmdParams -> CommandSeek
+seek = withNothing (commandAction start)
+
+start :: CommandStart
+start = do
+       enableInteractiveBranchAccess
+       (readh, writeh) <- liftIO dupIoHandles
+       Annex.setOutput $ SerializedOutput
+               (\v -> hPutStrLn writeh (show (TransferOutput v)) >> hFlush writeh)
+               (readMaybe <$> hGetLine readh)
+       runRequests readh writeh runner
+       stop
+  where
+       runner (TransferRequest AnnexLevel direction _ keydata file) remote
+               | direction == Upload =
+                       -- This is called by eg, Annex.Transfer.upload,
+                       -- so caller is responsible for doing notification,
+                       -- and for retrying.
+                       upload' (Remote.uuid remote) key file noRetry
+                               (Remote.action . Remote.storeKey remote key file)
+                               noNotification
+               | otherwise =
+                       -- This is called by eg, Annex.Transfer.download
+                       -- so caller is responsible for doing notification
+                       -- and for retrying.
+                       let go p = getViaTmp (Remote.retrievalSecurityPolicy remote) (RemoteVerify remote) key file $ \t -> do
+                               Remote.verifiedAction (Remote.retrieveKeyFile remote key file (fromRawFilePath t) p)
+                       in download' (Remote.uuid remote) key file noRetry go 
+                               noNotification
+         where
+               key = mkKey (const keydata)
+       runner (TransferRequest AssistantLevel direction _ keydata file) remote
+               | direction == Upload = notifyTransfer direction file $
+                       upload' (Remote.uuid remote) key file stdRetry $ \p -> do
+                               tryNonAsync (Remote.storeKey remote key file p) >>= \case
+                                       Left e -> do
+                                               warning (show e)
+                                               return False
+                                       Right () -> do
+                                               Remote.logStatus remote key InfoPresent
+                                               return True
+               | otherwise = notifyTransfer direction file $
+                       download' (Remote.uuid remote) key file stdRetry $ \p ->
+                               getViaTmp (Remote.retrievalSecurityPolicy remote) (RemoteVerify remote) key file $ \t -> do
+                                       r <- tryNonAsync (Remote.retrieveKeyFile remote key file (fromRawFilePath t) p) >>= \case
+                                               Left e -> do
+                                                       warning (show e)
+                                                       return (False, UnVerified)
+                                               Right v -> return (True, v)
+                                       -- Make sure we get the current
+                                       -- associated files data for the key,
+                                       -- not old cached data.
+                                       Database.Keys.closeDb                   
+                                       return r
+         where
+               key = mkKey (const keydata)
+
+runRequests
+       :: Handle
+       -> Handle
+       -> (TransferRequest -> Remote -> Annex Bool)
+       -> Annex ()
+runRequests readh writeh a = go Nothing Nothing
+  where
+       go lastremoteoruuid lastremote = unlessM (liftIO $ hIsEOF readh) $ do
+               l <- liftIO $ hGetLine readh
+               case readMaybe l of
+                       Just tr@(TransferRequest _ _ remoteoruuid _ _) -> do
+                               -- Often the same remote will be used
+                               -- repeatedly, so cache the last one to
+                               -- avoid looking up repeatedly.
+                               mremote <- if lastremoteoruuid == Just remoteoruuid
+                                       then pure lastremote
+                                       else eitherToMaybe <$> Remote.byName'
+                                               (either fromUUID id remoteoruuid)
+                               case mremote of
+                                       Just remote -> do
+                                               sendresult =<< a tr remote
+                                               go (Just remoteoruuid) mremote
+                                       Nothing -> transferrerProtocolError l
+                       Nothing -> transferrerProtocolError l
+
+       sendresult b = liftIO $ do
+               hPutStrLn writeh $ show $ TransferResult b
+               hFlush writeh
diff --git a/doc/git-annex-transfer.mdwn b/doc/git-annex-transfer.mdwn
deleted file mode 100644 (file)
index a318959..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# NAME
-
-git-annex transfer - transfers content
-
-# SYNOPSIS
-
-git annex transfer
-
-# DESCRIPTION
-
-This plumbing-level command is used to transfer data.
-It is a long-running process, which is fed instructions about
-what to transfer using an internal stdio protocol, which is
-intentionally not documented (as it may change at any time).
-
-# SEE ALSO
-
-[[git-annex]](1)
-
-# AUTHOR
-
-Joey Hess <id@joeyh.name>
-
-Warning: Automatically converted into a man page by mdwn2man. Edit with care.
diff --git a/doc/git-annex-transferrer.mdwn b/doc/git-annex-transferrer.mdwn
new file mode 100644 (file)
index 0000000..b1fb7f0
--- /dev/null
@@ -0,0 +1,24 @@
+# NAME
+
+git-annex transferrer - transfers content
+
+# SYNOPSIS
+
+git annex transferrer
+
+# DESCRIPTION
+
+This plumbing-level command is used to transfer data.
+It is a long-running process, which is fed instructions about
+what to transfer using an internal stdio protocol, which is
+intentionally not documented (as it may change at any time).
+
+# SEE ALSO
+
+[[git-annex]](1)
+
+# AUTHOR
+
+Joey Hess <id@joeyh.name>
+
+Warning: Automatically converted into a man page by mdwn2man. Edit with care.
index b1be9055f1910c87e059306f564edb35f443aa33..f83398997eadb53df9e569d4415eeb39f32be906 100644 (file)
@@ -631,11 +631,11 @@ content from the key-value store.
   
   See [[git-annex-transferkey]](1) for details.
 
-* `transfer`
+* `transferrer`
   
   Used internally by git-annex to transfer content.
 
-  See [[git-annex-transfer]](1) for details.
+  See [[git-annex-transferrer]](1) for details.
 
 * `transferkeys`
   
index a7d74579ee4e3bedba4b89812362f23c6ee8d435..0d209da99e8011409c07420fcba08d73bfc9522e 100644 (file)
@@ -794,7 +794,7 @@ Executable git-annex
     Command.Test
     Command.TestRemote
     Command.TransferInfo
-    Command.Transfer
+    Command.Transferrer
     Command.TransferKey
     Command.TransferKeys
     Command.Trust