Menu

Developer Guide

Alex Libov

Developer Guide

Basic classes

  • NodeSpecificImplementation - this class encapsulated the address and unique id of a single node in the system.
  • Message - all messages in the system inherit from this class. The class stores the source and destination NodeSpecificImplementations the payload and message tag. The tag is defined by the protocol sending the message so that the message would be received by the corresponding protocol at the target node. a NodeConnectionAlgorithm defines getMessageTag method to be used as tags for sending messages.
  • NetworkNode - an abstract class encapsulating all functionality related to the underlying system (network or simulation). NodeConnectionAlgorithm has an instance of a NetworkNode (called node) to handle all network activities. NetworkNode provides these functions:
    • NodeSpecificImplementation getImpl() - return the address of the associated node.
    • boolean isUp(NodeSpecificImplementation node) - an implementation of a failure detector.
    • boolean send(final Message msg) - sends a message (the target node is specified in the msg object)
    • long getUploadBandwidth() - returns the upload bandwidth of the associated node in bits per second
    • long getEstimatedLatency(NodeSpecificImplementation key) - a convenience method measuring latency between the associated node and other node.
  • P2PClient - the P2Pclient encapsulates all functionality related the the actual playback. It holds an instance of a VideoStream class. each cycle, the client attempts to play the next chunk from the VideoStream.
  • VideoStream - the VideoStream class collects all video chunks.

Modules

MOLStream currently supports three different types of modules:

  • Clustering Algorithm
  • Overlay Algorithm
  • Streaming Algorithm

Each module extends the abstract NodeConnectionAlgorithm class.
Each module has to implement these two methods:

public void handleMessage(Message message);

This method is invoked every time a message is received by the module. Messages can be sent to other nodes to be received by the same module.

public void nextCycle();

This method is called once every cycle. Cycle length is a parameter.

Module Types

Clustering Algorithm

A Clustering algorithm is a NodeConnectionAlgorithm and has to implement both the handleMessage and nextCycle methods. In addition, a Clustering algorithm has to implement the getClusterRepresentative method which returns the NodeSpecificImplementation of the cluster representative of the calling node.

Overlay Algorithm

The Overlay Algorithm maintains connections to other nodes to create an overlay.
The Overlay Algorithm exposes a getNeighbors method.
There are two types of components that inherit from Overlay Algorithm:

  • OverlayTreeAlgorithm - adds getParent and getChildren methods.
  • GroupedOverlayAlgorithm - splits neighbors into multiple groups that can be retrieved using the getGroup method.
Streaming Algorithm

The Streaming Algorithm implements the actual chunk dissemination protocol.
The Streaming Algorithm also initializes the VideoStream by calling P2PClient.initVS.


Related

Wiki: Home