Skip to main content

Oversim - Key Overlay Functions

Constructor
Can be use to set message to NULL.Better not to skip defining the constructor.

Destructor
Clear/delete messages in destructor using cancelAndDelete(). New version seems to be motivating to use a destructor so better not to skip.

void initializeOverlay(int stage)
Can be used to initialize the overlay node, read parameter values, set key, set statistic collectors, start timers, etc.
  • stage -  can be either MIN_STAGE_APP (this module is being created) or MAX_STAGE_APP (all modules were created). We typically need MIN_STAGE_APP to initialize application functions & variables.
void finishOverlay()
Called when module is terminating. Can be used to summarize stat. New OverSim version seems to be motivating us to delete messages in the destructor.

void joinOverlay()
Define what to do when a node is added to system. Can be used to establish connections with successor/predecessor & identify fingers in Chord. Also indicate to the simulator that overlay is now ready. 

NodeVector* findNode(const OverlayKey& key, int numRedundantNodes, int numSiblings)
Is called by message forwarding function to determine potential next hops, e.g., finger node selection in Chord can go here. If asking node is a sibling (i.e., root) for the key, it will reply with list of siblings order according their closeness to the key.
  • key - key to be located
  • numRedundantNodes -  Maximum number of next hop nodes to return
  • numSibling - number of siblings (potential nodes that could store the key) to return
bool isSiblingFor(const NodeHandle& node, const OverlayKey& key, int numSiblings, bool* err)
Am I the root, i.e.., node responsible for storing the given key?
  • node - Nodehandler of the node method is suppose to be called
  • key - key to be located
  • numSibling - number of siblings (potential nodes that could store key) being requested
  • err - return false if the range could not be determined
int getMaxNumSiblings()
Get the maximum number of siblings (nodes close to a key) that are maintained by this overlay. Used by isSiblingFor()

      Comments

      Popular posts from this blog

      1. Building P2P Simulators with OverSim - Where to Begin

      This could be a series of blog posts about extending or developing your own OverSim applications & overlay networks. OverSim has a minimal tutorial on writing your own application & overlay network; however, it doesn't show the big picture. So, I'm wasting lots of time playing with code & trying to understand the rest. Good thing is, I like it more & more as I understand. You need to change/develop only a few things, but finding out which ones is a hell of a task. I hope this will not only make my life easy but also will be useful to new comers. Here's what you need to do: You need some background on OMNeT++ OverSim extend OMNeT++. But sometime it has its own way of doing things (to make your task even simple) so understand the differences . Develop several OMNeT++ simulators. TicToc is a good one to start with. Extend it as you imagine. Read Towards a Common API for Structured Peer-to-Peer Overlays , which is the basis for OvseSim's AP...

      Distributed Systems Mind Map

      Though distributed systems are inherently distributed, autonomous, and parallel, all textbooks that I have read so far are boring & serial, going from one topic to another as they are independent topics. Wondering about how best to present all related topics and their relationships in my class, I came up with the following mind map. I was able to explain most of the key concepts using a single example of a web-based business that started selling flowers. It was a student who suggested that we consider selling flowers. It turned out to be a good example, as there had to be a connection to the physical world where the business also needed a geographical distributed delivery system. Taught of sharing the mind map. Though most of those branches can be broken down further this level of detailed was sufficient for my class (by the way it took 1 hour to finish the discussion on this slide). Distributed Systems Mind Map

      Small Basic for biginners

      Microsoft recently introduced Small Basic, a programming language for beginners. It's a strip down version of BASIC with only 15 key words. It seems to be a fun programming environment & definitely worth while trying. You can write both console & graphical interface enabled programs & even develop your own version of Logo. Some of the features include: Its free 15 key words that support basic programming concepts including conditions & iterations Intellisense & context sensitive help Define variables on the fly, no need to explicitly define them Graphic programming Subroutines Third-party libraries can be plugged, API is given It even comes with a simple but comprehensive user guide that introduce basic programming concepts & Small Basic. Though it's intended for beginners, even advanced develops can use it to write scripts that perform simple day to day tasks.