{- Copyright 2016 Joey Hess - - Licensed under the GNU AGPL version 3 or higher. -} module Storage where import Types 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)