Mercurial > p > roundup > code
annotate roundup/backends/back_bsddb3.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 | 32e41ddf2edb |
| rev | line source |
|---|---|
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
196
diff
changeset
|
1 # |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
196
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:
196
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:
196
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:
196
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:
196
diff
changeset
|
6 # |
| 214 | 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:
196
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:
196
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:
196
diff
changeset
|
10 # POSSIBILITY OF SUCH DAMAGE. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
196
diff
changeset
|
11 # |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
196
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:
196
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:
196
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:
196
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:
196
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:
196
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_bsddb3.py,v 1.15 2002-07-19 03:36:34 richard Exp $ |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
19 |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
20 import bsddb3, os, marshal |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
21 from roundup import hyperdb, date |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
22 |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
23 # 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:
815
diff
changeset
|
24 from back_anydbm import Database, Class, FileClass, IssueClass |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
25 |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
26 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
27 # Now the database |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
28 # |
|
858
2dd862af72ee
all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents:
815
diff
changeset
|
29 class Database(Database): |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
30 """A database for storing records containing flexible data types.""" |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
31 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
32 # Class DBs |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
33 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
34 def clear(self): |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
35 for cn in self.classes.keys(): |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
36 db = os.path.join(self.dir, 'nodes.%s'%cn) |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
37 bsddb3.btopen(db, 'n') |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
38 db = os.path.join(self.dir, 'journals.%s'%cn) |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
39 bsddb3.btopen(db, 'n') |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
40 |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
41 def getclassdb(self, classname, mode='r'): |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
42 ''' grab a connection to the class db that will be used for |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
43 multiple actions |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
44 ''' |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
45 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
|
46 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
|
47 return bsddb3.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
|
48 else: |
|
815
f4ead46205ac
Was reopening the database with 'n'.
Richard Jones <richard@users.sourceforge.net>
parents:
726
diff
changeset
|
49 return bsddb3.btopen(path, 'c') |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
50 |
|
891
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
51 def opendb(self, name, mode): |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
52 '''Low-level database opener that gets around anydbm/dbm |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
53 eccentricities. |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
54 ''' |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
55 if __debug__: |
|
891
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
56 print >>hyperdb.DEBUG, self, 'opendb', (self, name, mode) |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
57 # determine which DB wrote the class file |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
58 path = os.path.join(os.getcwd(), self.dir, name) |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
59 if not os.path.exists(path): |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
60 if __debug__: |
|
891
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
61 print >>hyperdb.DEBUG, "opendb bsddb3.open(%r, 'c')"%path |
|
815
f4ead46205ac
Was reopening the database with 'n'.
Richard Jones <richard@users.sourceforge.net>
parents:
726
diff
changeset
|
62 return bsddb3.btopen(path, 'c') |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
63 |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
64 # open the database with the correct module |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
65 if __debug__: |
|
891
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
66 print >>hyperdb.DEBUG, "opendb bsddb3.open(%r, %r)"%(path, mode) |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
67 return bsddb3.btopen(path, mode) |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
68 |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
69 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
70 # Journal |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
71 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
72 def getjournal(self, classname, nodeid): |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
73 ''' get the journal for id |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
74 ''' |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
75 # attempt to open the journal - in some rare cases, the journal may |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
76 # not exist |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
77 try: |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
78 db = bsddb3.btopen(os.path.join(self.dir, 'journals.%s'%classname), |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
79 'r') |
|
891
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
80 except bsddb3._db.DBNoSuchFileError: |
|
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
81 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
|
82 # 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
|
83 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
|
84 raise IndexError, 'no such %s %s'%(classname, nodeid) |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
85 journal = marshal.loads(db[nodeid]) |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
86 res = [] |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
87 for entry in journal: |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
88 (nodeid, date_stamp, user, action, params) = entry |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
89 date_obj = date.Date(date_stamp) |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
90 res.append((nodeid, date_obj, user, action, params)) |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
91 db.close() |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
92 return res |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
93 |
|
891
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
94 def getCachedJournalDB(self, classname): |
|
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
95 ''' 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
|
96 ''' |
|
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
97 # get the database handle |
|
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
98 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
|
99 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
|
100 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
|
101 else: |
|
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
102 db = bsddb3.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
|
103 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
|
104 return db |
|
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
105 |
|
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
106 def doSaveJournal(self, classname, nodeid, action, params): |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
107 # serialise first |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
108 if action in ('set', 'create'): |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
109 params = self.serialise(classname, params) |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
110 |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
111 entry = (nodeid, date.Date().get_tuple(), self.journaltag, action, |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
112 params) |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
113 |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
114 if __debug__: |
|
891
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
115 print >>hyperdb.DEBUG, 'doSaveJournal', entry |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
116 |
|
891
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
117 db = self.getCachedJournalDB(classname) |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
118 |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
119 if db.has_key(nodeid): |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
120 s = db[nodeid] |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
121 l = marshal.loads(s) |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
122 l.append(entry) |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
123 else: |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
124 l = [entry] |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
125 |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
126 db[nodeid] = marshal.dumps(l) |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
127 |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
128 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
129 #$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
|
130 #Revision 1.14 2002/07/14 02:05:54 richard |
|
974a4b94c5e3
Implemented the destroy() method needed by the session database...
Richard Jones <richard@users.sourceforge.net>
parents:
858
diff
changeset
|
131 #. 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
|
132 # |
|
858
2dd862af72ee
all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents:
815
diff
changeset
|
133 #Revision 1.13 2002/07/08 06:41:03 richard |
|
2dd862af72ee
all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents:
815
diff
changeset
|
134 #Was reopening the database with 'n'. |
|
2dd862af72ee
all storage-specific code (ie. backend) is now implemented by the backends
Richard Jones <richard@users.sourceforge.net>
parents:
815
diff
changeset
|
135 # |
|
815
f4ead46205ac
Was reopening the database with 'n'.
Richard Jones <richard@users.sourceforge.net>
parents:
726
diff
changeset
|
136 #Revision 1.12 2002/05/21 05:52:11 richard |
|
f4ead46205ac
Was reopening the database with 'n'.
Richard Jones <richard@users.sourceforge.net>
parents:
726
diff
changeset
|
137 #Well whadya know, bsddb3 works again. |
|
f4ead46205ac
Was reopening the database with 'n'.
Richard Jones <richard@users.sourceforge.net>
parents:
726
diff
changeset
|
138 #The backend is implemented _exactly_ the same as bsddb - so there's no |
|
f4ead46205ac
Was reopening the database with 'n'.
Richard Jones <richard@users.sourceforge.net>
parents:
726
diff
changeset
|
139 #using its transaction or locking support. It'd be nice to use those some |
|
f4ead46205ac
Was reopening the database with 'n'.
Richard Jones <richard@users.sourceforge.net>
parents:
726
diff
changeset
|
140 #day I suppose. |
|
f4ead46205ac
Was reopening the database with 'n'.
Richard Jones <richard@users.sourceforge.net>
parents:
726
diff
changeset
|
141 # |
|
726
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
142 #Revision 1.11 2002/01/14 02:20:15 richard |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
143 # . changed all config accesses so they access either the instance or the |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
144 # config attriubute on the db. This means that all config is obtained from |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
145 # instance_config instead of the mish-mash of classes. This will make |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
146 # switching to a ConfigParser setup easier too, I hope. |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
147 # |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
148 #At a minimum, this makes migration a _little_ easier (a lot easier in the |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
149 #0.5.0 switch, I hope!) |
|
e3d742c75ac3
Well whadya know, bsddb3 works again.
Richard Jones <richard@users.sourceforge.net>
parents:
524
diff
changeset
|
150 # |
|
524
dce4c75bef5a
changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents:
394
diff
changeset
|
151 #Revision 1.10 2001/11/21 02:34:18 richard |
|
dce4c75bef5a
changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents:
394
diff
changeset
|
152 #Added a target version field to the extended issue schema |
|
dce4c75bef5a
changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents:
394
diff
changeset
|
153 # |
|
394
f43af1e97fdd
Added a target version field to the extended issue schema
Richard Jones <richard@users.sourceforge.net>
parents:
275
diff
changeset
|
154 #Revision 1.9 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
|
155 #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
|
156 #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
|
157 #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
|
158 #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
|
159 # |
|
275
1cc866cec608
Moved the data stringification up into the hyperdb.Class class's...
Richard Jones <richard@users.sourceforge.net>
parents:
270
diff
changeset
|
160 #Revision 1.8 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
|
161 #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
|
162 #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
|
163 # |
|
270
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
224
diff
changeset
|
164 #Revision 1.7 2001/08/12 06:32:36 richard |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
224
diff
changeset
|
165 #using isinstance(blah, Foo) now instead of isFooType |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
224
diff
changeset
|
166 # |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
167 #Revision 1.6 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
|
168 #stupid typo |
|
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
169 # |
| 214 | 170 #Revision 1.5 2001/08/07 00:15:51 richard |
| 171 #Added the copyright/license notice to (nearly) all files at request of | |
| 172 #Bizar Software. | |
| 173 # | |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
196
diff
changeset
|
174 #Revision 1.4 2001/08/03 02:45:47 anthonybaxter |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
196
diff
changeset
|
175 #'n' -> 'c' for create. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
196
diff
changeset
|
176 # |
|
196
6dfbc1aa0b1f
'n' -> 'c' for create.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
152
diff
changeset
|
177 #Revision 1.3 2001/07/30 02:36:23 richard |
|
6dfbc1aa0b1f
'n' -> 'c' for create.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
152
diff
changeset
|
178 #Handle non-existence of db files in the other backends (code from anydbm). |
|
6dfbc1aa0b1f
'n' -> 'c' for create.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
152
diff
changeset
|
179 # |
|
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
|
180 #Revision 1.2 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
|
181 #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
|
182 # |
|
149
fbc77ecf133b
Makes schema changes mucho easier.
Richard Jones <richard@users.sourceforge.net>
parents:
64
diff
changeset
|
183 #Revision 1.1 2001/07/24 04:26:03 anthonybaxter |
|
fbc77ecf133b
Makes schema changes mucho easier.
Richard Jones <richard@users.sourceforge.net>
parents:
64
diff
changeset
|
184 #bsddb3 implementation. For now, it's the bsddb implementation with a "3" |
|
fbc77ecf133b
Makes schema changes mucho easier.
Richard Jones <richard@users.sourceforge.net>
parents:
64
diff
changeset
|
185 #added in crayon. |
|
fbc77ecf133b
Makes schema changes mucho easier.
Richard Jones <richard@users.sourceforge.net>
parents:
64
diff
changeset
|
186 # |
|
64
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
187 #Revision 1.4 2001/07/23 08:25:33 richard |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
188 #more handling of bad journals |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
189 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
190 #Revision 1.3 2001/07/23 08:20:44 richard |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
191 #Moved over to using marshal in the bsddb and anydbm backends. |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
192 #roundup-admin now has a "freshen" command that'll load/save all nodes (not |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
193 # retired - mod hyperdb.Class.list() so it lists retired nodes) |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
194 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
195 #Revision 1.2 2001/07/23 07:56:05 richard |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
196 #Storing only marshallable data in the db - no nasty pickled class references. |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
197 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
198 #Revision 1.1 2001/07/23 07:22:13 richard |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
199 #*sigh* some databases have _foo.so as their underlying implementation. |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
200 #This time for sure, Rocky. |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
201 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
202 #Revision 1.1 2001/07/23 07:15:57 richard |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
203 #Moved the backends into the backends package. Anydbm hasn't been tested at all. |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
204 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
205 #Revision 1.1 2001/07/23 06:23:41 richard |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
206 #moved hyper_bsddb.py to the new backends package as bsddb.py |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
207 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
208 #Revision 1.2 2001/07/22 12:09:32 richard |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
209 #Final commit of Grande Splite |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
210 # |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
211 #Revision 1.1 2001/07/22 11:58:35 richard |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
212 #More Grande Splite |
|
8bce2210ef81
bsddb3 implementation.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
213 # |
