| |
- pongsim.Simulation
-
- SILSimulation
- pongsim_sil.SILApplication(pongsim.Application)
-
- SILApplication
class SILApplication(pongsim_sil.SILApplication) |
|
####################################################################
### S I L A p p l i c a t i o n
#################################################################### |
|
- Method resolution order:
- SILApplication
- pongsim_sil.SILApplication
- pongsim.Application
Methods defined here:
- addresource(self, dummy=None)
- Dynamically add a resource to the node.
Adds a random resource, id defined by the scenario-parameters dynamicresourcefrom and dynamicresourceto.
If dynamicresourceto is undefined, nrofresources is used as upper limit.
Sends an index update to inform other nodes about the new resource.
Schedules itself again after interval defined in the scenario-parameter indexaddinterval.
Schedules removal of the added resource after interval defined in the scenario-parameter indexremoveinterval
(or in indexaddinterval if indexremoveinterval is undefined).
- connectsearchlink(self, params)
- Send a connect request to another cluster for connecting a search link.
- generatehello(self)
- Send a hello message on all outgoing index links.
- generateindexupdate(self, dummy=None)
- Generate a periodical index update.
Schedules itself after time defined in scenario-parameter indexupdateinterval.
- generatesearch(self, dummy=None)
- Generate a search request, which is flooded on the search links.
Scheduled calling, with rescheduling.
- getdetailedinfo(self)
- Return the the node's description that is written in a separate window when the node is examined.
- getdisplayinfo(self)
- Return the text written beside the node.
- hellointerval(self, dummy=None)
- Perform the functions that are done periodically at each hello interval.
- init(self)
- Initialize the application.
- outofbanddata(self, key, value)
- Set the data that is agreed without any protocol (operator agreements) or manually configured.
Corresponds to the user/administrator configuring the application.
- received_connectrep(self, msg)
- Handle a received connect reply and adds the new search link.
- received_connectreq(self, msg)
- Handle a received connect request.
Forward to a neighbor with a lower load if possible. Otherwise answer to the request with a connect reply.
- received_hello(self, msg)
- Handle a received hello message.
Store the load of this neighbor.
- received_searchrep(self, msg)
- Handle a received search reply.
Count the answers.
- receivegeneral(self, ttl, type, id, msg)
- Handle reception of a general message and call the corresponding handler.
Called by the SIL framework.
- receiveindex(self, ttl, msg, destinations)
- Handle reception of index update.
Called by framework on reception of index update.
Adds and deletes remote resources specified in the index update.
Lets forwarding the index update continue.
- receivesearch(self, ttl, msg, destinations, firsthop=False)
- Handle received search requests.
Called by the SIL framework.
Determines the nodes to which the message is forwarded from the candidate destinations based on the search strategy.
Maintains clusterpath and clusterstack if configured so.
- removeresource(self, resource)
- Dynamically remove a resource from the node.
The removed resource is given in the resource argument.
Sends an index update to inform other nodes about the removed resource.
- replysearch(self, searcher, searchid, sendtime, where)
- Send a search reply.
Called by receivesearch on a found match.
- searchtimeout(self, searchid)
- Examine the search results collected during the search, and collect statistics about the search.
Called when a given time has expired since the search was initiated. A search request timed out with either results or without results.
Methods inherited from pongsim_sil.SILApplication:
- addlink(self, dest, index, search, indexttl=255, searchttl=255)
- Add a search or index link (or both) from this node to the destination node.
For an index link: index = True, indexttl defined (default 255)
For a search link: search = True, searchttl defined (default 255)
If there already exists a link to the given node, that is updated.
- draw(self, canvas, x, y)
- Draw the application-specific details - here the search and index links.
- floodindex(self, msg, ttl=None, id=None)
- Send a index update message using flooding.
If no ttl is specified, the link-specific one is used. If no id is specified, a random one is generated.
NOT to be subclassed.
- floodsearch(self, msg, ttl=None, id=None)
- Send a search message using flooding.
If no ttl is specified, the link-specific one is used. If no id is specified, a random one is generated.
NOT to be subclassed.
- forwardindex(self, msg, destinations, ttl=None, id=None)
- Forward a previously received index update message using flooding.
If no ttl is specified, the link-specific one is used. NOT to be subclassed.
- forwardsearch(self, msg, destinations, ttl=None, id=None)
- Forward a previously received search message using flooding.
If no ttl is specified, the link-specific one is used. NOT to be subclassed.
- isnew(self, id)
- Returns True if the message with the given id has been forwarded earlier by this node.
Remembers the current id. NOT recommended to be subclassed, but CAN be subclassed to skip checking.
- receive(self, packedmsg)
- Handle received message.
This function is called by the Node when a message is received. The SIL framework handles
index, search and generic messages separately. NOT to be subclassed.
- removelink(self, dest, index, search)
- Removes a search or index link (or both) from the node to the destination node.
Not implemented.
- sendgeneral(self, msg, dest, type=0, ttl=None, id=None)
- Send a message of other type to a specified node.
Messages are sent directly to the destination - there is no need for a search/index link path to the destination.
TTL and ID defaults to None, since these messages are not affected by flooding. They can be used for
an application-specific purpose. Type can be any integer, except for the reserved values (1 and 2), defaulting to 0.
NOT recommended to be subclassed.
Methods inherited from pongsim.Application:
- __init__(self, node)
- Initiate the application.
The original function MUST be called from an overriding function. A better approach
is to override the init() function.
- send(self, message, destination=None)
- Send the given message to the given destination.
|
class SILSimulation(pongsim.Simulation) |
|
####################################################################
### S I L S i m u l a t i o n
#################################################################### |
|
Methods defined here:
- close(self)
- Close the simulator and collects the statistics.
- generate_cluster_topology(self, clusternodes)
- Generate the topology connecting clusters together according to the chosen scenario.
- generate_resources(self, allnodes)
- Generate the shared resources and allocates them to the nodes.
- init(self)
- Initiate the simulation.
- startdatacollection(self, dummy)
- Allow collecting the statistics.
- stopcriteria(self)
- Define whether the simulation should end.
Methods inherited from pongsim.Simulation:
- __init__(self)
- Initialize the simulation
This function is called when the simulation is being initialized.
Override this function to implement your simulator.
- makeworld(self)
- Return a World for the simulation.
Called before init(). This function CAN be overrided to define other types of Worlds
| |