Skip to content
Snippets Groups Projects
Commit 098bd50c authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Remove some parameters unnecessary because of the relevant scopes

parent d9b828e0
No related branches found
No related tags found
1 merge request!40Make the write enabler tests pass
......@@ -180,7 +180,7 @@ instance Backend FilesystemBackend where
(ReadTestWriteVectors testWritev _readv) = do
-- TODO implement readv and testv parts.
-- TODO implement secrets
mapM_ (applyWriteVectors root storageIndex) $ toList testWritev
mapM_ applyWriteVectors $ toList testWritev
return
ReadTestWriteResult
{ success = True
......@@ -188,32 +188,28 @@ instance Backend FilesystemBackend where
}
where
applyWriteVectors ::
FilePath ->
StorageIndex ->
(ShareNumber, TestWriteVectors) ->
IO ()
applyWriteVectors _root _storageIndex (shareNumber', testWriteVectors) =
mapM_ (applyShareWrite root storageIndex shareNumber') (write testWriteVectors)
applyWriteVectors (shareNumber', testWriteVectors) =
mapM_ (applyShareWrite shareNumber') (write testWriteVectors)
applyShareWrite ::
FilePath ->
StorageIndex ->
ShareNumber ->
WriteVector ->
IO ()
applyShareWrite _root _storageIndex shareNumber' (WriteVector offset shareData) =
let sharePath = pathOfShare root storageIndex shareNumber'
createParents = True
in do
applyShareWrite shareNumber' (WriteVector offset shareData) = do
createDirectoryIfMissing createParents $ takeDirectory sharePath
withBinaryFile sharePath ReadWriteMode (writeAtPosition offset shareData)
where
sharePath = pathOfShare root storageIndex shareNumber'
createParents = True
writeAtPosition ::
Offset ->
ShareData ->
Handle ->
IO ()
writeAtPosition _offset shareData' handle = do
writeAtPosition offset shareData' handle = do
hSeek handle AbsoluteSeek offset
hPut handle shareData'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment