[Zodb-checkins] CVS: ZODB3/bsddb3Storage/bsddb3Storage - BerkeleyBase.py:1.35

Barry Warsaw barry@wooz.org
Tue, 10 Dec 2002 17:39:57 -0500


Update of /cvs-repository/ZODB3/bsddb3Storage/bsddb3Storage
In directory cvs.zope.org:/tmp/cvs-serv27721

Modified Files:
	BerkeleyBase.py 
Log Message:
Support "read only" storages, but only in a limited way.  We accept a
read_only flag on the config object, and BerkeleyBase sets
self._is_read_only when this flag is true, but it leaves any
ReadOnlyError raising to BaseStorage.


=== ZODB3/bsddb3Storage/bsddb3Storage/BerkeleyBase.py 1.34 => 1.35 ===
--- ZODB3/bsddb3Storage/bsddb3Storage/BerkeleyBase.py:1.34	Tue Dec 10 16:48:47 2002
+++ ZODB3/bsddb3Storage/bsddb3Storage/BerkeleyBase.py	Tue Dec 10 17:39:57 2002
@@ -117,6 +117,11 @@
       3600, a classic pack will be performed once per day.  Set to zero to
       never automatically do classic packs.  For Minimal storage, this value
       is ignored -- all packs are classic packs.
+
+    Here are some other miscellaneous configuration variables:
+
+    - read_only causes ReadOnlyError's to be raised whenever any operation
+      (except pack!) might modify the underlying database.
     """
     interval = 120
     kbyte = 0
@@ -126,6 +131,7 @@
     frequency = 0
     packtime = 4 * 60 * 60
     classicpack = 0
+    read_only = 0
 
     def __repr__(self):
         d = self.__class__.__dict__.copy()
@@ -201,6 +207,7 @@
         # BaseStorage uses the name -- is globally unique.
         envdir = os.path.abspath(self._env.db_home)
         BaseStorage.__init__(self, envdir)
+        self._is_read_only = config.read_only
 
         # Instantiate a pack lock
         self._packlock = ThreadLock.allocate_lock()