Commit 842166b9 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Define instance attributes in __init__ method.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@986 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6615cb5c
...@@ -76,6 +76,8 @@ class Application(object): ...@@ -76,6 +76,8 @@ class Application(object):
self.request_handler = MasterRequestEventHandler(self) self.request_handler = MasterRequestEventHandler(self)
self.dispatcher = Dispatcher() self.dispatcher = Dispatcher()
self.cluster_state = None self.cluster_state = None
self.master_conn = None
self.master_node = None
def run(self): def run(self):
"""Make sure that the status is sane and start a loop.""" """Make sure that the status is sane and start a loop."""
......
...@@ -40,7 +40,7 @@ class BootstrapManager(EventHandler): ...@@ -40,7 +40,7 @@ class BootstrapManager(EventHandler):
self.name = name self.name = name
self.num_replicas = None self.num_replicas = None
self.num_partitions = None self.num_partitions = None
self.curent = None self.current = None
def connectionCompleted(self, conn): def connectionCompleted(self, conn):
EventHandler.connectionCompleted(self, conn) EventHandler.connectionCompleted(self, conn)
......
...@@ -47,6 +47,15 @@ class FIFO(object): ...@@ -47,6 +47,15 @@ class FIFO(object):
self._head = None self._head = None
self._tail = None self._tail = None
self._len = 0 self._len = 0
self.prev = None
self.data = None
self.next = None
self.level = None
self.counter = None
self.value = None
self.element = None
self.key = None
self.expire_time = None
def __len__(self): def __len__(self):
return self._len return self._len
......
...@@ -69,8 +69,10 @@ class Application(object): ...@@ -69,8 +69,10 @@ class Application(object):
logging.debug('the number of replicas is %d, the number of partitions is %d, the name is %s', logging.debug('the number of replicas is %d, the number of partitions is %d, the name is %s',
replicas, partitions, self.name) replicas, partitions, self.name)
self.listening_conn = None
self.primary = None self.primary = None
self.primary_master_node = None self.primary_master_node = None
self.cluster_state = None
# Generate an UUID for self # Generate an UUID for self
self.uuid = self.getNewUUID(protocol.MASTER_NODE_TYPE) self.uuid = self.getNewUUID(protocol.MASTER_NODE_TYPE)
...@@ -82,6 +84,19 @@ class Application(object): ...@@ -82,6 +84,19 @@ class Application(object):
# The target node's uuid to request next. # The target node's uuid to request next.
self.target_uuid = None self.target_uuid = None
# election related data
self.unconnected_master_node_set = set()
self.negotiating_master_node_set = set()
# verification related data
self.unfinished_oid_set = set()
self.unfinished_tid_set = set()
self.asking_uuid_dict = {}
self.object_present = False
# service related data
self.finishing_transaction_dict = {}
def run(self): def run(self):
"""Make sure that the status is sane and start a loop.""" """Make sure that the status is sane and start a loop."""
......
...@@ -172,6 +172,7 @@ class Application(object): ...@@ -172,6 +172,7 @@ class Application(object):
self.em = EventManager() self.em = EventManager()
self.ptid = None self.ptid = None
self.trying_admin_node = False self.trying_admin_node = False
self.result = ''
def getConnection(self): def getConnection(self):
if self.conn is None: if self.conn is None:
......
...@@ -42,6 +42,7 @@ class Application(object): ...@@ -42,6 +42,7 @@ class Application(object):
def __init__(self, filename, section, reset=False): def __init__(self, filename, section, reset=False):
config = ConfigurationManager(filename, section) config = ConfigurationManager(filename, section)
self.uuid = None
self.name = config.getName() self.name = config.getName()
logging.debug('the name is %s', self.name) logging.debug('the name is %s', self.name)
self.connector_handler = getConnectorHandler(config.getConnector()) self.connector_handler = getConnectorHandler(config.getConnector())
...@@ -61,10 +62,20 @@ class Application(object): ...@@ -61,10 +62,20 @@ class Application(object):
# The partition table is initialized after getting the number of # The partition table is initialized after getting the number of
# partitions. # partitions.
self.pt = None self.pt = None
# XXX: shoud use self.pt.getID() instead
self.ptid = None
self.replicator = None self.replicator = None
self.listening_conn = None self.listening_conn = None
self.master_conn = None self.master_conn = None
self.master_node = None
# operation related data
self.transaction_dict = {}
self.store_lock_dict = {}
self.load_lock_dict = {}
self.event_queue = None
self.operational = False
# ready is True when operational and got all informations # ready is True when operational and got all informations
self.ready = False self.ready = False
......
...@@ -42,6 +42,7 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -42,6 +42,7 @@ class MySQLDatabaseManager(DatabaseManager):
self.db = kwargs['database'] self.db = kwargs['database']
self.user = kwargs['user'] self.user = kwargs['user']
self.passwd = kwargs.get('password') self.passwd = kwargs.get('password')
self.under_transaction = False
self.conn = None self.conn = None
self.connect() self.connect()
super(MySQLDatabaseManager, self).__init__(**kwargs) super(MySQLDatabaseManager, self).__init__(**kwargs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment