From 086e81d141c0e2435563b2b59e8065dcd27ce5a2 Mon Sep 17 00:00:00 2001 From: Sam T Date: Thu, 20 Jun 2013 23:10:06 +0400 Subject: ~ Merge kademlia package. --- src/Data/Kademlia/Routing/Table.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/Data/Kademlia/Routing/Table.hs (limited to 'src/Data/Kademlia/Routing/Table.hs') diff --git a/src/Data/Kademlia/Routing/Table.hs b/src/Data/Kademlia/Routing/Table.hs new file mode 100644 index 00000000..b79a0a31 --- /dev/null +++ b/src/Data/Kademlia/Routing/Table.hs @@ -0,0 +1,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 -- cgit v1.2.3