stylish run

This commit is contained in:
Trolli Schmittlauch 2020-09-21 02:23:06 +02:00
parent 1a7afed062
commit 499c90e63a
2 changed files with 12 additions and 15 deletions

View file

@ -69,12 +69,12 @@ import qualified Data.ByteString.UTF8 as BSU
import Data.Either (rights) import Data.Either (rights)
import Data.Foldable (foldr') import Data.Foldable (foldr')
import Data.Functor.Identity import Data.Functor.Identity
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as HMap
import Data.IP (IPv6, fromHostAddress6, import Data.IP (IPv6, fromHostAddress6,
toHostAddress6) toHostAddress6)
import Data.List ((\\)) import Data.List ((\\))
import qualified Data.Map.Strict as Map 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, import Data.Maybe (catMaybes, fromJust, fromMaybe,
isJust, isNothing, mapMaybe) isJust, isNothing, mapMaybe)
import qualified Data.Set as Set import qualified Data.Set as Set
@ -375,7 +375,7 @@ nodeCacheVerifyThread nodeSTM = forever $ do
node <- readTVar nodeSTM node <- readTVar nodeSTM
case headMay (HMap.elems $ vservers node) of case headMay (HMap.elems $ vservers node) of
-- wait until first VS is joined -- wait until first VS is joined
Nothing -> retry Nothing -> retry
Just vs' -> pure (node, vs') Just vs' -> pure (node, vs')
let let
maxEntryAge = confMaxNodeCacheAge $ nodeConfig node maxEntryAge = confMaxNodeCacheAge $ nodeConfig node

View file

@ -69,10 +69,10 @@ import Control.Exception
import Data.Foldable (foldr') import Data.Foldable (foldr')
import Data.Function (on) import Data.Function (on)
import qualified Data.Hashable as Hashable 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 Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as HMap 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, import Data.Maybe (fromJust, fromMaybe, isJust,
isNothing, mapMaybe) isNothing, mapMaybe)
import qualified Data.Set as Set import qualified Data.Set as Set
@ -153,22 +153,19 @@ a `localCompare` b
-- Also contains shared data and config values. -- Also contains shared data and config values.
-- TODO: more data structures for k-choices bookkeeping -- TODO: more data structures for k-choices bookkeeping
data RealNode s = RealNode 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 -- ^ map of all active VServer node IDs to their node state
, nodeConfig :: FediChordConf , nodeConfig :: FediChordConf
-- ^ holds the initial configuration read at program start -- ^ 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 -- ^ 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 -- ^ 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. -- ^ EpiChord node cache with expiry times for nodes.
-- Shared between all vservers, each 'LocalNodeState' holds a reference to , globalCacheWriteQueue :: TQueue (NodeCache -> NodeCache)
-- the same TVar for avoiding unnecessary reads of parent node
, globalCacheWriteQueue :: TQueue (NodeCache -> NodeCache)
-- ^ cache updates are not written directly to the 'globalNodeCacheSTM' -- ^ 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) type RealNodeSTM s = TVar (RealNode s)