annotate roundup/backends/back_bsddb.py @ 968:07d8a4e296f8

Whee! It's not finished yet, but I can create a new instance... ...and play with it a little bit :)
author Richard Jones <richard@users.sourceforge.net>
date Thu, 22 Aug 2002 07:56:51 +0000
parents 974a4b94c5e3
children 16498e77e3ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
213
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
1 #
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
3 # This module is free software, and you may redistribute it and/or modify
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
4 # under the same terms as Python, so long as this copyright message and
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
5 # disclaimer are retained in their original form.
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
6 #
214
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
213
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
10 # POSSIBILITY OF SUCH DAMAGE.
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
11 #
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
17 #
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
18 #$Id: back_bsddb.py,v 1.20 2002-07-19 03:36:34 richard Exp $
440
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
19 '''
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
20 This module defines a backend that saves the hyperdatabase in BSDDB.
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
21 '''
46
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
22
47
34491d9b91a0 Storing only marshallable data in the db - no nasty pickled class references.
Richard Jones <richard@users.sourceforge.net>
parents: 46
diff changeset
23 import bsddb, os, marshal
650
9b2575610953 Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 625
diff changeset
24 from roundup import hyperdb, date
46
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
25
440
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
26 # these classes are so similar, we just use the anydbm methods
858
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
27 from back_anydbm import Database, Class, FileClass, IssueClass
440
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
28
46
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
29 #
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
30 # Now the database
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
31 #
858
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
32 class Database(Database):
46
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
33 """A database for storing records containing flexible data types."""
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
34 #
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
35 # Class DBs
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
36 #
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
37 def clear(self):
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
38 for cn in self.classes.keys():
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
39 db = os.path.join(self.dir, 'nodes.%s'%cn)
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
40 bsddb.btopen(db, 'n')
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
41 db = os.path.join(self.dir, 'journals.%s'%cn)
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
42 bsddb.btopen(db, 'n')
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
43
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
44 def getclassdb(self, classname, mode='r'):
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
45 ''' grab a connection to the class db that will be used for
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
46 multiple actions
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
47 '''
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
48 path = os.path.join(os.getcwd(), self.dir, 'nodes.%s'%classname)
152
80c062af1b7d Handle non-existence of db files in the other backends (code from anydbm).
Richard Jones <richard@users.sourceforge.net>
parents: 149
diff changeset
49 if os.path.exists(path):
80c062af1b7d Handle non-existence of db files in the other backends (code from anydbm).
Richard Jones <richard@users.sourceforge.net>
parents: 149
diff changeset
50 return bsddb.btopen(path, mode)
80c062af1b7d Handle non-existence of db files in the other backends (code from anydbm).
Richard Jones <richard@users.sourceforge.net>
parents: 149
diff changeset
51 else:
80c062af1b7d Handle non-existence of db files in the other backends (code from anydbm).
Richard Jones <richard@users.sourceforge.net>
parents: 149
diff changeset
52 return bsddb.btopen(path, 'n')
46
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
53
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
54 def opendb(self, name, mode):
570
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
55 '''Low-level database opener that gets around anydbm/dbm
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
56 eccentricities.
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
57 '''
719
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
58 if __debug__:
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
59 print >>hyperdb.DEBUG, self, 'opendb', (self, name, mode)
570
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
60 # determine which DB wrote the class file
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
61 path = os.path.join(os.getcwd(), self.dir, name)
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
62 if not os.path.exists(path):
719
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
63 if __debug__:
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
64 print >>hyperdb.DEBUG, "opendb bsddb.open(%r, 'n')"%path
570
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
65 return bsddb.btopen(path, 'n')
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
66
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
67 # open the database with the correct module
719
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
68 if __debug__:
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
69 print >>hyperdb.DEBUG, "opendb bsddb.open(%r, %r)"%(path, mode)
570
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
70 return bsddb.btopen(path, mode)
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
71
47
34491d9b91a0 Storing only marshallable data in the db - no nasty pickled class references.
Richard Jones <richard@users.sourceforge.net>
parents: 46
diff changeset
72 #
46
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
73 # Journal
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
74 #
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
75 def getjournal(self, classname, nodeid):
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
76 ''' get the journal for id
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
77 '''
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
78 # attempt to open the journal - in some rare cases, the journal may
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
79 # not exist
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
80 try:
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
81 db = bsddb.btopen(os.path.join(self.dir, 'journals.%s'%classname),
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
82 'r')
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
83 except bsddb.error, error:
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
84 if error.args[0] != 2: raise
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
85 raise IndexError, 'no such %s %s'%(classname, nodeid)
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
86 # more handling of bad journals
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
87 if not db.has_key(nodeid):
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
88 raise IndexError, 'no such %s %s'%(classname, nodeid)
47
34491d9b91a0 Storing only marshallable data in the db - no nasty pickled class references.
Richard Jones <richard@users.sourceforge.net>
parents: 46
diff changeset
89 journal = marshal.loads(db[nodeid])
34491d9b91a0 Storing only marshallable data in the db - no nasty pickled class references.
Richard Jones <richard@users.sourceforge.net>
parents: 46
diff changeset
90 res = []
34491d9b91a0 Storing only marshallable data in the db - no nasty pickled class references.
Richard Jones <richard@users.sourceforge.net>
parents: 46
diff changeset
91 for entry in journal:
625
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
92 (nodeid, date_stamp, user, action, params) = entry
48
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 47
diff changeset
93 date_obj = date.Date(date_stamp)
625
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
94 res.append((nodeid, date_obj, user, action, params))
46
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
95 db.close()
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
96 return res
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
97
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
98 def getCachedJournalDB(self, classname):
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
99 ''' get the journal db, looking in our cache of databases for commit
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
100 '''
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
101 # get the database handle
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
102 db_name = 'journals.%s'%classname
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
103 if self.databases.has_key(db_name):
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
104 return self.databases[db_name]
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
105 else:
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
106 db = bsddb.btopen(os.path.join(self.dir, db_name), 'c')
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
107 self.databases[db_name] = db
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
108 return db
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
109
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
110 def doSaveJournal(self, classname, nodeid, action, params):
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
111 # serialise first
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
112 if action in ('set', 'create'):
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
113 params = self.serialise(classname, params)
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
114
440
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
115 entry = (nodeid, date.Date().get_tuple(), self.journaltag, action,
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
116 params)
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
117
719
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
118 if __debug__:
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
119 print >>hyperdb.DEBUG, 'doSaveJournal', entry
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
120
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
121 db = self.getCachedJournalDB(classname)
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
122
440
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
123 if db.has_key(nodeid):
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
124 s = db[nodeid]
650
9b2575610953 Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 625
diff changeset
125 l = marshal.loads(s)
440
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
126 l.append(entry)
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
127 else:
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
128 l = [entry]
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
129
440
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
130 db[nodeid] = marshal.dumps(l)
46
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
131
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
132 #
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
133 #$Log: not supported by cvs2svn $
891
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
134 #Revision 1.19 2002/07/14 02:05:53 richard
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
135 #. all storage-specific code (ie. backend) is now implemented by the backends
974a4b94c5e3 Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents: 858
diff changeset
136 #
858
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
137 #Revision 1.18 2002/05/15 06:21:21 richard
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
138 # . node caching now works, and gives a small boost in performance
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
139 #
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
140 #As a part of this, I cleaned up the DEBUG output and implemented TRACE
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
141 #output (HYPERDBTRACE='file to trace to') with checkpoints at the start of
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
142 #CGI requests. Run roundup with python -O to skip all the DEBUG/TRACE stuff
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
143 #(using if __debug__ which is compiled out with -O)
2dd862af72ee all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents: 719
diff changeset
144 #
719
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
145 #Revision 1.17 2002/04/03 05:54:31 richard
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
146 #Fixed serialisation problem by moving the serialisation step out of the
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
147 #hyperdb.Class (get, set) into the hyperdb.Database.
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
148 #
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
149 #Also fixed htmltemplate after the showid changes I made yesterday.
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
150 #
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
151 #Unit tests for all of the above written.
fed4c363a7f3 node caching now works, and gives a small boost in performance
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
152 #
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
153 #Revision 1.16 2002/02/27 03:40:59 richard
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
154 #Ran it through pychecker, made fixes
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 650
diff changeset
155 #
650
9b2575610953 Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 625
diff changeset
156 #Revision 1.15 2002/02/16 09:15:33 richard
9b2575610953 Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 625
diff changeset
157 #forgot to patch bsddb backend too
9b2575610953 Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 625
diff changeset
158 #
625
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
159 #Revision 1.14 2002/01/22 07:21:13 richard
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
160 #. fixed back_bsddb so it passed the journal tests
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
161 #
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
162 #... it didn't seem happy using the back_anydbm _open method, which is odd.
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
163 #Yet another occurrance of whichdb not being able to recognise older bsddb
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
164 #databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
165 #process.
88acf6fe20a8 forgot to patch bsddb backend too
Richard Jones <richard@users.sourceforge.net>
parents: 570
diff changeset
166 #
570
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
167 #Revision 1.13 2001/12/10 22:20:01 richard
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
168 #Enabled transaction support in the bsddb backend. It uses the anydbm code
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
169 #where possible, only replacing methods where the db is opened (it uses the
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
170 #btree opener specifically.)
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
171 #Also cleaned up some change note generation.
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
172 #Made the backends package work with pydoc too.
e346a9792335 fixed back_bsddb so it passed the journal tests
Richard Jones <richard@users.sourceforge.net>
parents: 440
diff changeset
173 #
440
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
174 #Revision 1.12 2001/11/21 02:34:18 richard
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
175 #Added a target version field to the extended issue schema
de5bf4191f11 Enabled transaction support in the bsddb backend.
Richard Jones <richard@users.sourceforge.net>
parents: 394
diff changeset
176 #
394
f43af1e97fdd Added a target version field to the extended issue schema
Richard Jones <richard@users.sourceforge.net>
parents: 275
diff changeset
177 #Revision 1.11 2001/10/09 23:58:10 richard
f43af1e97fdd Added a target version field to the extended issue schema
Richard Jones <richard@users.sourceforge.net>
parents: 275
diff changeset
178 #Moved the data stringification up into the hyperdb.Class class' get, set
f43af1e97fdd Added a target version field to the extended issue schema
Richard Jones <richard@users.sourceforge.net>
parents: 275
diff changeset
179 #and create methods. This means that the data is also stringified for the
f43af1e97fdd Added a target version field to the extended issue schema
Richard Jones <richard@users.sourceforge.net>
parents: 275
diff changeset
180 #journal call, and removes duplication of code from the backends. The
f43af1e97fdd Added a target version field to the extended issue schema
Richard Jones <richard@users.sourceforge.net>
parents: 275
diff changeset
181 #backend code now only sees strings.
f43af1e97fdd Added a target version field to the extended issue schema
Richard Jones <richard@users.sourceforge.net>
parents: 275
diff changeset
182 #
275
1cc866cec608 Moved the data stringification up into the hyperdb.Class class's...
Richard Jones <richard@users.sourceforge.net>
parents: 270
diff changeset
183 #Revision 1.10 2001/10/09 07:25:59 richard
1cc866cec608 Moved the data stringification up into the hyperdb.Class class's...
Richard Jones <richard@users.sourceforge.net>
parents: 270
diff changeset
184 #Added the Password property type. See "pydoc roundup.password" for
1cc866cec608 Moved the data stringification up into the hyperdb.Class class's...
Richard Jones <richard@users.sourceforge.net>
parents: 270
diff changeset
185 #implementation details. Have updated some of the documentation too.
1cc866cec608 Moved the data stringification up into the hyperdb.Class class's...
Richard Jones <richard@users.sourceforge.net>
parents: 270
diff changeset
186 #
270
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 224
diff changeset
187 #Revision 1.9 2001/08/12 06:32:36 richard
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 224
diff changeset
188 #using isinstance(blah, Foo) now instead of isFooType
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 224
diff changeset
189 #
224
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
190 #Revision 1.8 2001/08/07 00:24:42 richard
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
191 #stupid typo
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
192 #
214
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
193 #Revision 1.7 2001/08/07 00:15:51 richard
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
194 #Added the copyright/license notice to (nearly) all files at request of
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
195 #Bizar Software.
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
196 #
213
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
197 #Revision 1.6 2001/07/30 02:36:23 richard
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
198 #Handle non-existence of db files in the other backends (code from anydbm).
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 152
diff changeset
199 #
152
80c062af1b7d Handle non-existence of db files in the other backends (code from anydbm).
Richard Jones <richard@users.sourceforge.net>
parents: 149
diff changeset
200 #Revision 1.5 2001/07/30 01:41:36 richard
80c062af1b7d Handle non-existence of db files in the other backends (code from anydbm).
Richard Jones <richard@users.sourceforge.net>
parents: 149
diff changeset
201 #Makes schema changes mucho easier.
80c062af1b7d Handle non-existence of db files in the other backends (code from anydbm).
Richard Jones <richard@users.sourceforge.net>
parents: 149
diff changeset
202 #
149
fbc77ecf133b Makes schema changes mucho easier.
Richard Jones <richard@users.sourceforge.net>
parents: 50
diff changeset
203 #Revision 1.4 2001/07/23 08:25:33 richard
fbc77ecf133b Makes schema changes mucho easier.
Richard Jones <richard@users.sourceforge.net>
parents: 50
diff changeset
204 #more handling of bad journals
fbc77ecf133b Makes schema changes mucho easier.
Richard Jones <richard@users.sourceforge.net>
parents: 50
diff changeset
205 #
50
674bd8e1b36e more handling of bad journals
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
206 #Revision 1.3 2001/07/23 08:20:44 richard
674bd8e1b36e more handling of bad journals
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
207 #Moved over to using marshal in the bsddb and anydbm backends.
674bd8e1b36e more handling of bad journals
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
208 #roundup-admin now has a "freshen" command that'll load/save all nodes (not
674bd8e1b36e more handling of bad journals
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
209 # retired - mod hyperdb.Class.list() so it lists retired nodes)
674bd8e1b36e more handling of bad journals
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
210 #
48
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 47
diff changeset
211 #Revision 1.2 2001/07/23 07:56:05 richard
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 47
diff changeset
212 #Storing only marshallable data in the db - no nasty pickled class references.
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 47
diff changeset
213 #
47
34491d9b91a0 Storing only marshallable data in the db - no nasty pickled class references.
Richard Jones <richard@users.sourceforge.net>
parents: 46
diff changeset
214 #Revision 1.1 2001/07/23 07:22:13 richard
34491d9b91a0 Storing only marshallable data in the db - no nasty pickled class references.
Richard Jones <richard@users.sourceforge.net>
parents: 46
diff changeset
215 #*sigh* some databases have _foo.so as their underlying implementation.
34491d9b91a0 Storing only marshallable data in the db - no nasty pickled class references.
Richard Jones <richard@users.sourceforge.net>
parents: 46
diff changeset
216 #This time for sure, Rocky.
34491d9b91a0 Storing only marshallable data in the db - no nasty pickled class references.
Richard Jones <richard@users.sourceforge.net>
parents: 46
diff changeset
217 #
46
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
218 #Revision 1.1 2001/07/23 07:15:57 richard
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
219 #Moved the backends into the backends package. Anydbm hasn't been tested at all.
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
220 #
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
221 #Revision 1.1 2001/07/23 06:23:41 richard
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
222 #moved hyper_bsddb.py to the new backends package as bsddb.py
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
223 #
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
224 #Revision 1.2 2001/07/22 12:09:32 richard
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
225 #Final commit of Grande Splite
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
226 #
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
227 #Revision 1.1 2001/07/22 11:58:35 richard
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
228 #More Grande Splite
3c5920433866 *sigh* some databases have _foo.so as their underlying implementation.
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
229 #

Roundup Issue Tracker: http://roundup-tracker.org/