-
top.py
- handles flow control. Call the file like :python top.py <test_filename>
. Alternatively, callingpython <test_file>
also works. -
abcast.py
- houses the classes and functionality for the two-phase multicast protocol, allowing unicast and multicast transmission between nodes. -
The test cases rigorously analyse and yield the protocol's behaviour, and their respective features are as follows :-
t_unicast.py
- demonstrates unicast-ability between nodes, and displays the order of reciept of messages sent via unicast is as per the delays encountered within the links they were sent through
t_basic.py
- simulates two nodes, with variable delays between messages sent in either direction. The order of messages passed to the application layer is the same in both the nodes, as are their committed timestamps, thus showing atomicity and total ordering.
t1.py
- 3 Nodes with only Multicast Traffic. Final Print statements show the order of messages in which they are passed to the delivery queue. Interim messages printed show the timestamp-communication mechanism at work. Demonstrates how the real-time order is different from the total order.
t_uni_multi.py
- Simulation showing communication in which both unicast and multicast operations are performed. The unicast messages are simply delivered to the delivery queue, while the multicast messaages still show total ordering.
t_multi_uni.py
- Nodes with Multicast Traffic, with unicast messages interspersed in between. We can observe that the multicast messages retain ordering despite unicast messages fiddling with timestamps! All communication of different messages overlaps with each other yet the mechanism is able to determine required order. Final Print statements show the order of messages in which they are passed to the delivery queue.
-
vector_clock.py
- functionality for Causal Order Multicast
Built to simulate a communicating node. Has the following attributes :-
local_timestamp
- Indicates serial number used for indexing received messagesr_queue
- To store a priority Queue of messages, and dequeue them when deliverable.delivered_messages
- Represents the order of messages passed to the upper layersid
- Unique Number per nodestored_ts
- Contains information to avoid race conditions
An abcast_node can perform the following methods to manipulate it's state :-
reorder_r_queue()
, when an update may potentially require reoderingupdate_r_queue(message, valid_ts)
, when a message receieves it's commit time, update local time stamp and mark it deliverableclean_queue()
- remove and deliver messages at the head of the queue if deliverablereceive_message(message)
- enqueue in r_queue and update local timestampreceive_uni(message)
- for handling unicast messagesreturn_local_timestamp_message()
- for reporting local timestamp to sender
Built to simulate a system of communicating nodes. Has the following attributes :-
nodes
- Instances of the abcast_node classn_nodes
- Number of nodes in the systemglobal_clock
- To study order of eventsevent
- To handle race conditions
An abcast_system can perform the following methods to communicate within nodes :-
start_global_clock()
- A daemon that runs in the background and maintains the global clocktransmit(message, n_from, n_to, rec_delay)
- Send Unicast from n_from to n_toemit(message, n_from, ns_to, rec_delays, reply_delays, commit_delays)
:- Send multicast from n_from to all nodes in n_to, and with delays passed as argumentsschedule_uni(node_num, induced_delay, message)
andschedule_action(node_num, action, induced_delay, message, validation_ts)
:- To transmit messages at the delays required.