summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Command')
-rw-r--r--Command/Fsck.hs2
-rw-r--r--Command/Get.hs4
-rw-r--r--Command/Move.hs8
-rw-r--r--Command/Status.hs20
4 files changed, 28 insertions, 6 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 7bfc46f4a..10cca489b 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -94,7 +94,7 @@ performRemote key file backend numcopies remote =
( return True
, ifM (Annex.getState Annex.fast)
( return False
- , Remote.retrieveKeyFile remote key tmp
+ , Remote.retrieveKeyFile remote key Nothing tmp
)
)
diff --git a/Command/Get.hs b/Command/Get.hs
index 35e25d975..a5901ba66 100644
--- a/Command/Get.hs
+++ b/Command/Get.hs
@@ -65,7 +65,7 @@ getKeyFile key file dest = dispatch =<< Remote.keyPossibilities key
| Remote.hasKeyCheap r =
either (const False) id <$> Remote.hasKey r key
| otherwise = return True
- docopy r continue = download r key file $ do
+ docopy r continue = download (Remote.uuid r) key (Just file) $ do
showAction $ "from " ++ Remote.name r
- ifM (Remote.retrieveKeyFile r key dest)
+ ifM (Remote.retrieveKeyFile r key (Just file) dest)
( return True , continue)
diff --git a/Command/Move.hs b/Command/Move.hs
index 8bba46878..e7c11e80d 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -89,7 +89,8 @@ toPerform dest move key file = moveLock move key $ do
stop
Right False -> do
showAction $ "to " ++ Remote.name dest
- ok <- upload dest key file $ Remote.storeKey dest key
+ ok <- upload (Remote.uuid dest) key (Just file) $
+ Remote.storeKey dest key (Just file)
if ok
then finish
else do
@@ -134,9 +135,10 @@ fromPerform :: Remote -> Bool -> Key -> FilePath -> CommandPerform
fromPerform src move key file = moveLock move key $
ifM (inAnnex key)
( handle move True
- , download src key file $ do
+ , download (Remote.uuid src) key (Just file) $ do
showAction $ "from " ++ Remote.name src
- ok <- getViaTmp key $ Remote.retrieveKeyFile src key
+ ok <- getViaTmp key $
+ Remote.retrieveKeyFile src key (Just file)
handle move ok
)
where
diff --git a/Command/Status.hs b/Command/Status.hs
index 2540a92da..eff21bb50 100644
--- a/Command/Status.hs
+++ b/Command/Status.hs
@@ -31,6 +31,7 @@ import Logs.Trust
import Remote
import Config
import Utility.Percentage
+import Logs.Transfer
-- a named computation that produces a statistic
type Stat = StatState (Maybe (String, StatState String))
@@ -70,6 +71,7 @@ fast_stats =
, remote_list SemiTrusted "semitrusted"
, remote_list UnTrusted "untrusted"
, remote_list DeadTrusted "dead"
+ , transfer_list
, disk_size
]
slow_stats :: [Stat]
@@ -170,6 +172,24 @@ bloom_info = stat "bloom filter size" $ json id $ do
return $ size ++ note
+transfer_list :: Stat
+transfer_list = stat "transfers in progress" $ nojson $ lift $ do
+ uuidmap <- Remote.remoteMap id
+ ts <- getTransfers
+ if null ts
+ then return "none"
+ else return $ pp uuidmap "" $ sort ts
+ where
+ pp _ c [] = c
+ pp uuidmap c ((t, i):xs) = "\n\t" ++ line uuidmap t i ++ pp uuidmap c xs
+ line uuidmap t i = unwords
+ [ show (transferDirection t) ++ "ing"
+ , fromMaybe (show $ transferKey t) (associatedFile i)
+ , if transferDirection t == Upload then "to" else "from"
+ , maybe (fromUUID $ transferRemote t) Remote.name $
+ M.lookup (transferRemote t) uuidmap
+ ]
+
disk_size :: Stat
disk_size = stat "available local disk space" $ json id $ lift $
calcfree