exercise1

package
v0.0.0-...-9328dc6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2015 License: ISC Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
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

func ReceiveAndParseIncomingProtobufMessageToChannel(conn net.Conn, c chan *protobuf.Nachricht)

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

func ReceiveAndParseIncomingProtoufMessage(conn net.Conn) *protobuf.Nachricht

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL