pongsim_churn
index
u:\f\project - pongsim\pongsim850\pongsim_churn.py

PONGsim (Python Overlay Network Graphical Simulator)
Resource module of the PONGsim framework
 
Version: 1.50
 
Nicklas Beijar, nbeijar@netlab.tkk.fi
Networking Laboratory, Helsinki University of Technology
 
######################################################################
 
PONGsim (Python Overlay Network Graphical Simulator)
 
Copyright (c) 2005-2009 Nicklas Beijar
 
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
 
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
 
######################################################################
 
To do:
- Everything

 
Modules
       
random

 
Classes
       
Churn

 
class Churn
     Methods defined here:
activate_time_counter(self)
Start collecting online and offline times.
deactivate_time_counter(self)
Stop collecting online and offline times.
init(self, log, joininterval, onlinetime, timecounteractive, valuecounter, enable, world)
Initialize the Resources module.
 
Arguments:
log - A Log for storing and displaying warning messages. 
joininterval - Average time for the node to be offline.  
onlinetime - Average time for the node to be online. 
timecounteractive - Whether to enable counting the online and offline times. 
valuecounter - A StatisticsCounter that counts the online and offline times. 
enable - Whether to enable the churn module. 
world - A World to which the node belongs to when it is online.
joined(self)
Callback triggered when a node has joined. This is the place to implement joining the overlay.
perform_join(self)
Internal function for joining a node.
perform_remove(self)
Internal function for removing a node.
prepare_join(self)
Callback triggered when a node will join. This is the place to create the node's state information.
prepare_remove(self)
Callback triggered when a node will be removed. This is the place to implement graceful departure.
removed(self)
Callback triggered when a node has been removed. This is the place to remove the node's state information.