summaryrefslogtreecommitdiffhomepage
path: root/Storage/Network.hs
blob: 0b6ff49357b259ff325894c1a364caa04f9a8189 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{- Copyright 2016 Joey Hess <id@joeyh.name>
 -
 - Licensed under the GNU AGPL version 3 or higher.
 -}

{-# LANGUAGE OverloadedStrings #-}

module Storage.Network (Server(..), networkServers, networkStorage) where

import Types
import Types.Storage
import HTTP.Client

newtype Server = Server { serverName :: String }

networkServers :: IO [Server]
networkServers = return [] -- none yet

networkStorage :: Server -> Storage
networkStorage server = Storage
	{ storeShare = store server
	, retrieveShare = retrieve server
	, obscureShares = obscure server
	, countShares = count server
	, moveShares = move server
	}

store :: Server -> StorableObjectIdent -> Share -> IO StoreResult
store _server _i _s = return $ StoreFailure "network storage not implemented yet"

retrieve :: Server -> ShareNum -> StorableObjectIdent -> IO RetrieveResult
retrieve _server _n _i = return $ RetrieveFailure "network storage not implemented yet"

-- | Servers should automatically obscure, so do nothing.
-- (Could upload chaff.)
obscure :: Server -> IO ObscureResult
obscure _ = return ObscureSuccess

count :: Server -> IO CountResult
count _server = return $ CountFailure "network storage not implemented yet"

-- | Not needed for servers.
move :: Server -> Storage -> IO ()
move _ _ = return ()