summaryrefslogtreecommitdiff
path: root/src/Data/Torrent/Piece.hs
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-10-31 18:45:04 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-10-31 18:45:04 +0400
commit8482a1871edcf64984cfe65684f1fa771d88bfdc (patch)
treeb2fab6ff58e08922ca31219b6e86a89353370480 /src/Data/Torrent/Piece.hs
parent5afe5c6d51d706885d405a544627e8f6fcb462d9 (diff)
move defaultBlockSize to Block module
Diffstat (limited to 'src/Data/Torrent/Piece.hs')
-rw-r--r--src/Data/Torrent/Piece.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Data/Torrent/Piece.hs b/src/Data/Torrent/Piece.hs
index bff6f948..341c3d6b 100644
--- a/src/Data/Torrent/Piece.hs
+++ b/src/Data/Torrent/Piece.hs
@@ -5,6 +5,8 @@
5-- Stability : experimental 5-- Stability : experimental
6-- Portability : portable 6-- Portability : portable
7-- 7--
8-- Torrent content validation.
9--
8{-# LANGUAGE TemplateHaskell #-} 10{-# LANGUAGE TemplateHaskell #-}
9{-# LANGUAGE DeriveDataTypeable #-} 11{-# LANGUAGE DeriveDataTypeable #-}
10{-# LANGUAGE GeneralizedNewtypeDeriving #-} 12{-# LANGUAGE GeneralizedNewtypeDeriving #-}
@@ -12,9 +14,8 @@ module Data.Torrent.Piece
12 ( -- * Piece attributes 14 ( -- * Piece attributes
13 -- ** Piece size 15 -- ** Piece size
14 PieceSize (..) 16 PieceSize (..)
15 , defaultBlockSize -- TODO use data-default
16 , optimalPieceCount 17 , optimalPieceCount
17 , defaultPieceSize -- TODO use data-default 18 , defaultPieceSize
18 19
19 -- ** Piece index 20 -- ** Piece index
20 , PieceIx 21 , PieceIx
@@ -57,6 +58,8 @@ import Data.Text.Encoding as T
57import Data.Typeable 58import Data.Typeable
58import Text.PrettyPrint 59import Text.PrettyPrint
59 60
61import Data.Torrent.Block
62
60 63
61class Lint a where 64class Lint a where
62 lint :: a -> Either String a 65 lint :: a -> Either String a
@@ -74,10 +77,6 @@ newtype PieceSize = PieceSize Int
74 , BEncode, ToJSON, FromJSON 77 , BEncode, ToJSON, FromJSON
75 ) 78 )
76 79
77-- | Widely used semi-official block size.
78defaultBlockSize :: Int
79defaultBlockSize = 16 * 1024
80
81maxPieceSize :: Int 80maxPieceSize :: Int
82maxPieceSize = 4 * 1024 * 1024 81maxPieceSize = 4 * 1024 * 1024
83{-# INLINE maxPieceSize #-} 82{-# INLINE maxPieceSize #-}