factor out Types.Transferrer
This commit is contained in:
parent
677003a6df
commit
004a4f5fb1
6 changed files with 29 additions and 12 deletions
|
@ -34,6 +34,7 @@ import Utility.Metered
|
||||||
import Utility.ThreadScheduler
|
import Utility.ThreadScheduler
|
||||||
import Annex.LockPool
|
import Annex.LockPool
|
||||||
import Types.Key
|
import Types.Key
|
||||||
|
import Types.Transferrer
|
||||||
import qualified Types.Remote as Remote
|
import qualified Types.Remote as Remote
|
||||||
import Types.Concurrency
|
import Types.Concurrency
|
||||||
import Annex.Concurrent.Utility
|
import Annex.Concurrent.Utility
|
||||||
|
|
|
@ -12,10 +12,10 @@ module Annex.TransferrerPool where
|
||||||
import Annex.Common
|
import Annex.Common
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
import Types.TransferrerPool
|
import Types.TransferrerPool
|
||||||
|
import Types.Transferrer
|
||||||
import Types.Transfer
|
import Types.Transfer
|
||||||
import Types.Key
|
import Types.Key
|
||||||
import qualified Types.Remote as Remote
|
import qualified Types.Remote as Remote
|
||||||
import Git.Types (RemoteName)
|
|
||||||
import Types.StallDetection
|
import Types.StallDetection
|
||||||
import Types.Messages
|
import Types.Messages
|
||||||
import Messages.Serialized
|
import Messages.Serialized
|
||||||
|
@ -33,17 +33,6 @@ import Text.Read (readMaybe)
|
||||||
import Data.Time.Clock.POSIX
|
import Data.Time.Clock.POSIX
|
||||||
import System.Log.Logger (debugM)
|
import System.Log.Logger (debugM)
|
||||||
|
|
||||||
data TransferRequest = TransferRequest TransferRequestLevel Direction (Either UUID RemoteName) KeyData AssociatedFile
|
|
||||||
deriving (Show, Read)
|
|
||||||
|
|
||||||
data TransferRequestLevel = AnnexLevel | AssistantLevel
|
|
||||||
deriving (Show, Read)
|
|
||||||
|
|
||||||
data TransferResponse
|
|
||||||
= TransferOutput SerializedOutput
|
|
||||||
| TransferResult Bool
|
|
||||||
deriving (Show, Read)
|
|
||||||
|
|
||||||
{- Runs an action with a Transferrer from the pool. -}
|
{- Runs an action with a Transferrer from the pool. -}
|
||||||
withTransferrer :: (Transferrer -> Annex a) -> Annex a
|
withTransferrer :: (Transferrer -> Annex a) -> Annex a
|
||||||
withTransferrer a = do
|
withTransferrer a = do
|
||||||
|
|
|
@ -26,6 +26,7 @@ import Assistant.Commits
|
||||||
import Assistant.Drop
|
import Assistant.Drop
|
||||||
import Annex.Transfer (stallDetection)
|
import Annex.Transfer (stallDetection)
|
||||||
import Types.Transfer
|
import Types.Transfer
|
||||||
|
import Types.Transferrer
|
||||||
import Logs.Transfer
|
import Logs.Transfer
|
||||||
import Logs.Location
|
import Logs.Location
|
||||||
import qualified Git
|
import qualified Git
|
||||||
|
|
|
@ -18,6 +18,7 @@ import qualified Database.Keys
|
||||||
import Annex.BranchState
|
import Annex.BranchState
|
||||||
import Types.Messages
|
import Types.Messages
|
||||||
import Annex.TransferrerPool
|
import Annex.TransferrerPool
|
||||||
|
import Types.Transferrer
|
||||||
|
|
||||||
import Text.Read (readMaybe)
|
import Text.Read (readMaybe)
|
||||||
|
|
||||||
|
|
24
Types/Transferrer.hs
Normal file
24
Types/Transferrer.hs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{- protocol used by "git-annex transferrer"
|
||||||
|
-
|
||||||
|
- Copyright 2020 Joey Hess <id@joeyh.name>
|
||||||
|
-
|
||||||
|
- Licensed under the GNU AGPL version 3 or higher.
|
||||||
|
-}
|
||||||
|
|
||||||
|
module Types.Transferrer where
|
||||||
|
|
||||||
|
import Annex.Common
|
||||||
|
import Types.Transfer
|
||||||
|
import Types.Messages
|
||||||
|
import Git.Types (RemoteName)
|
||||||
|
|
||||||
|
data TransferRequest = TransferRequest TransferRequestLevel Direction (Either UUID RemoteName) KeyData AssociatedFile
|
||||||
|
deriving (Show, Read)
|
||||||
|
|
||||||
|
data TransferRequestLevel = AnnexLevel | AssistantLevel
|
||||||
|
deriving (Show, Read)
|
||||||
|
|
||||||
|
data TransferResponse
|
||||||
|
= TransferOutput SerializedOutput
|
||||||
|
| TransferResult Bool
|
||||||
|
deriving (Show, Read)
|
|
@ -1028,6 +1028,7 @@ Executable git-annex
|
||||||
Types.StoreRetrieve
|
Types.StoreRetrieve
|
||||||
Types.Test
|
Types.Test
|
||||||
Types.Transfer
|
Types.Transfer
|
||||||
|
Types.Transferrer
|
||||||
Types.TransferrerPool
|
Types.TransferrerPool
|
||||||
Types.TrustLevel
|
Types.TrustLevel
|
||||||
Types.UUID
|
Types.UUID
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue