diff options
Diffstat (limited to 'src/Data/Kademlia/Routing/Table.hs')
-rw-r--r-- | src/Data/Kademlia/Routing/Table.hs | 50 |
1 files changed, 50 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..056692f3 --- /dev/null +++ b/src/Data/Kademlia/Routing/Table.hs | |||
@@ -0,0 +1,50 @@ | |||
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 | ( -- ContactInfo | ||
13 | -- , Table | ||
14 | ) where | ||
15 | |||
16 | import Control.Applicative | ||
17 | import Data.ByteString | ||
18 | import Data.List as L | ||
19 | import Data.Maybe | ||
20 | |||
21 | import Network.BitTorrent.Peer | ||
22 | |||
23 | {- | ||
24 | type NodeID = ByteString | ||
25 | type InfoHash = ByteString | ||
26 | |||
27 | data ContactInfo = ContactInfo { | ||
28 | peerAddr :: PeerAddr | ||
29 | , nodeID :: NodeID | ||
30 | } deriving (Show, Eq) | ||
31 | |||
32 | |||
33 | type Distance = NodeID | ||
34 | |||
35 | -- | | ||
36 | data Table = Table { | ||
37 | routeTree :: Tree | ||
38 | , maxBucketSize :: Int | ||
39 | } | ||
40 | |||
41 | insert :: NodeID -> Table -> Table | ||
42 | insert x t = undefined | ||
43 | |||
44 | closest :: InfoHash -> Table -> [NodeID] | ||
45 | closest = undefined | ||
46 | |||
47 | |||
48 | -- TODO table serialization: usually we need to save table between | ||
49 | -- target program executions for bootstrapping | ||
50 | -} \ No newline at end of file | ||