summaryrefslogtreecommitdiffhomepage
path: root/Types
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-10-06 13:54:52 -0400
committerJoey Hess <joeyh@joeyh.name>2016-10-06 13:54:52 -0400
commitb40d441c52f37584653e74fada9906cc8105c9f7 (patch)
tree737396d6ab61212cad52555c7bc99dedd167b330 /Types
parent54d3bfbb98958cb49399f1a7f092fa43593ef4c8 (diff)
downloadkeysafe-b40d441c52f37584653e74fada9906cc8105c9f7.tar.gz
move level from Server to Storage
This allows local storage locations to have levels too, and also get shuffled nicely. This commit was sponsored by Ethan Aubin.
Diffstat (limited to 'Types')
-rw-r--r--Types/Server.hs4
-rw-r--r--Types/Storage.hs4
2 files changed, 4 insertions, 4 deletions
diff --git a/Types/Server.hs b/Types/Server.hs
index 5caf9db..9a2017d 100644
--- a/Types/Server.hs
+++ b/Types/Server.hs
@@ -27,12 +27,8 @@ newtype ServerName = ServerName { fromServerName :: String }
instance ToJSON ServerName
instance FromJSON ServerName
-data ServerLevel = Recommended | Alternate | Untrusted
- deriving (Show, Eq, Ord, Bounded, Enum)
-
data Server = Server
{ serverName :: ServerName
- , serverLevel :: ServerLevel
, serverAddress :: [ServerAddress]
-- ^ A server may have multiple addresses, or no current address.
, serverDesc :: String
diff --git a/Types/Storage.hs b/Types/Storage.hs
index d9db853..c83593a 100644
--- a/Types/Storage.hs
+++ b/Types/Storage.hs
@@ -20,6 +20,9 @@ newtype StorageLocations = StorageLocations [Storage]
newtype LocalStorageDirectory = LocalStorageDirectory FilePath
+data StorageLevel = LocallyPreferred | Recommended | Alternate | Untrusted
+ deriving (Show, Eq, Ord, Bounded, Enum)
+
-- | Storage interface. This can be used both for local storage,
-- an upload queue, or a remote server.
--
@@ -35,6 +38,7 @@ data Storage = Storage
, moveShares :: Storage -> IO [StoreResult]
-- ^ Tries to move all shares from this storage to another one.
, uploadQueue :: Maybe Storage
+ , storageLevel :: StorageLevel
, getServer :: Maybe Server
}