[elephant-cvs] CVS elephant/src/contrib/eslick/db-rucksack

ieslick ieslick at common-lisp.net
Sun Feb 4 10:17:21 UTC 2007


Update of /project/elephant/cvsroot/elephant/src/contrib/eslick/db-rucksack
In directory clnet:/tmp/cvs-serv8664/src/contrib/eslick/db-rucksack

Added Files:
	notes.txt package.lisp rs-collections.lisp rs-controller.lisp 
Log Message:
Cleaning up source directory, moving partial projects to contrib


--- /project/elephant/cvsroot/elephant/src/contrib/eslick/db-rucksack/notes.txt	2007/02/04 10:17:21	NONE
+++ /project/elephant/cvsroot/elephant/src/contrib/eslick/db-rucksack/notes.txt	2007/02/04 10:17:21	1.1
Three main approaches:

1) Adapt elephant to support either RS or existing metaobject models 
   (hard to migrate?)
2) Create a single RS persistent-class to store slot values for an
   elephant p-obj, borrow the rest of the mechanism (PROPOSAL)
3) Write our own lisp backend using the heap, cache and btree code?
   Depends on how deeply the cache is integrated with serializer, etc.
--- /project/elephant/cvsroot/elephant/src/contrib/eslick/db-rucksack/package.lisp	2007/02/04 10:17:21	NONE
+++ /project/elephant/cvsroot/elephant/src/contrib/eslick/db-rucksack/package.lisp	2007/02/04 10:17:21	1.1
(in-package :cl-user)

(defpackage :rucksack-elephant
  (:use :cl :rucksack)
  (:export
   ;; controller
   #:open-rucksack #:close-rucksack #:with-rucksack #:current-rucksack
   #:rucksack #:standard-rucksack
   #:rucksack-cache
   #:rucksack-directory
   #:rucksack-commit #:rucksack-rollback
   #:add-rucksack-root #:map-rucksack-roots #:rucksack-roots
   #:commit #:rollback
   ;; class indexing
;;   #:add-class-index #:add-slot-index
;;   #:remove-class-index #:remove-slot-index
;;   #:map-class-indexes #:map-slot-indexes
   #:rucksack-add-class-index #:rucksack-add-slot-index
   #:rucksack-make-class-index
   #:rucksack-remove-class-index #:rucksack-remove-slot-index
   #:rucksack-class-index #:rucksack-slot-index
   #:rucksack-map-class-indexes #:rucksack-map-slot-indexes
   #:rucksack-maybe-index-changed-slot #:rucksack-maybe-index-new-object
   #:rucksack-map-class #:rucksack-map-slot
   ;; Transactions
;;   #:current-transaction
;;   #:transaction-start #:transaction-commit #:transaction-rollback
;;   #:with-transaction
;;   #:transaction #:standard-transaction
;;   #:transaction-start-1 #:transaction-commit-1
;;   #:transaction-id

   ;; Cache
   #:cache #:standard-cache
   #:open-cache #:close-cache #:with-cache
   #:cache-size #:cache-count
   #:cache-create-object #:cache-get-object #:cache-touch-object
   #:cache-commit #:cache-rollback #:cache-recover
   #:open-transaction #:close-transaction #:map-transactions
   
   ;; Conditions
   #:rucksack-error #:simple-rucksack-error #:transaction-conflict
   #:btree-error #:btree-search-error #:btree-insertion-error
   #:btree-key-already-present-error #:btree-type-error
   #:btree-error-btree #:btree-error-key #:btree-error-value
   ;; Heaps
   #:heap #:free-list-heap #:mark-and-sweep-heap #:simple-free-list-heap
   #:open-heap #:close-heap
   #:heap-stream #:heap-end
   ;; BTree IF
;;   #:btree
   #:btree-key< #:btree-key= #:btree-value=
   #:btree-max-node-size #:btree-unique-keys-p
   #:btree-key-type #:btree-value-type
   #:btree-node-class #:btree-node
   ;; Indexes
   #:map-index #:index-insert #:index-delete #:make-index
   ;; BTrees
   #:btree-search #:btree-insert 
;; #:map-btree

   ;; Objects
;;   #:persistent-object
   #:persistent-data #:persistent-array #:persistent-cons
   #:object-id
   #:p-cons #:p-array
   #:p-eql
   #:p-car #:p-cdr #:p-list
   #:p-make-array #:p-aref #:p-array-dimensions
   #:p-length #:p-find #:p-replace #:p-position
   ))

