From 8482a1871edcf64984cfe65684f1fa771d88bfdc Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Thu, 31 Oct 2013 18:45:04 +0400 Subject: move defaultBlockSize to Block module --- src/Data/Torrent/Block.hs | 6 ++++++ src/Data/Torrent/Piece.hs | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') 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 ( -- * Block attribytes BlockLIx , PieceLIx + , defaultBlockSize -- TODO use data-default -- * Block index , BlockIx(..) @@ -33,6 +34,11 @@ import Data.Serialize as S import Text.PrettyPrint + +-- | Widely used semi-official block size. +defaultBlockSize :: Int +defaultBlockSize = 16 * 1024 + {----------------------------------------------------------------------- Block Index -----------------------------------------------------------------------} 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 @@ -- Stability : experimental -- Portability : portable -- +-- Torrent content validation. +-- {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} @@ -12,9 +14,8 @@ module Data.Torrent.Piece ( -- * Piece attributes -- ** Piece size PieceSize (..) - , defaultBlockSize -- TODO use data-default , optimalPieceCount - , defaultPieceSize -- TODO use data-default + , defaultPieceSize -- ** Piece index , PieceIx @@ -57,6 +58,8 @@ import Data.Text.Encoding as T import Data.Typeable import Text.PrettyPrint +import Data.Torrent.Block + class Lint a where lint :: a -> Either String a @@ -74,10 +77,6 @@ newtype PieceSize = PieceSize Int , BEncode, ToJSON, FromJSON ) --- | Widely used semi-official block size. -defaultBlockSize :: Int -defaultBlockSize = 16 * 1024 - maxPieceSize :: Int maxPieceSize = 4 * 1024 * 1024 {-# INLINE maxPieceSize #-} -- cgit v1.2.3