forked from schmittlauch/Hash2Pub
specify protocol operations and affected data
This commit is contained in:
parent
357152da46
commit
3faa4a8d61
Binary file not shown.
|
@ -99,7 +99,7 @@ data NodeState = NodeState {
|
||||||
, nodeCache :: NodeCache
|
, nodeCache :: NodeCache
|
||||||
-- ^ EpiChord node cache with expiry times for nodes
|
-- ^ EpiChord node cache with expiry times for nodes
|
||||||
-- as the map is ordered, lookups for the closes preceding node can be done using @lookupLT@
|
-- 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]
|
, predecessors :: [NodeID]
|
||||||
----- protocol parameters -----
|
----- protocol parameters -----
|
||||||
-- TODO: evaluate moving these somewhere else
|
-- TODO: evaluate moving these somewhere else
|
||||||
|
@ -121,9 +121,10 @@ type NodeCache = Map.Map NodeID CacheEntry
|
||||||
|
|
||||||
-- |an entry of the 'nodeCache'
|
-- |an entry of the 'nodeCache'
|
||||||
type CacheEntry = (
|
type CacheEntry = (
|
||||||
NodeState
|
Bool
|
||||||
|
, NodeState
|
||||||
, SystemTime
|
, 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
|
-- | generates a 256 bit long NodeID using SHAKE128, represented as ByteString
|
||||||
genNodeIDBS :: HostAddress6 -- ^a node's IPv6 address
|
genNodeIDBS :: HostAddress6 -- ^a node's IPv6 address
|
||||||
|
@ -202,7 +203,7 @@ checkCacheSlices state =
|
||||||
diff = getNodeID $ upperBound - ownID
|
diff = getNodeID $ upperBound - ownID
|
||||||
lowerBound = ownID + NodeID (diff `div` 2)
|
lowerBound = ownID + NodeID (diff `div` 2)
|
||||||
in
|
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
|
-- TODO: validate ID before adding to cache
|
||||||
case Map.lookupLT upperBound cache of
|
case Map.lookupLT upperBound cache of
|
||||||
Nothing -> return () : checkSlice j ownID lowerBound (Just lastSuccNode) cache
|
Nothing -> return () : checkSlice j ownID lowerBound (Just lastSuccNode) cache
|
||||||
|
|
Loading…
Reference in a new issue