Documentation ¶
Index ¶
- Constants
- func ChooseThreeNeighbors(localNodeId int, allAvailableNodes map[int]server.NetworkServer) (neighbors map[int]server.NetworkServer)
- func ReceiveAndParseIncomingProtobufMessageToChannel(conn net.Conn, c chan *protobuf.Nachricht)
- func ReceiveAndParseIncomingProtoufMessage(conn net.Conn) *protobuf.Nachricht
- func SendProtobufApplicationMessage(sourceServer, destinationServer server.NetworkServer, destnationServerId int, ...) error
- func SendProtobufControlMessage(sourceServer, destinationServer server.NetworkServer, ...) error
- func StartController(localNode server.NetworkServer, allNodes map[int]server.NetworkServer, ...)
- func StartIndependentNode(localNodeId int, allAvailableNodes, neighborNodes map[int]server.NetworkServer, ...)
Constants ¶
const (
// The number of nodes from which the rumor must be heared before the node belives in it.
BELIVE_IN_RUMOR_THRESHOLD = 2
)
Variables ¶
This section is empty.
Functions ¶
func ChooseThreeNeighbors ¶
func ChooseThreeNeighbors(localNodeId int, allAvailableNodes map[int]server.NetworkServer) (neighbors map[int]server.NetworkServer)
The chooseThreeNeighbors function uses the allAvailableNodes map to return another map that contains 3 nodes at the most. It calls os.Exit(1) if only one node is available in the allAvailableNodes map.
func ReceiveAndParseIncomingProtobufMessageToChannel ¶
This function uses a established connection to parse the data there to the protobuf message. The result gets assigned to the channel instead of returning it.
func ReceiveAndParseIncomingProtoufMessage ¶
This function uses a established connection to parse the data there to the protobuf message and returns it.
func SendProtobufApplicationMessage ¶
func SendProtobufApplicationMessage(sourceServer, destinationServer server.NetworkServer, destnationServerId int, messageContent string) error
This function sends a application message (ANWENDUNGSNACHRICHT) to the neighbor with the given targetId. If the id does not exists, it just returns and does nothing.
func SendProtobufControlMessage ¶
func SendProtobufControlMessage(sourceServer, destinationServer server.NetworkServer, destnationServerId, controlType int, messageContent string) error
This function sends a control message (KONTROLLNACHRICHT) to the node with the given targetId. If the id does not exists, it just returns and does nothing.
func StartController ¶
func StartController(localNode server.NetworkServer, allNodes map[int]server.NetworkServer, messageContent string)
The controller is used to control the independent nodes. He can initialize or shutdown the nodes.
func StartIndependentNode ¶
func StartIndependentNode(localNodeId int, allAvailableNodes, neighborNodes map[int]server.NetworkServer, rumorExperimentMode, useTcp bool)
With this function an node that interacts independently gets started. He can be controlled with a controller.
Types ¶
This section is empty.