From 73f198211e2084a7441fc545c47e387141902d55 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Tue, 6 Jun 2023 08:08:04 -0400 Subject: [PATCH] we can get rid of ServerT like this but it reveals that perhaps the functions that operated on it don't belong on the class at all --- src/Tahoe/Capability/Internal/Capability.hs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Tahoe/Capability/Internal/Capability.hs b/src/Tahoe/Capability/Internal/Capability.hs index ed2f2e5..b77ef26 100644 --- a/src/Tahoe/Capability/Internal/Capability.hs +++ b/src/Tahoe/Capability/Internal/Capability.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} module Tahoe.Capability.Internal.Capability where @@ -17,19 +16,17 @@ class Verifiable verifyCap where -- | Represent the type of share to operate on. type ShareT verifyCap - -- | Represent the type of server we can retrieve the associated shares from. - -- XXX No, this is wrong. - type ServerT verifyCap - -- | Ask a storage server which share numbers related to this capability it -- is holding. This is an unverified result and the storage server could -- present incorrect information. Even if it correctly reports that it -- holds a share, it could decline to give it out when asked. - getShareNumbers :: MonadIO m => verifyCap -> ServerT verifyCap -> m (Set.Set ShareNum) + getShareNumbers :: MonadIO m => verifyCap -> (StorageIndex -> m (Set.Set ShareNum)) -> m (Set.Set ShareNum) -- | Get the encoding parameters used for the shares of this capability. -- The information is presented as a tuple of (required, total). - getRequiredTotal :: MonadIO m => verifyCap -> ServerT verifyCap -> m (Maybe (Int, Int)) + -- + -- XXX Remove this, replace it with + getRequiredTotal :: MonadIO m => verifyCap -> (StorageIndex -> m LB.ByteString) -> m (Maybe (Int, Int)) -- | Get the location information for shares of this capability. getStorageIndex :: verifyCap -> StorageIndex @@ -60,6 +57,6 @@ class Readable r where -- shareToCipherText :: r -> [(ShareNum, ShareT r)] -> LB.ByteString -- -- cipherTextToPlainText :: r -> LB.ByteString -> LB.ByteString - decodeShare :: MonadIO m => r -> [(ShareNum, ShareT (VerifierT r))] -> m (Either DownloadError LB.ByteString) + decodeShares :: MonadIO m => r -> [(ShareNum, ShareT (VerifierT r))] -> m (Either DownloadError LB.ByteString) data DownloadError = DownloadError -- GitLab