summaryrefslogtreecommitdiff
path: root/Kademlia.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-07-16 23:31:31 -0400
committerjoe <joe@jerkface.net>2017-07-16 23:31:31 -0400
commit41c4f64231037f70d7cd6a0c2611b2c6a1d517d9 (patch)
tree67381445132ce31360ad0aa5586385ada2cb2fb4 /Kademlia.hs
parent74e89f729750b96b5227e4678f0922b630d71c99 (diff)
Refactored, renamed, Table -> BucketList.
Diffstat (limited to 'Kademlia.hs')
-rw-r--r--Kademlia.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Kademlia.hs b/Kademlia.hs
index 63c2b494..4a811fa2 100644
--- a/Kademlia.hs
+++ b/Kademlia.hs
@@ -114,10 +114,10 @@ contramapIR f ir = InsertionReporter
114-- | All the IO operations neccessary to maintain a Kademlia routing table. 114-- | All the IO operations neccessary to maintain a Kademlia routing table.
115data TableStateIO nid ni = TableStateIO 115data TableStateIO nid ni = TableStateIO
116 { -- | Write the routing table. Typically 'writeTVar'. 116 { -- | Write the routing table. Typically 'writeTVar'.
117 tblWrite :: R.Table ni -> STM () 117 tblWrite :: R.BucketList ni -> STM ()
118 118
119 -- | Read the routing table. Typically 'readTVar'. 119 -- | Read the routing table. Typically 'readTVar'.
120 , tblRead :: STM (R.Table ni) 120 , tblRead :: STM (R.BucketList ni)
121 121
122 -- | Issue a ping to a remote node and report 'True' if the node 122 -- | Issue a ping to a remote node and report 'True' if the node
123 -- responded within an acceptable time and 'False' otherwise. 123 -- responded within an acceptable time and 'False' otherwise.
@@ -136,7 +136,7 @@ data TableStateIO nid ni = TableStateIO
136 , tblChanged :: RoutingTableChanged ni -> STM (IO ()) 136 , tblChanged :: RoutingTableChanged ni -> STM (IO ())
137 } 137 }
138 138
139vanillaIO :: TVar (Table ni) -> (ni -> IO Bool) -> TableStateIO nid ni 139vanillaIO :: TVar (BucketList ni) -> (ni -> IO Bool) -> TableStateIO nid ni
140vanillaIO var ping = TableStateIO 140vanillaIO var ping = TableStateIO
141 { tblRead = readTVar var 141 { tblRead = readTVar var
142 , tblWrite = writeTVar var 142 , tblWrite = writeTVar var
@@ -152,7 +152,7 @@ data Kademlia nid ni = Kademlia (InsertionReporter ni)
152 152
153{- 153{-
154kademlia :: FiniteBits nid => 154kademlia :: FiniteBits nid =>
155 TVar (Table nid nid) -> (nid -> IO Bool) -> Kademlia nid nid 155 TVar (BucketList nid nid) -> (nid -> IO Bool) -> Kademlia nid nid
156kademlia var ping = Kademlia quietInsertions 156kademlia var ping = Kademlia quietInsertions
157 (KademliaSpace id testIdBit) 157 (KademliaSpace id testIdBit)
158 (vanillaIO var ping) 158 (vanillaIO var ping)