summaryrefslogtreecommitdiff
path: root/src/System/Torrent/Storage.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/System/Torrent/Storage.hs')
-rw-r--r--src/System/Torrent/Storage.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/System/Torrent/Storage.hs b/src/System/Torrent/Storage.hs
index 8ad4d3e5..214998a9 100644
--- a/src/System/Torrent/Storage.hs
+++ b/src/System/Torrent/Storage.hs
@@ -34,6 +34,7 @@ module System.Torrent.Storage
34 -- * Modification 34 -- * Modification
35 , writePiece 35 , writePiece
36 , readPiece 36 , readPiece
37 , hintRead
37 , unsafeReadPiece 38 , unsafeReadPiece
38 ) where 39 ) where
39 40
@@ -103,6 +104,10 @@ readPiece pix s @ Storage {..}
103 offset = fromIntegral pix * fromIntegral pieceLen 104 offset = fromIntegral pix * fromIntegral pieceLen
104 sz = fromIntegral pieceLen 105 sz = fromIntegral pieceLen
105 106
107-- | Hint about the coming 'readPiece'.
108hintRead :: PieceIx -> Storage -> IO ()
109hintRead _pix Storage {..} = return ()
110
106unsafeReadPiece :: PieceIx -> Storage -> IO (Piece BL.ByteString) 111unsafeReadPiece :: PieceIx -> Storage -> IO (Piece BL.ByteString)
107unsafeReadPiece pix s @ Storage {..} 112unsafeReadPiece pix s @ Storage {..}
108 | not (isValidIx pix s) = throwIO (InvalidIndex pix) 113 | not (isValidIx pix s) = throwIO (InvalidIndex pix)