diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-02 00:55:02 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-02 00:55:02 +0400 |
commit | 9a73e365f4c29080ab6ce04290b36e3189171289 (patch) | |
tree | f2657c41fbcc113b8e006a0b3a4f6891cea0c20e /src | |
parent | 10fcabb96e9f5b2d25cdfae22973cbcb99282139 (diff) |
A little bit more informative ty syn name
Diffstat (limited to 'src')
-rw-r--r-- | src/Data/Torrent/Layout.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Data/Torrent/Layout.hs b/src/Data/Torrent/Layout.hs index 8f35772d..54ec0f23 100644 --- a/src/Data/Torrent/Layout.hs +++ b/src/Data/Torrent/Layout.hs | |||
@@ -50,7 +50,7 @@ module Data.Torrent.Layout | |||
50 | , blockCount | 50 | , blockCount |
51 | 51 | ||
52 | -- * Flat file layout | 52 | -- * Flat file layout |
53 | , Layout | 53 | , FileLayout |
54 | , flatLayout | 54 | , flatLayout |
55 | , accumOffsets | 55 | , accumOffsets |
56 | , fileOffset | 56 | , fileOffset |
@@ -286,13 +286,13 @@ blockCount blkSize ci = contentLength ci `sizeInBase` blkSize | |||
286 | -- coalesce all the files in the given order to get the linear block | 286 | -- coalesce all the files in the given order to get the linear block |
287 | -- address space. | 287 | -- address space. |
288 | -- | 288 | -- |
289 | type Layout a = [(FilePath, a)] | 289 | type FileLayout a = [(FilePath, a)] |
290 | 290 | ||
291 | -- | Extract files layout from torrent info with the given root path. | 291 | -- | Extract files layout from torrent info with the given root path. |
292 | flatLayout | 292 | flatLayout |
293 | :: FilePath -- ^ Root path for the all torrent files. | 293 | :: FilePath -- ^ Root path for the all torrent files. |
294 | -> LayoutInfo -- ^ Torrent content information. | 294 | -> LayoutInfo -- ^ Torrent content information. |
295 | -> Layout FileSize -- ^ The all file paths prefixed with the given root. | 295 | -> FileLayout FileSize -- ^ The all file paths prefixed with the given root. |
296 | flatLayout prefixPath SingleFile { liFile = FileInfo {..} } | 296 | flatLayout prefixPath SingleFile { liFile = FileInfo {..} } |
297 | = [(prefixPath </> BC.unpack fiName, fiLength)] | 297 | = [(prefixPath </> BC.unpack fiName, fiLength)] |
298 | flatLayout prefixPath MultiFile {..} = L.map mkPath liFiles | 298 | flatLayout prefixPath MultiFile {..} = L.map mkPath liFiles |
@@ -303,14 +303,14 @@ flatLayout prefixPath MultiFile {..} = L.map mkPath liFiles | |||
303 | </> joinPath (L.map BC.unpack fiName) | 303 | </> joinPath (L.map BC.unpack fiName) |
304 | 304 | ||
305 | -- | Calculate offset of each file based on its length, incrementally. | 305 | -- | Calculate offset of each file based on its length, incrementally. |
306 | accumOffsets :: Layout FileSize -> Layout FileOffset | 306 | accumOffsets :: FileLayout FileSize -> FileLayout FileOffset |
307 | accumOffsets = go 0 | 307 | accumOffsets = go 0 |
308 | where | 308 | where |
309 | go !_ [] = [] | 309 | go !_ [] = [] |
310 | go !offset ((n, s) : xs) = (n, offset) : go (offset + s) xs | 310 | go !offset ((n, s) : xs) = (n, offset) : go (offset + s) xs |
311 | 311 | ||
312 | -- | Gives global offset of a content file for a given full path. | 312 | -- | Gives global offset of a content file for a given full path. |
313 | fileOffset :: FilePath -> Layout FileOffset -> Maybe FileOffset | 313 | fileOffset :: FilePath -> FileLayout FileOffset -> Maybe FileOffset |
314 | fileOffset = lookup | 314 | fileOffset = lookup |
315 | {-# INLINE fileOffset #-} | 315 | {-# INLINE fileOffset #-} |
316 | 316 | ||