summaryrefslogtreecommitdiff
path: root/src/Data/Kademlia/Routing/Table.hs
blob: b79a0a3199c0330dec5170937b5b2ccb96be7920 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- |
--   Copyright   :  (c) Sam T. 2013
--   License     :  MIT
--   Maintainer  :  pxqr.sta@gmail.com
--   Stability   :  experimental
--   Portability :  portable
--
--   Routing table used to lookup . Internally it uses not balanced tree
--
-- TODO write module synopsis
module Data.Kademlia.Routing.Table
       ( Table(nodeID)
       ) where

import Control.Applicative
import Data.List as L
import Data.Maybe

import Data.Kademlia.Routing.Tree


data Table k v = Table {
    routeTree     :: Tree k v

    -- | Set degree of parallelism in node lookup calls.
  , alpha         :: Int
  , nodeID        :: k
  }

--insert :: NodeID -> Table -> Table
--insert x t = undefined

--closest :: InfoHash -> Table -> [NodeID]
--closest = undefined


-- TODO table serialization: usually we need to save table between
-- target program executions for bootstrapping