(defpackage :db-lisp
  (:use :cl :elephant :elephant-backend :rucksack-elephant))

;; file
;; octet-stream
;; binary-data
;; binary-types
;; buffers
;; btree
--- /project/elephant/cvsroot/elephant/src/contrib/eslick/db-rucksack/rs-collections.lisp	2007/02/04 10:17:21	NONE
+++ /project/elephant/cvsroot/elephant/src/contrib/eslick/db-rucksack/rs-collections.lisp	2007/02/04 10:17:21	1.1
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
;;;
;;; rs-collections.lisp -- view Berkeley DBs as Lisp collections
;;; 
;;; Initial version 6/4/2006 Ian Eslick
;;; <ieslick at common-lisp.net>
;;;
;;; Copyright (c) 2006 by Ian Eslick
;;; <ablumberg at common-lisp.net> <blee at common-lisp.net>
;;; 
;;; part of
;;;
;;; Elephant: an object-oriented database for Common Lisp
;;;
;;; Elephant users are granted the rights to distribute and use this software
;;; as governed by the terms of the Lisp Lesser GNU Public License
;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
;;;

(in-package #:db-rucksack)

(defclass rs-btree (btree) ()
  (:documentation "A Rucksack BTree"))

(defmethod build-btree ((sc rs-store-controller))
  (make-instance 'rs-btree :sc sc))

(defmethod --- /project/elephant/cvsroot/elephant/src/contrib/eslick/db-rucksack/rs-controller.lisp	2007/02/04 10:17:21	NONE
+++ /project/elephant/cvsroot/elephant/src/contrib/eslick/db-rucksack/rs-controller.lisp	2007/02/04 10:17:21	1.1
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
;;;
;;; rs-controller.lisp -- Lisp interface to a Berkeley DB store
;;; 
;;; Initial version 6/4/2006 Ian Eslick
;;; <ieslick at common-lisp.net>
;;; 
;;; part of
;;;
;;; Elephant: an object-oriented database for Common Lisp
;;;
;;; Elephant users are granted the rights to distribute and use this software
;;; as governed by the terms of the Lisp Lesser GNU Public License
;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
;;;

(in-package #:db-rucksack)

(defclass rs-store-controller (store-controller) 
  ((rucksack :accessor rs-store-db :initform nil)
   (slot-btree :accessor 

(defun rs-test-and-construct (spec)
  (if (rs-store-spec-p spec)
      (make-instance 'rs-store-controller :spec spec)
      (error (format nil "Unrecognized spec: ~A" spec))))

(eval-when (:compile-toplevel :load-toplevel)
  (register-backend-con-init :rs 'rs-test-and-construct))

(defun rs-store-spec-p (spec)
  (and (eq (first spec) :rucksack)
       (typecase (second spec)
	 (pathname t)
	 (string t)
	 (otherwise nil))))

(defmethod open-controller ((sc rs-store-controller) &rest args &key &allow-other-keys)
  (setf (rs-store-db sc) (apply #'open-rucksack 
			     (second (controller-spec sc))
			     args)))

(defmethod close-controller ((sc rs-store-controller))
  (rucksack-commit)
  (close-rucksack (rs-store-db sc)))

(defmethod next-oid ((sc rs-store-controller))
  "TODO"
  ;; create a proxy object using elephant's persistent-slot list
  ;; so we can store slots in it
  )

;;; Persistent slot protocol

(defmethod persistent-slot-reader ((sc rs-store-controller) instance name)
  "It would be nice to reuse the object interface that rucksack provides,
   but this is a cheap hack to get it running"
  ;; create comparison function in lisp
  ;; store slot values in btrees  
  )



		 

   



More information about the Elephant-cvs mailing list