IncrementalVerifier moved to Utility.Hash, which will let Utility.Url
use it later.

It's perhaps not really specific to hashing, but making a separate
module just for the data type seemed unncessary.

Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
Joey Hess 2021-08-18 13:19:02 -04:00
parent 57b5ec79e7
commit 449851225a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
10 changed files with 61 additions and 54 deletions

View file

@ -13,8 +13,7 @@ import Types.Key
import Types.KeySource
import Utility.Metered
import Utility.FileSystemEncoding
import Data.ByteString (ByteString)
import Utility.Hash (IncrementalVerifier)
data BackendA a = Backend
{ backendVariety :: KeyVariety
@ -43,19 +42,3 @@ instance Show (BackendA a) where
instance Eq (BackendA a) where
a == b = backendVariety a == backendVariety b
data IncrementalVerifier = IncrementalVerifier
{ updateIncremental :: ByteString -> IO ()
-- ^ Called repeatedly on each peice of the content.
, finalizeIncremental :: IO Bool
-- ^ Called once the full content has been sent, returns true
-- if the hash verified.
, failIncremental :: IO ()
-- ^ Call if the incremental verification needs to fail.
, positionIncremental :: IO (Maybe Integer)
-- ^ Returns the number of bytes that have been fed to this
-- incremental verifier so far. (Nothing if failIncremental was
-- called.)
, descVerify :: String
-- ^ A description of what is done to verify the content.
}