summaryrefslogtreecommitdiffhomepage
path: root/Storage
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-17 15:23:00 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-17 15:23:00 -0400
commit41bfb68ee296a4ecdcbd9c02d242d6c9e149b7b8 (patch)
tree55e456e9e56cdc1c584c1a090536a05eec791495 /Storage
parente32b20fe15175136bc98b25a002c5acc495679eb (diff)
downloadkeysafe-41bfb68ee296a4ecdcbd9c02d242d6c9e149b7b8.tar.gz
make storage to use configurable on command line
Diffstat (limited to 'Storage')
-rw-r--r--Storage/Local.hs (renamed from Storage/LocalFiles.hs)6
-rw-r--r--Storage/Network.hs33
2 files changed, 36 insertions, 3 deletions
diff --git a/Storage/LocalFiles.hs b/Storage/Local.hs
index ebcc492..93647df 100644
--- a/Storage/LocalFiles.hs
+++ b/Storage/Local.hs
@@ -5,7 +5,7 @@
{-# LANGUAGE OverloadedStrings #-}
-module Storage.LocalFiles (localFiles) where
+module Storage.Local (localStorage) where
import Types
import Storage
@@ -23,8 +23,8 @@ import Raaz.Core.Encode
import Control.DeepSeq
import Control.Exception
-localFiles :: Storage
-localFiles = Storage
+localStorage :: Storage
+localStorage = Storage
{ storeShard = store
, retrieveShard = retrieve
, obscureShards = obscure
diff --git a/Storage/Network.hs b/Storage/Network.hs
new file mode 100644
index 0000000..06b7545
--- /dev/null
+++ b/Storage/Network.hs
@@ -0,0 +1,33 @@
+{- Copyright 2016 Joey Hess <id@joeyh.name>
+ -
+ - Licensed under the GNU AGPL version 3 or higher.
+ -}
+
+{-# LANGUAGE OverloadedStrings #-}
+
+module Storage.Network (networkStorage) where
+
+import Types
+import Storage
+
+networkStorage :: Storage
+networkStorage = Storage
+ { storeShard = store
+ , retrieveShard = retrieve
+ , obscureShards = obscure
+ , countShards = count
+ }
+
+store :: StorableObjectIdent -> Shard -> IO StoreResult
+store _i _s = return $ StoreFailure "network storage not implemented yet"
+
+retrieve :: ShardNum -> StorableObjectIdent -> IO RetrieveResult
+retrieve _n _i = return $ RetrieveFailure "network storage not implemented yet"
+
+-- | Servers should automatically obscure, so do nothing.
+-- (Could upload chaff.)
+obscure :: IO ObscureResult
+obscure = return ObscureSuccess
+
+count :: IO CountResult
+count = return $ CountFailure "network storage not implemented yet"