diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-17 15:23:00 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-17 15:23:00 -0400 |
commit | 41bfb68ee296a4ecdcbd9c02d242d6c9e149b7b8 (patch) | |
tree | 55e456e9e56cdc1c584c1a090536a05eec791495 /Storage.hs | |
parent | e32b20fe15175136bc98b25a002c5acc495679eb (diff) | |
download | keysafe-41bfb68ee296a4ecdcbd9c02d242d6c9e149b7b8.tar.gz |
make storage to use configurable on command line
Diffstat (limited to 'Storage.hs')
-rw-r--r-- | Storage.hs | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -6,6 +6,7 @@ module Storage where import Types +import Shard data Storage = Storage { storeShard :: StorableObjectIdent -> Shard -> IO StoreResult @@ -26,3 +27,17 @@ data ObscureResult = ObscureSuccess | ObscureFailure String data CountResult = CountResult Integer | CountFailure String deriving (Show) + +storeShards :: Storage -> ShardIdents -> [(IO (), Shard)] -> IO StoreResult +storeShards storage sis shards = do + r <- go (zip (getIdents sis) shards) + _ <- obscureShards storage + return r + where + go [] = return StoreSuccess + go ((i,(showprogress, s)):rest) = do + r <- storeShard storage i s + _ <- showprogress + case r of + StoreSuccess -> go rest + _ -> return r |