diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-19 16:08:37 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-19 16:08:37 -0400 |
commit | aff09a1f33be7b3df182a7c85b30a2d3e04833c7 (patch) | |
tree | 6d7cb4ed4e9483c14bdd832c9af848dc1b866789 /Types | |
parent | 3c81d70c1beccb50571281ef35c9123bac006b7c (diff) |
add a progress callback to storeKey, and threaded it all the way through
Transfer info files are updated when the callback is called, updating
the number of bytes transferred.
Left unused p variables at every place the callback should be used.
Which is rather a lot..
Diffstat (limited to 'Types')
-rw-r--r-- | Types/Remote.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Types/Remote.hs b/Types/Remote.hs index 5e2e566e5..b89972fdd 100644 --- a/Types/Remote.hs +++ b/Types/Remote.hs @@ -36,6 +36,10 @@ instance Eq (RemoteTypeA a) where {- A filename associated with a Key, for display to user. -} type AssociatedFile = Maybe FilePath +{- An action that can be run repeatedly, feeding it the number of + - bytes sent or retreived so far. -} +type ProgressCallback = (Integer -> IO ()) + {- An individual remote. -} data RemoteA a = Remote { -- each Remote has a unique uuid @@ -45,7 +49,7 @@ data RemoteA a = Remote { -- Remotes have a use cost; higher is more expensive cost :: Int, -- Transfers a key to the remote. - storeKey :: Key -> AssociatedFile -> a Bool, + storeKey :: Key -> AssociatedFile -> ProgressCallback -> a Bool, -- retrieves a key's contents to a file retrieveKeyFile :: Key -> AssociatedFile -> FilePath -> a Bool, -- retrieves a key's contents to a tmp file, if it can be done cheaply |