[elephant-cvs] CVS elephant/src/db-bdb
ieslick
ieslick at common-lisp.net
Thu Jan 25 18:18:00 UTC 2007
Update of /project/elephant/cvsroot/elephant/src/db-bdb
In directory clnet:/tmp/cvs-serv27212/src/db-bdb
Modified Files:
bdb-symbol-tables.lisp
Log Message:
Symbol ID hack removed from BDB; Allegro/MacOS/x86 passes
--- /project/elephant/cvsroot/elephant/src/db-bdb/bdb-symbol-tables.lisp 2007/01/22 22:22:35 1.2
+++ /project/elephant/cvsroot/elephant/src/db-bdb/bdb-symbol-tables.lisp 2007/01/25 18:18:00 1.3
@@ -26,38 +26,37 @@
(serialize-symbol-complete symbol keybuf)
(let ((buf (db-get-key-buffered (controller-btrees sc)
keybuf valbuf)))
- (if buf (values (buffer-read-int buf) T)
- (values (create-persistent-symbol sc symbol keybuf valbuf) t)))))
-
-(defun create-persistent-symbol (sc symbol keybuf valbuf)
- "Takes an symbol->id table + symbol keybuf, allocates an ID and updates
- the persistent tables."
- (reset-buffer-stream valbuf) ;; Just to avoid any contamination
-;; (with-transaction (:txn-nosync t :dirty-read t)
-;; (format t "getting next symid")
- (let ((id (next-symid sc))) ;; allocate a new unique id
+ (if buf
+ (values (buffer-read-int buf) t)
+ (values (create-persistent-symbol-id sc symbol) t)))))
+
+(defun create-persistent-symbol-id (sc symbol)
+ "Allocates an ID and updates persistent tables"
+ (let ((id (next-symid sc)))
;; Update symbol->id table
-;; (format t "Writing sym->id: ~A -> ~A~%" symbol id)
- (buffer-write-int id valbuf)
-;; (format t "Putting id into table location~%")
- (db-put-buffered (controller-btrees sc) keybuf valbuf
- :auto-commit *auto-commit*)
+ (with-buffer-streams (keybuf valbuf)
+;; (format t "Writing sym->id: ~A -> ~A~%" symbol id)
+ (buffer-write-int *symbol-to-id-table-oid* keybuf)
+ (serialize-symbol-complete symbol keybuf)
+ (buffer-write-int id valbuf)
+;; (format t "Putting it into table location~%")
+ (db-put-buffered (controller-btrees sc) keybuf valbuf))
;; Write id->symbol table
- (reset-buffer-stream keybuf)
- (reset-buffer-stream valbuf)
-;; (format t "Writing id->sym: ~A -> ~A~%" id symbol)
- (buffer-write-int *id-to-symbol-table-oid* keybuf)
- (buffer-write-int id keybuf)
- (serialize-symbol-complete symbol valbuf)
- (db-put-buffered (controller-btrees sc) keybuf valbuf
- :auto-commit *auto-commit*)
- id)
-;; )
- )
+ (with-buffer-streams (keybuf valbuf)
+;; (format t "Writing id->sym: ~A -> ~A~%" id symbol)
+ (buffer-write-int *id-to-symbol-table-oid* keybuf)
+;; (buffer-write-byte elephant-serializer2::+fixnum32+ keybuf)
+;; (buffer-write-int id keybuf)
+ (serialize id keybuf sc)
+ (serialize-symbol-complete symbol valbuf)
+;; (format t "Putting it into table location~%")
+ (db-put-buffered (controller-btrees sc) keybuf valbuf))
+;; (format t "Done")
+ id))
(defmethod lookup-persistent-symbol ((sc bdb-store-controller) id)
- "Lookup the ID associated with a symbol"
+ "Lookup the symbol associated with this id"
(with-buffer-streams (keybuf valbuf)
;; (format t "Looking up: ~A~%" id)
(buffer-write-int *id-to-symbol-table-oid* keybuf)
More information about the Elephant-cvs
mailing list