import Control.Applicative ((<$>), liftA3)
import Data.Bits
import Data.Word (Word8)
+import Data.Map (Map(..))
import FuncTorrent.Metainfo (Info(..), Metainfo(..))
type ID = String
| Have
deriving (Show)
-data PieceData = PieceData { index :: Int -- ^ Piece number
- , peers :: [Peer] -- ^ list of peers who have this piece
+-- todo - map with index to a new data structure (peers who have that piece amd state)
+data PieceData = PieceData { peers :: [Peer] -- ^ list of peers who have this piece
, state :: PieceState } -- ^ state of the piece from download perspective.
+-- which piece is with which peers
+type PieceMap = Map Integer PieceData
+
-- | Peer is a PeerID, IP address, port tuple
data Peer = Peer ID IP Port
deriving (Show, Eq)