Update of /project/elephant/cvsroot/elephant/src In directory common-lisp.net:/tmp/cvs-serv13609/src
Modified Files: collections.lisp Log Message: license, name changes
Date: Fri Aug 27 10:32:32 2004 Author: blee
Index: elephant/src/collections.lisp diff -u elephant/src/collections.lisp:1.2 elephant/src/collections.lisp:1.3 --- elephant/src/collections.lisp:1.2 Thu Aug 26 19:58:28 2004 +++ elephant/src/collections.lisp Fri Aug 27 10:32:32 2004 @@ -1,15 +1,53 @@ +;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;; +;;; collections.lisp -- view Berkeley DBs as Lisp collections +;;; +;;; Initial version 8/26/2004 by Ben Lee +;;; blee@common-lisp.net +;;; +;;; part of +;;; +;;; Elephant: an object-oriented database for Common Lisp +;;; +;;; Copyright (c) 2004 by Andrew Blumberg and Ben Lee +;;; ablumberg@common-lisp.net blee@common-lisp.net +;;; +;;; This program is free software; you can redistribute it +;;; and/or modify it under the terms of the GNU General +;;; Public License as published by the Free Software +;;; Foundation; either version 2 of the License, or (at +;;; your option) any later version. +;;; +;;; This program is distributed in the hope that it will be +;;; useful, but WITHOUT ANY WARRANTY; without even the +;;; implied warranty of MERCHANTABILITY or FITNESS FOR A +;;; PARTICULAR PURPOSE. See the GNU General Public License +;;; for more details. +;;; +;;; The GNU General Public License can be found in the file +;;; LICENSE which should have been distributed with this +;;; code. It can also be found at +;;; +;;; http://www.opensource.org/licenses/gpl-license.php +;;; +;;; You should have received a copy of the GNU General +;;; Public License along with this program; if not, write +;;; to the Free Software Foundation, Inc., 59 Temple Place, +;;; Suite 330, Boston, MA 02111-1307 USA +;;; + (in-package "ELEPHANT")
;;; collection types ;;; abstract hash-like collections ;;; equal hashing (except probably for array, hashe, instance keys!) -(defclass collection (persistent) ()) +(defclass persistent-collection (persistent) ())
(defgeneric get-value (key ht &rest args)) (defgeneric remove-kv (key ht &rest args))
;;; btree access -(defclass btree (collection) ()) +(defclass btree (persistent-collection) ())
(defmethod get-value (key (ht btree) &rest args) (declare (ignore args)) @@ -17,9 +55,10 @@ (let ((key-length (serialize key *key-buf*))) (handler-case (values - (deserialize (db-get-key-buffered (db *store-controller*) - (buffer-stream-buffer *key-buf*) - key-length)) + (deserialize (db-get-key-buffered + (controller-db *store-controller*) + (buffer-stream-buffer *key-buf*) + key-length)) t) (db-error (err) (if (= (db-error-errno err) DB_NOTFOUND) @@ -34,7 +73,7 @@ (buffer-write-int (oid ht) *key-buf*) (let ((key-length (serialize key *key-buf*)) (val-length (serialize value *out-buf*))) - (db-put-buffered (db *store-controller*) + (db-put-buffered (controller-db *store-controller*) (buffer-stream-buffer *key-buf*) key-length (buffer-stream-buffer *out-buf*) val-length :transaction transaction @@ -47,7 +86,7 @@ (declare (ignore args)) (buffer-write-int (oid ht) *key-buf*) (let ((key-length (serialize key *key-buf*))) - (db-delete-buffered (db *store-controller*) + (db-delete-buffered (controller-db *store-controller*) (buffer-stream-buffer *key-buf*) key-length :transaction transaction :auto-commit auto-commit)))