diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-18 15:32:31 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-18 15:32:31 -0400 |
commit | 338e98c8efcbdabbe00e1f9e64f409aa64f3581a (patch) | |
tree | fb8bceadc363de16443c5d4dbda87995e734fa15 /Types | |
parent | 37f7700c75adff98685cf54966b58d97dac8afcf (diff) | |
download | keysafe-338e98c8efcbdabbe00e1f9e64f409aa64f3581a.tar.gz |
add support for multiple storage locattions
also, server upload queues in ~/.keysafe
Diffstat (limited to 'Types')
-rw-r--r-- | Types/Storage.hs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Types/Storage.hs b/Types/Storage.hs new file mode 100644 index 0000000..bc11b55 --- /dev/null +++ b/Types/Storage.hs @@ -0,0 +1,35 @@ +{- Copyright 2016 Joey Hess <id@joeyh.name> + - + - Licensed under the GNU AGPL version 3 or higher. + -} + +{-# LANGUAGE GeneralizedNewtypeDeriving #-} + +module Types.Storage where + +import Types + +-- | All known locations where shards can be stored, ordered with +-- preferred locations first. +newtype StorageLocations = StorageLocations [Storage] + deriving (Monoid) + +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 + , countShards :: IO CountResult + } -- Note that there is no interface to enumerate shards. + +data StoreResult = StoreSuccess | StoreAlreadyExists | StoreFailure String + deriving (Show) + +data RetrieveResult = RetrieveSuccess Shard | RetrieveFailure String + +data ObscureResult = ObscureSuccess | ObscureFailure String + deriving (Show) + +data CountResult = CountResult Integer | CountFailure String + deriving (Show) |