Skip to content

Commit

Permalink
Removed the mvcc option. Everybody wants mvcc and removing us lets us
Browse files Browse the repository at this point in the history
simplify the code a little. (We'll be able to simplify more when we
stop supporting versions.)

Suppress version-deprecation warnings for tests.
  • Loading branch information
Jim Fulton committed May 5, 2007
1 parent 05634cc commit b0f992f
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 165 deletions.
13 changes: 4 additions & 9 deletions src/ZODB/Connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def __init__(self, db, version='', cache_size=400):
self.connections = {self._db.database_name: self}

self._synch = None
self._mvcc = None

self._version = version
self._normal_storage = self._storage = db._storage
Expand Down Expand Up @@ -348,7 +347,7 @@ def get_connection(self, database_name):
if connection is None:
new_con = self._db.databases[database_name].open(
transaction_manager=self.transaction_manager,
mvcc=self._mvcc, version=self._version, synch=self._synch,
version=self._version, synch=self._synch,
)
self.connections.update(new_con.connections)
new_con.connections = self.connections
Expand Down Expand Up @@ -871,7 +870,7 @@ def _setstate(self, obj):

def _load_before_or_conflict(self, obj):
"""Load non-current state for obj or raise ReadConflictError."""
if not (self._mvcc and self._setstate_noncurrent(obj)):
if not ((not self._version) and self._setstate_noncurrent(obj)):
self._register(obj)
self._conflicts[obj._p_oid] = True
raise ReadConflictError(object=obj)
Expand Down Expand Up @@ -971,8 +970,7 @@ def _cache_items(self):
# return a list of [ghosts....not recently used.....recently used]
return everything.items() + items

def open(self, transaction_manager=None, mvcc=True, synch=True,
delegate=True):
def open(self, transaction_manager=None, synch=True, delegate=True):
"""Register odb, the DB that this Connection uses.
This method is called by the DB every time a Connection
Expand All @@ -984,21 +982,18 @@ def open(self, transaction_manager=None, mvcc=True, synch=True,
Parameters:
odb: database that owns the Connection
mvcc: boolean indicating whether MVCC is enabled
transaction_manager: transaction manager to use. None means
use the default transaction manager.
synch: boolean indicating whether Connection should
register for afterCompletion() calls.
"""

# TODO: Why do we go to all the trouble of setting _db and
# other attributes on open and clearing them on close?
# A Connection is only ever associated with a single DB
# and Storage.

self._opened = time()
self._synch = synch
self._mvcc = mvcc and not self._version

if transaction_manager is None:
transaction_manager = transaction.manager
Expand All @@ -1021,7 +1016,7 @@ def open(self, transaction_manager=None, mvcc=True, synch=True,
# delegate open to secondary connections
for connection in self.connections.values():
if connection is not self:
connection.open(transaction_manager, mvcc, synch, False)
connection.open(transaction_manager, synch, False)

def _resetCache(self):
"""Creates a new cache, discarding the old one.
Expand Down
6 changes: 2 additions & 4 deletions src/ZODB/DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,7 @@ def invalidateCache(self):
def objectCount(self):
return len(self._storage)

def open(self, version='', mvcc=True,
transaction_manager=None, synch=True):
def open(self, version='', transaction_manager=None, synch=True):
"""Return a database Connection for use by application code.
The optional `version` argument can be used to specify that a
Expand All @@ -568,7 +567,6 @@ def open(self, version='', mvcc=True,
:Parameters:
- `version`: the "version" that all changes will be made
in, defaults to no version.
- `mvcc`: boolean indicating whether MVCC is enabled
- `transaction_manager`: transaction manager to use. None means
use the default transaction manager.
- `synch`: boolean indicating whether Connection should
Expand Down Expand Up @@ -609,7 +607,7 @@ def open(self, version='', mvcc=True,
assert result is not None

# Tell the connection it belongs to self.
result.open(transaction_manager, mvcc, synch)
result.open(transaction_manager, synch)

# A good time to do some cache cleanup.
self._connectionMap(lambda c: c.cacheGC())
Expand Down

0 comments on commit b0f992f

Please sign in to comment.