[Zope] Puzzled by BoboPOS

Jan Decaluwe jand@easics.be
Tue, 06 Apr 1999 19:14:36 +0200


Hi:

I recently took a closer look at BoboPOS operation, and I
am puzzled: a pack operation doesn't seem to remove obsolete
instances (even though it compresses the db significantly.)
My applications work as expected, but the db size increases
unnecessarily over time.

Below is a simple application I use to test this. I would
expect that, after a pack, only 1 Timestamp instance would
be in the db, as only 1 can be reached from the root object
at any time. Instead, I noticed that obsolete Timestamp 
instances are still present. Can someone tell me why?

Platform: Sun Solaris

>>>

   import os, sys
   path = os.path
   
   lib, tail = path.split(__file__)
   
   import DocumentTemplate 
   import BoboPOS
   
   import time
   
   datadir = path.join(lib, 'var', 'Data')
        
   class Container(BoboPOS.Persistent):
       """ Container """
   
       def __init__(self):
           """ init """
           self._timestamp = None
   
       def index_html(self):
           """ default method """
           if self._timestamp is not None:
               return self._timestamp._time
           return 'No timestamp'
           
       def pack(self):
           """ pack database """
           db._jar.db.pack(None, 0)
           return 'pack OK'
   
       def clear(self):
           """ clear  """
           self._timestamp = None
           return self.index_html()
   
       def stamp(self):
           """ stamp """
           self._timestamp = Timestamp()
           return self.index_html()
    
   
   class Timestamp(BoboPOS.Persistent):
       """ Item """
   
       def __init__(self):
           """ init """
           self._time = time.ctime(time.time())
           
           
   db = BoboPOS.PickleDictionary(path.join(datadir, 'tsdb'))
   if db.has_key('Container'):
       bobo_application = db['Container']
   else:
       bobo_application = db['Container'] = Container()
       get_transaction().commit()

<<<

-- 
===================================================================
Jan Decaluwe	          ===              Easics               ===
Design Manager            ===  VHDL-based ASIC design services  ===
Tel: +32-16-395 600	     ===================================
Fax: +32-16-395 619	 Interleuvenlaan 86, B-3001 Leuven, BELGIUM
mailto:jand@easics.be              http://www.easics.com