refactor vservers map to RingMap to be able to index it

- in preparation for periodical rebalancing
- makes it possible to look up the next vserver for iterating through
  it, after refreshing the map in-between
- added some necessary RingMap functions
This commit is contained in:
Trolli Schmittlauch 2020-10-05 02:22:25 +02:00
parent bb0fb0919a
commit 5ed8a28fde
5 changed files with 43 additions and 17 deletions

View file

@ -19,6 +19,7 @@ import Hash2Pub.ASN1Coding
import Hash2Pub.DHTProtocol
import Hash2Pub.FediChord
import Hash2Pub.FediChordTypes
import Hash2Pub.RingMap
spec :: Spec
spec = do
@ -304,7 +305,7 @@ exampleNodeState = RemoteNodeState {
exampleLocalNode :: IO (LocalNodeState MockService)
exampleLocalNode = do
realNodeSTM <- newTVarIO $ RealNode {
vservers = HMap.empty
vservers = emptyRMap
, nodeConfig = exampleFediConf
, bootstrapNodes = confBootstrapNodes exampleFediConf
, nodeService = MockService