specify protocol operations and affected data

This commit is contained in:
Trolli Schmittlauch 2020-04-07 13:22:30 +02:00
parent 357152da46
commit 3faa4a8d61
2 changed files with 5 additions and 4 deletions

Binary file not shown.

View file

@ -99,7 +99,7 @@ data NodeState = NodeState {
, nodeCache :: NodeCache
-- ^ EpiChord node cache with expiry times for nodes
-- as the map is ordered, lookups for the closes preceding node can be done using @lookupLT@
, successors :: [NodeID]
, successors :: [NodeID] -- could be a set instead as these are ordered as well
, predecessors :: [NodeID]
----- protocol parameters -----
-- TODO: evaluate moving these somewhere else
@ -121,9 +121,10 @@ type NodeCache = Map.Map NodeID CacheEntry
-- |an entry of the 'nodeCache'
type CacheEntry = (
NodeState
Bool
, NodeState
, SystemTime
) -- ^ ( a node's data, timestamp for cache entry expiration )
) -- ^ ( a node's validation status, data, timestamp for cache entry expiration )
-- | generates a 256 bit long NodeID using SHAKE128, represented as ByteString
genNodeIDBS :: HostAddress6 -- ^a node's IPv6 address
@ -202,7 +203,7 @@ checkCacheSlices state =
diff = getNodeID $ upperBound - ownID
lowerBound = ownID + NodeID (diff `div` 2)
in
-- TODO: replace empty IO actions with actual lookups
-- TODO: replace empty IO actions with actual lookups to middle of slice
-- TODO: validate ID before adding to cache
case Map.lookupLT upperBound cache of
Nothing -> return () : checkSlice j ownID lowerBound (Just lastSuccNode) cache