From 499c90e63af74499ca895e26e697cdf81b433011 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Mon, 21 Sep 2020 02:23:06 +0200 Subject: [PATCH] stylish run --- src/Hash2Pub/FediChord.hs | 6 +++--- src/Hash2Pub/FediChordTypes.hs | 21 +++++++++------------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/Hash2Pub/FediChord.hs b/src/Hash2Pub/FediChord.hs index 0624abd..9baf160 100644 --- a/src/Hash2Pub/FediChord.hs +++ b/src/Hash2Pub/FediChord.hs @@ -69,12 +69,12 @@ import qualified Data.ByteString.UTF8 as BSU import Data.Either (rights) import Data.Foldable (foldr') import Data.Functor.Identity +import Data.HashMap.Strict (HashMap) +import qualified Data.HashMap.Strict as HMap import Data.IP (IPv6, fromHostAddress6, toHostAddress6) import Data.List ((\\)) import qualified Data.Map.Strict as Map -import qualified Data.HashMap.Strict as HMap -import Data.HashMap.Strict (HashMap) import Data.Maybe (catMaybes, fromJust, fromMaybe, isJust, isNothing, mapMaybe) import qualified Data.Set as Set @@ -375,7 +375,7 @@ nodeCacheVerifyThread nodeSTM = forever $ do node <- readTVar nodeSTM case headMay (HMap.elems $ vservers node) of -- wait until first VS is joined - Nothing -> retry + Nothing -> retry Just vs' -> pure (node, vs') let maxEntryAge = confMaxNodeCacheAge $ nodeConfig node diff --git a/src/Hash2Pub/FediChordTypes.hs b/src/Hash2Pub/FediChordTypes.hs index a1c0937..04396d6 100644 --- a/src/Hash2Pub/FediChordTypes.hs +++ b/src/Hash2Pub/FediChordTypes.hs @@ -69,10 +69,10 @@ import Control.Exception import Data.Foldable (foldr') import Data.Function (on) import qualified Data.Hashable as Hashable -import Data.List (delete, nub, sortBy) -import qualified Data.Map.Strict as Map import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as HMap +import Data.List (delete, nub, sortBy) +import qualified Data.Map.Strict as Map import Data.Maybe (fromJust, fromMaybe, isJust, isNothing, mapMaybe) import qualified Data.Set as Set @@ -153,22 +153,19 @@ a `localCompare` b -- Also contains shared data and config values. -- TODO: more data structures for k-choices bookkeeping data RealNode s = RealNode - { vservers :: HashMap NodeID (LocalNodeStateSTM s) + { vservers :: HashMap NodeID (LocalNodeStateSTM s) -- ^ map of all active VServer node IDs to their node state - , nodeConfig :: FediChordConf + , nodeConfig :: FediChordConf -- ^ holds the initial configuration read at program start - , bootstrapNodes :: [(String, PortNumber)] + , bootstrapNodes :: [(String, PortNumber)] -- ^ nodes to be used as bootstrapping points, new ones learned during operation - , lookupCacheSTM :: TVar LookupCache + , lookupCacheSTM :: TVar LookupCache -- ^ a global cache of looked up keys and their associated nodes - , globalNodeCacheSTM :: TVar NodeCache + , globalNodeCacheSTM :: TVar NodeCache -- ^ EpiChord node cache with expiry times for nodes. - -- Shared between all vservers, each 'LocalNodeState' holds a reference to - -- the same TVar for avoiding unnecessary reads of parent node - , globalCacheWriteQueue :: TQueue (NodeCache -> NodeCache) + , globalCacheWriteQueue :: TQueue (NodeCache -> NodeCache) -- ^ cache updates are not written directly to the 'globalNodeCacheSTM' - -- but queued and processed by a single thread - , nodeService :: s (RealNodeSTM s) + , nodeService :: s (RealNodeSTM s) } type RealNodeSTM s = TVar (RealNode s)