diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-06-20 23:10:06 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-06-20 23:10:06 +0400 |
commit | 086e81d141c0e2435563b2b59e8065dcd27ce5a2 (patch) | |
tree | 24fb2d202e266332d4f1261f337544afce940290 /src/Data/Kademlia/Routing/Table.hs | |
parent | 20108497bab46bf0d92fdf55255a77c8706efae5 (diff) |
~ Merge kademlia package.
Diffstat (limited to 'src/Data/Kademlia/Routing/Table.hs')
-rw-r--r-- | src/Data/Kademlia/Routing/Table.hs | 38 |
1 files changed, 38 insertions, 0 deletions
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 @@ | |||
1 | -- | | ||
2 | -- Copyright : (c) Sam T. 2013 | ||
3 | -- License : MIT | ||
4 | -- Maintainer : pxqr.sta@gmail.com | ||
5 | -- Stability : experimental | ||
6 | -- Portability : portable | ||
7 | -- | ||
8 | -- Routing table used to lookup . Internally it uses not balanced tree | ||
9 | -- | ||
10 | -- TODO write module synopsis | ||
11 | module Data.Kademlia.Routing.Table | ||
12 | ( Table(nodeID) | ||
13 | ) where | ||
14 | |||
15 | import Control.Applicative | ||
16 | import Data.List as L | ||
17 | import Data.Maybe | ||
18 | |||
19 | import Data.Kademlia.Routing.Tree | ||
20 | |||
21 | |||
22 | data Table k v = Table { | ||
23 | routeTree :: Tree k v | ||
24 | |||
25 | -- | Set degree of parallelism in node lookup calls. | ||
26 | , alpha :: Int | ||
27 | , nodeID :: k | ||
28 | } | ||
29 | |||
30 | --insert :: NodeID -> Table -> Table | ||
31 | --insert x t = undefined | ||
32 | |||
33 | --closest :: InfoHash -> Table -> [NodeID] | ||
34 | --closest = undefined | ||
35 | |||
36 | |||
37 | -- TODO table serialization: usually we need to save table between | ||
38 | -- target program executions for bootstrapping | ||