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..
This commit is contained in:
parent
3c81d70c1b
commit
aff09a1f33
14 changed files with 75 additions and 59 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue