[Zodb-checkins] CVS: ZODB3/ZEO - ClientStorage.py:1.66

Guido van Rossum guido@python.org
Mon, 23 Sep 2002 15:08:15 -0400


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv24129

Modified Files:
	ClientStorage.py 
Log Message:
Inline _basic_init().

XXX This created two unused attributes, self._commit_lock_{acquire,release}.
Why?  I've gotten rid of them.  The test suite succeeds.  But they are
created by BaseStorage; maybe they play a role in the standard storage
API???


=== ZODB3/ZEO/ClientStorage.py 1.65 => 1.66 ===
--- ZODB3/ZEO/ClientStorage.py:1.65	Fri Sep 20 13:37:34 2002
+++ ZODB3/ZEO/ClientStorage.py	Mon Sep 23 15:08:14 2002
@@ -20,7 +20,6 @@
 # get rid of beginVerify, set up _tfile in verify_cache
 # set self._storage = stub later, in endVerify
 # if wait is given, wait until verify is complete
-# get rid of _basic_init
 
 import cPickle
 import os
@@ -115,14 +114,34 @@
 
         self._tbuf = TransactionBuffer()
         self._db = None
-        self._oids = []
+
         # _serials: stores (oid, serialno) as returned by server
         # _seriald: _check_serials() moves from _serials to _seriald,
         #           which maps oid to serialno
         self._serials = []
         self._seriald = {}
 
-        self._basic_init(name or str(addr))
+        self.__name__ = name or str(addr) # Standard convention for storages
+
+        # A ClientStorage only allows one thread to commit at a time.
+        # Mutual exclusion is achieved using _tpc_cond, which
+        # protects _transaction.  A thread that wants to assign to
+        # self._transaction must acquire _tpc_cond first.  A thread
+        # that decides it's done with a transaction (whether via success
+        # or failure) must set _transaction to None and do
+        # _tpc_cond.notify() before releasing _tpc_cond.
+        self._tpc_cond = threading.Condition()
+        self._transaction = None
+
+        # Prevent multiple new_oid calls from going out.  The _oids
+        # variable should only be modified while holding the
+        # _oid_lock.
+        self._oid_lock = threading.Lock()
+        self._oids = [] # Object ids retrieved from new_oids()
+
+        t = self._ts = get_timestamp()
+        self._serial = `t`
+        self._oid = '\0\0\0\0\0\0\0\0'
 
         # Decide whether to use non-temporary files
         client = client or os.environ.get('ZEO_CLIENT')
@@ -143,34 +162,6 @@
         # side effect of verify_cache().  If not, open it now.
         if not self.is_connected():
             self._cache.open()
-
-    def _basic_init(self, name):
-        """Handle initialization activites of BaseStorage"""
-
-        self.__name__ = name # A standard convention among storages
-
-        # A ClientStorage only allows one thread to commit at a time.
-        # Mutual exclusion is achieved using _tpc_cond, which
-        # protects _transaction.  A thread that wants to assign to
-        # self._transaction must acquire _tpc_cond first.  A thread
-        # that decides it's done with a transaction (whether via success
-        # or failure) must set _transaction to None and do
-        # _tpc_cond.notify() before releasing _tpc_cond.
-        self._tpc_cond = threading.Condition()
-        self._transaction = None
-
-        # Prevent multiple new_oid calls from going out.  The _oids
-        # variable should only be modified while holding the
-        # _oid_lock.
-        self._oid_lock = threading.Lock()
-
-        commit_lock = threading.Lock()
-        self._commit_lock_acquire = commit_lock.acquire
-        self._commit_lock_release = commit_lock.release
-
-        t = self._ts = get_timestamp()
-        self._serial = `t`
-        self._oid='\0\0\0\0\0\0\0\0'
 
     def close(self):
         if self._tbuf is not None: