def __init__(self, address): """Initializes the monitor with instance state given. Args: address: address of the instance to monitor """ # Initialize the thread as daemon super(Monitor, self).__init__(name="Monitor %s" % address) self.setDaemon(True) inlock.add_lock(self) # Asynchronous communicaton - push request self.force_push = threading.Event() # Instance information # Address of the instance as a string of the form ip:port or # host:port. It is immutable. self.address = address # Last version of the instance data as reported (instance of DataVersion or None) self._version = data.DataVersion() # If last ping successed self._reachable = False # Time of the last successful ping (DateTime) self._last_reachable = helpers.NOTIME # Time of the last successful push (DateTime) self._last_push = helpers.NOTIME
def __init__(self, address): """Initializes the monitor with instance state given. Args: address: address of the instance to monitor """ # Initialize the thread as daemon super(Monitor, self).__init__(name="Monitor %s"%address) self.setDaemon( True) inlock.add_lock( self) # Asynchronous communicaton - push request self.force_push = threading.Event() # Instance information # Address of the instance as a string of the form ip:port or # host:port. It is immutable. self.address = address # Last version of the instance data as reported (instance of DataVersion or None) self._version = data.DataVersion() # If last ping successed self._reachable = False # Time of the last successful ping (DateTime) self._last_reachable = helpers.NOTIME # Time of the last successful push (DateTime) self._last_push = helpers.NOTIME
def __init__(self, me): """Initializes the cluster state with all entries empty. Args: me: My address in the form of IP:port """ # Store my address self.me = me # All instance monitors self.instance_monitors = [] inlock.add_lock(self)
def __init__(self, me): """Initializes the cluster state with all entries empty. Args: me: My address in the form of IP:port """ # Store my address self.me = me # All instance monitors self.instance_monitors = [] inlock.add_lock( self)