summaryrefslogtreecommitdiffhomepage
path: root/Storage.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-22 10:45:42 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-22 10:45:42 -0400
commitf333320af9d711c33b56dcd8dd1df9d9d1b270c3 (patch)
treefdf30c1c90573a2e9eb9b711081b3a011a40e41f /Storage.hs
parent3923667ebdb24680dbb415bd688a8c0326df2212 (diff)
downloadkeysafe-f333320af9d711c33b56dcd8dd1df9d9d1b270c3.tar.gz
cleanup
Diffstat (limited to 'Storage.hs')
-rw-r--r--Storage.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Storage.hs b/Storage.hs
index 3e2c418..ef042ba 100644
--- a/Storage.hs
+++ b/Storage.hs
@@ -26,10 +26,9 @@ import Control.Concurrent.Async
import qualified Data.Set as S
import Network.Wai.Handler.Warp (Port)
-allStorageLocations :: Maybe LocalStorageDirectory -> IO StorageLocations
-allStorageLocations d = do
- servers <- networkServers
- return $ StorageLocations $ map (networkStorage d) servers
+networkStorageLocations :: Maybe LocalStorageDirectory -> StorageLocations
+networkStorageLocations d = StorageLocations $
+ map (networkStorage d) networkServers
localStorageLocations :: Maybe LocalStorageDirectory -> StorageLocations
localStorageLocations d = StorageLocations $
@@ -122,12 +121,12 @@ retrieveShares (StorageLocations locs) sis updateprogress = do
-- | Returns descriptions of any failures.
uploadQueued :: Maybe LocalStorageDirectory -> IO [String]
uploadQueued d = do
- StorageLocations locs <- allStorageLocations d
results <- forM locs $ \loc -> case uploadQueue loc of
Nothing -> return []
Just q -> moveShares q loc
return $ processresults (concat results) []
where
+ StorageLocations locs = networkStorageLocations d
processresults [] c = nub c
processresults (StoreSuccess:rs) c = processresults rs c
processresults (StoreFailure e:rs) c = processresults rs (e:c)