summaryrefslogtreecommitdiffhomepage
path: root/Types/Storage.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Types/Storage.hs')
-rw-r--r--Types/Storage.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/Types/Storage.hs b/Types/Storage.hs
index bc11b55..b3f714a 100644
--- a/Types/Storage.hs
+++ b/Types/Storage.hs
@@ -14,14 +14,21 @@ import Types
newtype StorageLocations = StorageLocations [Storage]
deriving (Monoid)
+-- | Storage interface. This can be used both for local storage,
+-- an upload queue, or a remote server.
+--
+-- Note that there is no interface to enumerate shards.
+-- This is intentional; servers should not allow that.
data Storage = Storage
{ storeShard :: StorableObjectIdent -> Shard -> IO StoreResult
, retrieveShard :: ShardNum -> StorableObjectIdent -> IO RetrieveResult
, obscureShards :: IO ObscureResult
- -- ^ run after making some calls to storeShard/retrieveShard,
- -- to avoid correlation attacks
+ -- ^ Run after making some calls to storeShard/retrieveShard,
+ -- to avoid correlation attacks.
, countShards :: IO CountResult
- } -- Note that there is no interface to enumerate shards.
+ , moveShards :: Storage -> IO ()
+ -- ^ Tries to move all shards from this storage to another one.
+ }
data StoreResult = StoreSuccess | StoreAlreadyExists | StoreFailure String
deriving (Show)