Commit b0f992fd authored by Jim Fulton's avatar Jim Fulton

Removed the mvcc option. Everybody wants mvcc and removing us lets us

simplify the code a little. (We'll be able to simplify more when we
stop supporting versions.)

Suppress version-deprecation warnings for tests.
parent 05634cca
...@@ -89,7 +89,6 @@ class Connection(ExportImport, object): ...@@ -89,7 +89,6 @@ class Connection(ExportImport, object):
self.connections = {self._db.database_name: self} self.connections = {self._db.database_name: self}
self._synch = None self._synch = None
self._mvcc = None
self._version = version self._version = version
self._normal_storage = self._storage = db._storage self._normal_storage = self._storage = db._storage
...@@ -348,7 +347,7 @@ class Connection(ExportImport, object): ...@@ -348,7 +347,7 @@ class Connection(ExportImport, object):
if connection is None: if connection is None:
new_con = self._db.databases[database_name].open( new_con = self._db.databases[database_name].open(
transaction_manager=self.transaction_manager, 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) self.connections.update(new_con.connections)
new_con.connections = self.connections new_con.connections = self.connections
...@@ -871,7 +870,7 @@ class Connection(ExportImport, object): ...@@ -871,7 +870,7 @@ class Connection(ExportImport, object):
def _load_before_or_conflict(self, obj): def _load_before_or_conflict(self, obj):
"""Load non-current state for obj or raise ReadConflictError.""" """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._register(obj)
self._conflicts[obj._p_oid] = True self._conflicts[obj._p_oid] = True
raise ReadConflictError(object=obj) raise ReadConflictError(object=obj)
...@@ -971,8 +970,7 @@ class Connection(ExportImport, object): ...@@ -971,8 +970,7 @@ class Connection(ExportImport, object):
# return a list of [ghosts....not recently used.....recently used] # return a list of [ghosts....not recently used.....recently used]
return everything.items() + items return everything.items() + items
def open(self, transaction_manager=None, mvcc=True, synch=True, def open(self, transaction_manager=None, synch=True, delegate=True):
delegate=True):
"""Register odb, the DB that this Connection uses. """Register odb, the DB that this Connection uses.
This method is called by the DB every time a Connection This method is called by the DB every time a Connection
...@@ -984,13 +982,11 @@ class Connection(ExportImport, object): ...@@ -984,13 +982,11 @@ class Connection(ExportImport, object):
Parameters: Parameters:
odb: database that owns the Connection odb: database that owns the Connection
mvcc: boolean indicating whether MVCC is enabled
transaction_manager: transaction manager to use. None means transaction_manager: transaction manager to use. None means
use the default transaction manager. use the default transaction manager.
synch: boolean indicating whether Connection should synch: boolean indicating whether Connection should
register for afterCompletion() calls. register for afterCompletion() calls.
""" """
# TODO: Why do we go to all the trouble of setting _db and # TODO: Why do we go to all the trouble of setting _db and
# other attributes on open and clearing them on close? # other attributes on open and clearing them on close?
# A Connection is only ever associated with a single DB # A Connection is only ever associated with a single DB
...@@ -998,7 +994,6 @@ class Connection(ExportImport, object): ...@@ -998,7 +994,6 @@ class Connection(ExportImport, object):
self._opened = time() self._opened = time()
self._synch = synch self._synch = synch
self._mvcc = mvcc and not self._version
if transaction_manager is None: if transaction_manager is None:
transaction_manager = transaction.manager transaction_manager = transaction.manager
...@@ -1021,7 +1016,7 @@ class Connection(ExportImport, object): ...@@ -1021,7 +1016,7 @@ class Connection(ExportImport, object):
# delegate open to secondary connections # delegate open to secondary connections
for connection in self.connections.values(): for connection in self.connections.values():
if connection is not self: if connection is not self:
connection.open(transaction_manager, mvcc, synch, False) connection.open(transaction_manager, synch, False)
def _resetCache(self): def _resetCache(self):
"""Creates a new cache, discarding the old one. """Creates a new cache, discarding the old one.
......
...@@ -554,8 +554,7 @@ class DB(object): ...@@ -554,8 +554,7 @@ class DB(object):
def objectCount(self): def objectCount(self):
return len(self._storage) return len(self._storage)
def open(self, version='', mvcc=True, def open(self, version='', transaction_manager=None, synch=True):
transaction_manager=None, synch=True):
"""Return a database Connection for use by application code. """Return a database Connection for use by application code.
The optional `version` argument can be used to specify that a The optional `version` argument can be used to specify that a
...@@ -568,7 +567,6 @@ class DB(object): ...@@ -568,7 +567,6 @@ class DB(object):
:Parameters: :Parameters:
- `version`: the "version" that all changes will be made - `version`: the "version" that all changes will be made
in, defaults to no version. in, defaults to no version.
- `mvcc`: boolean indicating whether MVCC is enabled
- `transaction_manager`: transaction manager to use. None means - `transaction_manager`: transaction manager to use. None means
use the default transaction manager. use the default transaction manager.
- `synch`: boolean indicating whether Connection should - `synch`: boolean indicating whether Connection should
...@@ -609,7 +607,7 @@ class DB(object): ...@@ -609,7 +607,7 @@ class DB(object):
assert result is not None assert result is not None
# Tell the connection it belongs to self. # 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. # A good time to do some cache cleanup.
self._connectionMap(lambda c: c.cacheGC()) self._connectionMap(lambda c: c.cacheGC())
......
This diff is collapsed.
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