summaryrefslogtreecommitdiff
path: root/src/Data
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
parent5afe5c6d51d706885d405a544627e8f6fcb462d9 (diff)
move defaultBlockSize to Block module
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Torrent/Block.hs6
-rw-r--r--src/Data/Torrent/Piece.hs11
2 files changed, 11 insertions, 6 deletions
diff --git a/src/Data/Torrent/Block.hs b/src/Data/Torrent/Block.hs
index 8aba4a6e..fa6fe8bd 100644
--- a/src/Data/Torrent/Block.hs
+++ b/src/Data/Torrent/Block.hs
@@ -3,6 +3,7 @@ module Data.Torrent.Block
3 ( -- * Block attribytes 3 ( -- * Block attribytes
4 BlockLIx 4 BlockLIx
5 , PieceLIx 5 , PieceLIx
6 , defaultBlockSize -- TODO use data-default
6 7
7 -- * Block index 8 -- * Block index
8 , BlockIx(..) 9 , BlockIx(..)
@@ -33,6 +34,11 @@ import Data.Serialize as S
33 34
34import Text.PrettyPrint 35import Text.PrettyPrint
35 36
37
38-- | Widely used semi-official block size.
39defaultBlockSize :: Int
40defaultBlockSize = 16 * 1024
41
36{----------------------------------------------------------------------- 42{-----------------------------------------------------------------------
37 Block Index 43 Block Index
38-----------------------------------------------------------------------} 44-----------------------------------------------------------------------}
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 #-}