summaryrefslogtreecommitdiff
path: root/src/Data/Kademlia
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-05-16 19:35:46 +0400
committerSam T <pxqr.sta@gmail.com>2013-05-16 19:35:46 +0400
commit448b86fca5cac5abfef66598391614a8a4f83a46 (patch)
treef17e9d2adc7e23b83e4f198a38a94945188e7477 /src/Data/Kademlia
parentafef54f0fa5c7fee567d960d4183caa5817f46e5 (diff)
~ Some initial DHT skeleton.
Diffstat (limited to 'src/Data/Kademlia')
-rw-r--r--src/Data/Kademlia/RoutingTable.hs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Data/Kademlia/RoutingTable.hs b/src/Data/Kademlia/RoutingTable.hs
new file mode 100644
index 00000000..98e15a0b
--- /dev/null
+++ b/src/Data/Kademlia/RoutingTable.hs
@@ -0,0 +1,28 @@
1module Data.Kademlia.RoutingTable
2 (
3 ) where
4
5import Data.ByteString
6
7type NodeID = ByteString
8type InfoHash = ByteString
9
10type Bucket = [NodeID]
11
12data Tree
13 = Tip Bucket
14 | Bin Table Table
15
16data Table = Table {
17 tree :: Tree
18 , bucketSize :: Int
19 }
20
21closest :: InfoHash -> Table -> [NodeID]
22closest = undefined
23
24insert :: NodeID -> Table -> Table
25insert x t = undefined
26
27-- TODO table serialization: usually we need to save table between
28-- target program executions