ContentsIndex
Barracuda.RoutingTable
MaintainerStephan Friedrichs
Contents
Routing
Definition
Implementation
Configuration
Description
This module stores the entire routing logic of our implementation.
Synopsis
class RoutingStrategy rs where
routeSingle :: UserID -> rs -> Maybe SockAddr
routeMulti :: [UserID] -> rs -> (Map SockAddr [UserID], [UserID])
class (TimedCollection r, RoutingStrategy r, RoutingStrategy (r, Set SockAddr)) => RoutingTable r where
empty :: r
hello :: UTCTime -> SockAddr -> [UserID] -> r -> r
routing :: UTCTime -> SockAddr -> [(UserID, Int)] -> r -> r
delete :: SockAddr -> r -> r
userList :: r -> Set UserID
mergeRoutes :: Set UserID -> r -> Map UserID Int
mergeRoutesFor :: SockAddr -> Set UserID -> r -> Map UserID Int
neighbors :: r -> Set SockAddr
data SimpleRT
hopMax :: Num n => n
Routing
Definition
class RoutingStrategy rs where
This class abstracts routing strategies for data-structures like SimpleRT. Minimal definition: one of routeSingle or routeMulti.
Methods
routeSingle :: UserID -> rs -> Maybe SockAddr
Tries to find a route for a given user. The SockAddr is the starting point of the route.
routeMulti :: [UserID] -> rs -> (Map SockAddr [UserID], [UserID])
Find routes for many users. The first object in the tuple maps nodes to a list of users that should be reached over it. The second one is a list of users that couldn't be reached.
show/hide Instances
class (TimedCollection r, RoutingStrategy r, RoutingStrategy (r, Set SockAddr)) => RoutingTable r where
A routing table is an efficient data structure for the handling of routing information. It must maintain a list of hosts together with the information which users it knows and how many hops it takes to reach them.
Methods
empty :: r
Construct an empty routing table.
hello :: UTCTime -> SockAddr -> [UserID] -> r -> r
Updates the routing table with information about which users reside on a given host. Usually obtained through a HELLO protocol-message.
routing :: UTCTime -> SockAddr -> [(UserID, Int)] -> r -> r
Given a timestamp, a SockAddr and the routing table of a host, this function updates the available routing information. This information is usually provided by a ROUTING protocol-message, therefore each hop count is increased by 1.
delete :: SockAddr -> r -> r
Deletes a given host and all related routing information from the routing table. Usually this is triggered by that host leaving the transmission range.
userList :: r -> Set UserID
Gives a set of all users that are known through the information in the routing table.
mergeRoutes :: Set UserID -> r -> Map UserID Int
Merges all known routes to one map. The Set of UserID are the local users that are deleted from the data.
mergeRoutesFor :: SockAddr -> Set UserID -> r -> Map UserID Int
Put together routing informations that have to be send to a given host, wich includes deleting the routing information from that host. The Set of UserID are the local users that are removed from the returned Map. This function does not have to be implemented, there is a default implementation.
neighbors :: r -> Set SockAddr
Get a set of direct neighbors (nodes that are reachable without routing).
show/hide Instances
Implementation
data SimpleRT
The default implementation of RoutingTable.
show/hide Instances
Configuration
hopMax :: Num n => n
The upper hop-limit for routig entries. It is used to detect dead entries in routing messages.
Produced by Haddock version 0.8