diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-05-16 19:35:46 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-05-16 19:35:46 +0400 |
commit | 448b86fca5cac5abfef66598391614a8a4f83a46 (patch) | |
tree | f17e9d2adc7e23b83e4f198a38a94945188e7477 /src/Data/Kademlia | |
parent | afef54f0fa5c7fee567d960d4183caa5817f46e5 (diff) |
~ Some initial DHT skeleton.
Diffstat (limited to 'src/Data/Kademlia')
-rw-r--r-- | src/Data/Kademlia/RoutingTable.hs | 28 |
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 @@ | |||
1 | module Data.Kademlia.RoutingTable | ||
2 | ( | ||
3 | ) where | ||
4 | |||
5 | import Data.ByteString | ||
6 | |||
7 | type NodeID = ByteString | ||
8 | type InfoHash = ByteString | ||
9 | |||
10 | type Bucket = [NodeID] | ||
11 | |||
12 | data Tree | ||
13 | = Tip Bucket | ||
14 | | Bin Table Table | ||
15 | |||
16 | data Table = Table { | ||
17 | tree :: Tree | ||
18 | , bucketSize :: Int | ||
19 | } | ||
20 | |||
21 | closest :: InfoHash -> Table -> [NodeID] | ||
22 | closest = undefined | ||
23 | |||
24 | insert :: NodeID -> Table -> Table | ||
25 | insert x t = undefined | ||
26 | |||
27 | -- TODO table serialization: usually we need to save table between | ||
28 | -- target program executions | ||