def __init__(self, name, network): """ kind of constructor for node protocol. """ self.cm = ComputationalModel() self.node_name = name self.network = network self.all_vectors = {} # dictionary: <node_id:vector> pairs self.incoming_messages = [] # a list of all incoming messages # the list of all nodeclass instances (each contains a node) self.NodeList = [] # state of the node TODO it can be completely removed self.state = None self.mf = MonitoredFunctionImpl() # TODO must be given by user
def __init__(self, node_name, network): """ inits the protocol for a particular node. """ self.node_name = node_name self.network = network self.cm = ComputationalModel() self.all_vectors = {} self.incoming_messages = [] self.COORD = '' # init coord to null # special ack is True if node waits for a NEW_EST or ADJ_SLK msg self.special_ack = '' self.weight = 0 # init the weight to zero. self.NodeList = [] # list of all nodeclass instances self.mf = MonitoredFunctionImpl()
def __init__(self, node_name, network): """ inits the coordinator. """ self.node_name = node_name self.network = network self.cm = ComputationalModel() self.all_vectors = {} self.incoming_messages = [] # initialize the balancing process with the coordinatorProcess self.bp = BalancingProcess(self) # a list containing messages with results from balancing process self.balancing_msgs = [] self.weight = 0 # weight for coord, too self.mf = MonitoredFunctionImpl() self.NodeList = []
def __init__(self, name, network): """ kind of constructor for node protocol. """ self.cm = ComputationalModel() self.ams = AMS_Sketch() self.node_name = name self.network = network self.incoming_messages = [] # a list of all incoming messages self.COORD = None # coordinator's name self.weight = None self.ack = True # ack for a successful message sending # state of the node self.state = 'INIT' # bit of hardcoded self.mf = MonitoredFunctionImpl(len(self.ams.sketch)) self.state_mon = Monitor()