diff options
Diffstat (limited to 'src/System/Torrent')
-rw-r--r-- | src/System/Torrent/Storage.hs | 5 |
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'. | ||
108 | hintRead :: PieceIx -> Storage -> IO () | ||
109 | hintRead _pix Storage {..} = return () | ||
110 | |||
106 | unsafeReadPiece :: PieceIx -> Storage -> IO (Piece BL.ByteString) | 111 | unsafeReadPiece :: PieceIx -> Storage -> IO (Piece BL.ByteString) |
107 | unsafeReadPiece pix s @ Storage {..} | 112 | unsafeReadPiece pix s @ Storage {..} |
108 | | not (isValidIx pix s) = throwIO (InvalidIndex pix) | 113 | | not (isValidIx pix s) = throwIO (InvalidIndex pix) |