Author: Not specified Language: python
Description: Not specified Timestamp: 2017-09-22 21:11:14 +0000
View raw paste Reply
  1. class Configuration :
  2.         replicas = List<Process>
  3.         head = Process
  4.         tail = Process
  5.  
  6. class Shuttle :
  7.         shuttle_id = int_val
  8.     shuttle_type = None # Shuttle type can be order and checkpoint
  9.         message = Message()
  10.         direction = Direction.Forward # Shuttle direction can be Forward or Backward
  11.     order_proof = []
  12.     result_proof =[]
  13.  
  14.     def __init__(self, order_proof, result_proof):
  15.         self.order_proof = order_proof
  16.         self.result_proof = result_proof
  17.  
  18. class Mode : # Possible modes for a replica
  19.         Active,
  20.         Pending,
  21.         Immutable
  22.  
  23. class Message :
  24.         sender = '...'
  25.         body = '...' # Message body is a serialized object e.g., reconfiguration_request_message
  26.         signature = '...'
  27.  
  28. class BcrTimer:
  29.     """Plane old timer for checkpointing and retransmit timing"""
  30.  
  31. class MessageHandler :
  32.         def sign(message, private_key) :
  33.                 # Sign the message for each outgoing message
  34.                 message.signature = sign(message.body, private_key)
  35.                 return [message, signature]
  36.  
  37.         def verify(message, signature) :
  38.                 # Verify message signature for each incomming message
  39.                 if message.signature == signature:
  40.                         return True
  41.                 return False
  42.  
  43.         def send(receiver, message) :
  44.                 # Send message
  45.                 # Handle Timeout
  46.                 message.signature = sign(message, private_key)
  47.                 send(receiver, message, timeout_callback = timeout)
  48.  
  49.         def timeout(message) :
  50.                 # Notify sender about timeout
  51.                 message.sender.message_timeout(message)
  52.  
View raw paste Reply