[elephant-cvs] CVS elephant/src/elephant
ieslick
ieslick at common-lisp.net
Fri Mar 30 14:34:35 UTC 2007
Update of /project/elephant/cvsroot/elephant/src/elephant
In directory clnet:/tmp/cvs-serv31032/src/elephant
Modified Files:
backend.lisp classindex.lisp controller.lisp package.lisp
query.lisp serializer.lisp serializer1.lisp serializer2.lisp
variables.lisp
Log Message:
Significant documentation string and documentation edits towards 0.6.1 manual. Clean up packages so elephant exports user visible symbols and backend exports backend-relevant symbols. Change required fix in serializer packages also. Added :elephant-user package.
--- /project/elephant/cvsroot/elephant/src/elephant/backend.lisp 2007/02/16 23:02:53 1.11
+++ /project/elephant/cvsroot/elephant/src/elephant/backend.lisp 2007/03/30 14:34:35 1.12
@@ -23,108 +23,33 @@
(:documentation "Backends should use this to get access to internal symbols
of elephant that importers of elephant shouldn't see. Backends should also
import elephant to get use-api generic function symbols, classes and globals")
+ (:use #:elephant)
(:import-from #:elephant
;; Variables
- #:*cachesize*
- #:*dbconnection-spec* ;; shouldn't need this
+ #:*dbconnection-spec*
#:connection-is-indeed-open
- ;; Persistent objects
- #:oid #:get-con
- #:next-oid
- #:persistent-slot-writer
- #:persistent-slot-reader
- #:persistent-slot-boundp
- #:persistent-slot-makunbound
- ;; Controllers
- #:*elephant-code-version*
- #:store-controller
- #:open-controller
- #:database-version
- #:close-controller
- #:controller-serialize
- #:controller-deserialize
- #:controller-spec
- #:controller-root
- #:controller-version
- #:controller-class-root
- #:root #:spec #:class-root
- #:flush-instance-cache
- #:controller-symbol-cache #:controller-symbol-id-cache
- ;; Collection generic functions
- #:btree #:btree-index #:indexed-btree
- #:build-indexed-btree #:build-btree #:existsp
- #:map-indices
- ;; Serialization
- #:deserialize #:serialize
- #:deserialize-from-base64-string
- #:serialize-to-base64-string
- ;; Serialization callbacks
- #:lookup-persistent-symbol
- #:lookup-persistent-symbol-id
- ;; Cursor accessors
- #:cursor
- #:cursor-btree
- #:cursor-oid
- #:cursor-initialized-p
- ;; Transactions
- #:*current-transaction*
- #:make-transaction-record
- #:transaction-store
- #:transaction-object
- #:execute-transaction
- #:controller-start-transaction
- #:controller-commit-transaction
- #:controller-abort-transaction
- ;; Misc
- #:slot-definition-name
- #:remove-indexed-element-and-adjust
- #:register-backend-con-init
- #:lookup-backend-con-init
- ;; Lisp specific
- #+(or sbcl cmu) #:%bignum-ref
- )
- (:export
- ;; Variables
- #:*cachesize*
- #:*dbconnection-spec* ;; shouldn't need this
- #:connection-is-indeed-open
;; Persistent objects
#:oid #:get-con
- #:next-oid
+ #:next-oid
#:persistent-slot-writer
#:persistent-slot-reader
#:persistent-slot-boundp
#:persistent-slot-makunbound
+
;; Controllers
#:*elephant-code-version*
- #:store-controller
#:open-controller
- #:database-version
#:close-controller
+ #:database-version
+ #:controller-spec
#:controller-serialize
#:controller-deserialize
- #:controller-spec
- #:controller-root
- #:controller-class-root
- #:controller-version
#:root #:spec #:class-root
- #:flush-instance-cache
- #:controller-symbol-cache #:controller-symbol-id-cache
- ;; Collection generic functions
- #:btree #:btree-index #:indexed-btree
- #:build-indexed-btree #:build-btree #:existsp
- #:map-indices
;; Serialization
- #:deserialize #:serialize
- #:serialize-symbol-complete
#:deserialize-from-base64-string
#:serialize-to-base64-string
- ;; Serialization callbacks
- #:lookup-persistent-symbol
- #:lookup-persistent-symbol-id
;; Cursor accessors
- #:cursor
#:cursor-btree
#:cursor-oid
#:cursor-initialized-p
@@ -133,14 +58,58 @@
#:make-transaction-record
#:transaction-store
#:transaction-object
- #:execute-transaction
- #:controller-start-transaction
- #:controller-commit-transaction
- #:controller-abort-transaction
+ ;; Registration
+ #:register-backend-con-init
+ #:lookup-backend-con-init
;; Misc
#:slot-definition-name
+ #:slots-and-values
+ #:struct-slots-and-values
#:remove-indexed-element-and-adjust
- #:register-backend-con-init
- #:lookup-backend-con-init
- ))
+ )
+ (:export
+ ;; Variables
+ #:*cachesize*
+ #:*dbconnection-spec*
+ #:connection-is-indeed-open
+
+ ;; Persistent objects
+ #:oid #:get-con
+ #:next-oid
+ #:persistent-slot-writer
+ #:persistent-slot-reader
+ #:persistent-slot-boundp
+ #:persistent-slot-makunbound
+
+ ;; Controllers
+ #:*elephant-code-version*
+ #:open-controller
+ #:close-controller
+ #:database-version
+ #:controller-spec
+ #:controller-version
+ #:controller-serialize
+ #:controller-deserialize
+ #:root #:spec #:class-root
+ ;; Serialization
+ #:deserialize-from-base64-string
+ #:serialize-to-base64-string
+ ;; Cursor accessors
+ #:cursor-btree
+ #:cursor-oid
+ #:cursor-initialized-p
+ ;; Transactions
+ #:*current-transaction*
+ #:make-transaction-record
+ #:transaction-store
+ #:transaction-object
+ ;; Registration
+ #:register-backend-con-init
+ #:lookup-backend-con-init
+ ;; Misc
+ #:slot-definition-name
+ #:slots-and-values
+ #:struct-slots-and-values
+ #:remove-indexed-element-and-adjust
+ ))
--- /project/elephant/cvsroot/elephant/src/elephant/classindex.lisp 2007/03/25 14:57:49 1.33
+++ /project/elephant/cvsroot/elephant/src/elephant/classindex.lisp 2007/03/30 14:34:35 1.34
@@ -141,7 +141,7 @@
(map-btree (lambda (class-name index)
(declare (ignore index))
(let ((class (find-class class-name nil)))
- (when class
+ (when (and class (subtypep class 'persistent-metaclass))
(setf (%index-cache class) nil))))
(controller-class-root sc)))
(t (e) (warn "Unable to clear class index caches ~A" e)))))
@@ -333,16 +333,22 @@
;; USER CURSOR API
;; ===================
-(defgeneric make-inverted-cursor (persistent-metaclass name)
+(defgeneric make-inverted-cursor (class name)
(:documentation "Define a cursor on the inverted (slot or derived) index"))
-(defgeneric make-class-cursor (persistent-metaclass)
+(defgeneric make-class-cursor (class)
(:documentation "Define a cursor over all class instances"))
+
(defmethod make-inverted-cursor ((class persistent-metaclass) name)
(make-cursor (find-inverted-index class name)))
+(defmethod make-inverted-cursor ((class symbol) name)
+ (make-cursor (find-inverted-index class name)))
+
(defmacro with-inverted-cursor ((var class name) &body body)
+ "Bind the var argument to an inverted cursor on the index
+ specified the provided class and index name"
`(let ((,var (make-inverted-cursor ,class ,name)))
(unwind-protect (progn , at body)
(cursor-close ,var))))
@@ -350,7 +356,12 @@
(defmethod make-class-cursor ((class persistent-metaclass))
(make-cursor (find-class-index class)))
+(defmethod make-class-cursor ((class symbol))
+ (make-cursor (find-class-index class)))
+
(defmacro with-class-cursor ((var class) &body body)
+ "Bind the var argument in the body to a class cursor on the
+ index specified the provided class or class name"
`(let ((,var (make-class-cursor ,class)))
(unwind-protect (progn , at body)
(cursor-close ,var))))
@@ -361,8 +372,8 @@
;; ======================
(defun map-class (fn class)
- "Perform a map operation across all instances of class. Takes a
- function of one argument, the class instance"
+ "Perform a map operation over all instances of class. Takes a
+ function of one argument, a class instance"
(let* ((class (if (symbolp class)
(find-class class)
class))
@@ -374,9 +385,22 @@
(map-btree #'map-fn class-idx))))
(defun map-class-index (fn class index &rest args &key start end value)
- "To map over a subset of instances, pick an index by slot name
- or derived index name and specify the bounds for the traversal.
- Otherwise use map-class for all instances. "
+ "This function maps over a subset of class instances in the
+ order defined by the index. Specify the class and index by
+ quoted name. The index may be a slot index or a derived
+ index.
+
+ To map only a subset of key-value pairs, specify the range
+ using the :start and :end keywords; all elements greater than
+ or equal to :start and less than or equal to :end will be
+ traversed regardless of whether the start or end value is in
+ the index.
+
+ Use nil in the place of start or end to specify the first
+ element or last element, respectively.
+
+ To map a single value, iff it exists, use the :value keyword.
+ This is the only way to travers all nil values."
(declare (dynamic-extent args)
(ignorable args))
(let* ((index (if (symbolp index)
@@ -395,11 +419,14 @@
(defgeneric get-instances-by-class (persistent-metaclass)
(:documentation "Retrieve all instances from the class index as a list of objects"))
+
(defgeneric get-instance-by-value (persistent-metaclass slot-name value)
(:documentation "Retrieve instances from a slot index by value. Will return only the first
instance if there are duplicates."))
+
(defgeneric get-instances-by-value (persistent-metaclass slot-name value)
(:documentation "Returns a list of all instances where the slot value is equal to value."))
+
(defgeneric get-instances-by-range (persistent-metaclass slot-name start end)
(:documentation "Returns a list of all instances that match
values between start and end. An argument of
@@ -458,6 +485,8 @@
(nreverse instances)))
(defun drop-instances (instances &key (sc *store-controller*))
+ "Removes a list of persistent objects from all class indices
+ and unbinds any slot values"
(when instances
(assert (consp instances))
(do-subsets (subset 500 instances)
--- /project/elephant/cvsroot/elephant/src/elephant/controller.lisp 2007/03/24 03:03:00 1.41
+++ /project/elephant/cvsroot/elephant/src/elephant/controller.lisp 2007/03/30 14:34:35 1.42
@@ -23,16 +23,23 @@
;; TRACKING OBJECT STORES
;;
-(defparameter *elephant-backends*
+(defvar *elephant-backends*
'((:bdb (:ele-bdb))
(:clsql (:ele-clsql))
)
- "Entries have the form of (backend-type asdf-depends-list")
+ "Tells the main elephant code the tag used in a store spec to
+ refer to a given backend. The second argument is an asdf
+ dependency list. Entries have the form of (backend-type
+ asdf-depends-list")
(defvar *elephant-controller-init* (make-hash-table))
(defun register-backend-con-init (name controller-init-fn)
- "Backends call this during evalution to register their init function's name"
+ "Backends must call this function during the
+ loading/compilation process to register their initialization
+ function for the tag name in *elephant-backends*. The
+ initialization function returns a fresh instance of the
+ backends store-controller subclass"
(setf (gethash name *elephant-controller-init*) controller-init-fn))
(defun lookup-backend-con-init (name)
@@ -102,6 +109,9 @@
;;
(defun get-user-configuration-parameter (name)
+ "This function pulls a value from the key-value pairs stored in
+ my-config.sexp so backends can have their own pairs for appropriate
+ customization after loading."
(elephant-system::get-config-option
name
(asdf:find-system :elephant)))
@@ -114,26 +124,51 @@
((spec :type list
:accessor controller-spec
:initarg :spec
- :documentation "Backend create functions should pass in :spec during make-instance")
+ :documentation "Backend initialization functions are
+ expected to initialize :spec on the call to
+ make-instance")
;; Generic support for the object, indexing and root protocols
(root :reader controller-root
- :documentation "This should be a persistent btree instantiated by the backend")
+ :documentation "This is an instance of the backend
+ persistent btree. It should have an OID that is fixed in
+ the code and does not change between sessions. Usually
+ it this is something like 0, 1 or -1")
(class-root :reader controller-class-root
- :documentation "This should be a persistent indexed btree instantiated by the backend")
+ :documentation
+ "This is another root for class indexing that is
+ also a backend specific persistent btree instance
+ with a unique OID that persists between sessions.")
(instance-cache :accessor instance-cache :initform (make-cache-table :test 'eql)
- :documentation "This is an instance cache and part of the metaclass
- protocol. Backends should not override")
+ :documentation
+ "This is an instance cache and part of the
+ metaclass protocol. Backends should not
+ override the default behavior.")
(instance-cache-lock :accessor instance-cache-lock :initform (ele-make-lock)
- :documentation "Protection for updates to the cache from multiple threads")
+ :documentation "Protection for updates to
+ the cache from multiple threads. Do not
+ override.")
;; Upgradable serializer strategy
- (serializer-version :accessor controller-serializer-version :initform nil)
- (serialize :accessor controller-serialize :initform nil)
- (deserialize :accessor controller-deserialize :initform nil)
- )
+ (serializer-version :accessor controller-serializer-version :initform nil
+ :documentation "Governs the default
+ behavior regarding which serializer
+ version the current elephant core is
+ using. Backends can override by creating
+ a method on initialize-serializer.")
+ (serialize :accessor controller-serialize :initform nil
+ :documentation "Accessed by elephant::serialize to
+ get the entry point to the default serializer or to
+ a backend-specific serializer")
+ (deserialize :accessor controller-deserialize :initform nil
+ :documentation "Contains the entry point for the
+ specific serializer to be called by
+ elephant::deserialize"))
(:documentation
- "Class of objects responsible for the book-keeping of holding DB
- handles, the cache, table creation, counters, locks, the root
- (for garbage collection,) et cetera."))
+ "Superclass for the data store controller, the main interface
+ to any book-keeping, references to DB handles, the instance
+ cache, btree table creation, counters, locks, the roots (for
+ garbage collection,) et cetera. Behavior is shared between
+ the superclass and subclasses. See slot documentation for
+ details."))
;;
;; Per-controller instance caching
@@ -324,12 +359,22 @@
(defgeneric open-controller (sc &key recover recover-fatal thread &allow-other-keys)
(:documentation
"Opens the underlying environment and all the necessary
-database tables."))
+database tables. Different backends may use different keys so
+all methods should &allow-other-keys. There are three standard
+keywords: :recover, :recover-fatal and :thread. Recover means
+that recovery should be checked for or performed on startup.
+Recover fatal means a full rebuild from log files is requested.
+Thread merely indicates to the backend that it is a threaded
+application and any steps that need to be taken (for example
+transaction implementation) are taken. :thread is usually
+true."))
(defgeneric close-controller (sc)
(:documentation
- "Close the db handles and environment. Tries to wipe out
-references to the db handles."))
+ "Close the db handles and environment. Should be in a state
+ where lisp could be shut down without causing an inconsistent
+ state in the db. Also, the object could be used by
+ open-controller to reopen the database"))
(defmethod close-controller :after ((sc store-controller))
"Delete connection spec so store-controller operations on cached
@@ -422,42 +467,53 @@
(defun add-to-root (key value &key (sc *store-controller*))
"Add an arbitrary persistent thing to the root, so you can
-retrieve it in a later session. N.B. this means it (and
-everything it points to) won't get gc'd."
+ retrieve it in a later session. Anything referenced by an
+ object added to the root is considered reachable and thus live"
(declare (type store-controller store-controller))
(assert (not (eq key *elephant-properties-label*)))
(setf (get-value key (controller-root sc)) value))
(defun get-from-root (key &key (sc *store-controller*))
- "Get a something from the root."
+ "Get the value associated with key from the root. Returns two
+ values, the value, or nil, and a boolean indicating whether a
+ value was found or not (so you know if nil is a value or an
+ indication of non-presence)"
(declare (type store-controller sc))
(get-value key (controller-root sc)))
(defun root-existsp (key &key (sc *store-controller*))
- "Test whether a key exists in the root"
+ "Test whether a given key is instantiated in the root"
(declare (type store-controller sc))
(if (existsp key (controller-root sc))
t
nil))
(defun remove-from-root (key &key (sc *store-controller*))
- "Remove something from the root."
+ "Remove something from the root by the key value"
(declare (type store-controller sc))
(remove-kv key (controller-root sc)))
(defun map-root (fn &key (sc *store-controller*))
- "Map over all key-value pairs in the root"
+ "Takes a function of two arguments, key and value, to map over
+ all key-value pairs in the root"
(map-btree fn (controller-root sc)))
;;
;; Explicit storage reclamation
;;
+(defgeneric drop-pobject (persistent-object)
+ (:documentation "drop-pobject reclaims persistent object storage by unbinding
+ all persistent slot values. It can also helps catch errors
+ where an object should be unreachable, but a reference still
+ exists elsewhere in the DB. On access, the unbound slots
+ should flag an error in the application program. IMPORTANT:
+ this function does not clear the cached object instance or any
+ serialized references still in the db. Need a migration or GC
+ for that! drop-instances is preferred as it implements the proper
+ behavior for indexed classes"))
+
(defmethod drop-pobject ((inst persistent-object))
- "Reclaim persistent object storage by unbinding slot values.
- This does not delete the cached object instance or any
- serialized references still in the db.
- Need a migration or GC for that!"
(let ((pslots (persistent-slots (class-of inst))))
(dolist (slot pslots)
(slot-makunbound inst slot))))
--- /project/elephant/cvsroot/elephant/src/elephant/package.lisp 2007/03/23 16:08:10 1.25
+++ /project/elephant/cvsroot/elephant/src/elephant/package.lisp 2007/03/30 14:34:35 1.26
@@ -25,107 +25,6 @@
(:documentation
"Elephant: an object-oriented database for Common Lisp with
multiple backends for Berkeley DB, SQL and others.")
- (:export #:*store-controller* #:*current-transaction*
- #:*elephant-lib-path* #:*elephant-code-version*
- #:with-elephant-variables
-
- #:store-controller #:controller-root #:controller-class-root
- #:open-store #:close-store #:with-open-store
- #:add-to-root #:get-from-root #:remove-from-root #:root-existsp
- #:map-root #:get-cached-instance #:flush-instance-cache
- #:controller-symbol-cache #:controller-symbol-id-cache
- #:controller-fast-symbols-p
- #:optimize-layout #:drop-pobject
- #:get-user-configuration-parameter
- #:database-version
-
- #:upgrade
-
- #:controller-version #:controller-serializer-version
- #:controller-serialize #:controller-deserialize
- #:serialize-database-version-key
- #:serialize-database-version-value
- #:deserialize-database-version-value
- #:serialize-database-serializer-version-value
- #:deserialize-database-serializer-version-value
- #:initialize-serializer
-
- #:with-transaction #:ensure-transaction
- #:start-ele-transaction #:commit-transaction #:abort-transaction
-
- #:persistent #:persistent-object #:persistent-metaclass
- #:persistent-collection #:defpclass
-
- #:btree #:make-btree #:get-value #:remove-kv #:existp
- #:indexed-btree #:make-indexed-btree
- #:add-index #:get-index #:remove-index #:map-indices
- #:btree-index #:get-primary-key
- #:primary #:key-form #:key-fn
-
- #:struct-constructor
-
- #:migrate #:set-oid-spec #:*inhibit-slot-copy*
- #:add-symbol-conversion #:add-package-conversion
- #:*always-convert*
-
- #:translate-and-intern-symbol
- #:lookup-persistent-symbol
- #:lookup-persistent-symbol-id
- #:int-byte-spec
-
- #:cursor #:secondary-cursor #:make-cursor #:make-simple-cursor
- #:cursor-close #:cursor-init
- #:cursor-duplicate #:cursor-current #:cursor-first
- #:cursor-last #:cursor-next #:cursor-next-dup
- #:cursor-next-nodup #:cursor-prev #:cursor-prev-nodup
- #:cursor-set #:cursor-set-range #:cursor-get-both
- #:cursor-get-both-range #:cursor-delete #:cursor-put
- #:cursor-pcurrent #:cursor-pfirst #:cursor-plast
- #:cursor-pnext #:cursor-pnext-dup #:cursor-pnext-nodup
- #:cursor-pprev #:cursor-pprev-nodup #:cursor-pset
- #:cursor-pset-range #:cursor-pget-both
- #:cursor-pget-both-range
-
- ;; Class indexing management API
- #:*default-indexed-class-synch-policy*
- #:find-class-index #:find-inverted-index
- #:enable-class-indexing #:disable-class-indexing
- #:add-class-slot-index #:remove-class-slot-index
- #:add-class-derived-index #:remove-class-derived-index
- #:describe-db-class-index
- #:report-indexed-classes
- #:class-indexedp-by-name
-
- ;; Low level cursor API
- #:make-inverted-cursor #:make-class-cursor
- #:with-inverted-cursor #:with-class-cursor
-
- ;; Primitive mapping API
- #:with-btree-cursor
- #:map-btree
- #:map-index
-
- ;; BTREE Utilities
- #:empty-btree-p
- #:dump-btree
- #:btree-keys
- #:btree-differ-p
-
- ;; Class mapping API
- #:map-class
- #:map-class-index
-
- ;; Instance query API
- #:get-instances-by-class
- #:get-instance-by-value
- #:get-instances-by-value
- #:get-instances-by-range
- #:drop-instances
-
- ;; Utilities
- #:slots-and-values
- #:struct-slots-and-values
- )
#+cmu
(:import-from :pcl
compute-class-precedence-list
@@ -296,7 +195,71 @@
slot-definition-allocation
slot-definition-initargs
compute-slots)
+ (:export
+ #:*store-controller*
+ #:store-controller #:controller-root #:controller-class-root
+ #:open-store #:close-store #:with-open-store
+ #:add-to-root #:get-from-root #:remove-from-root #:root-existsp #:map-root
+ #:flush-instance-cache
+ #:optimize-layout
+
+ #:persistent #:persistent-object #:persistent-metaclass #:defpclass
+ #:persistent-collection #:drop-pobject
+
+ #:btree #:make-btree
+ #:get-value #:remove-kv #:existp
+ #:indexed-btree #:make-indexed-btree
+ #:add-index #:get-index #:remove-index #:map-indices
+ #:get-primary-key #:primary #:key-form #:key-fn
+ #:with-btree-cursor #:map-btree #:map-index
+ #:empty-btree-p #:dump-btree #:btree-keys #:btree-differ-p
+
+ #:cursor #:secondary-cursor #:make-cursor #:make-simple-cursor
+ #:cursor-close #:cursor-init
+ #:cursor-duplicate #:cursor-current #:cursor-first
+ #:cursor-last #:cursor-next #:cursor-next-dup
+ #:cursor-next-nodup #:cursor-prev #:cursor-prev-nodup
+ #:cursor-set #:cursor-set-range #:cursor-get-both
+ #:cursor-get-both-range #:cursor-delete #:cursor-put
+ #:cursor-pcurrent #:cursor-pfirst #:cursor-plast
+ #:cursor-pnext #:cursor-pnext-dup #:cursor-pnext-nodup
+ #:cursor-pprev #:cursor-pprev-nodup #:cursor-pset
+ #:cursor-pset-range #:cursor-pget-both
+ #:cursor-pget-both-range
+
+ #:find-class-index #:find-inverted-index
+ #:enable-class-indexing #:disable-class-indexing
+ #:add-class-slot-index #:remove-class-slot-index
+ #:add-class-derived-index #:remove-class-derived-index
+ #:describe-db-class-index
+ #:report-indexed-classes
+ #:class-indexedp-by-name
+
+ #:map-class #:map-class-index
+ #:get-instances-by-class
+ #:get-instance-by-value
+ #:get-instances-by-value
+ #:get-instances-by-range
+ #:drop-instances
+ #:make-inverted-cursor #:make-class-cursor
+ #:with-inverted-cursor #:with-class-cursor
+ #:*default-indexed-class-synch-policy*
+
+ #:with-transaction #:ensure-transaction
+ #:controller-start-transaction
+ #:controller-abort-transaction
+ #:controller-commit-transaction
+
+ #:upgrade #:migrate
+ #:set-oid-spec #:*inhibit-slot-copy*
+ #:add-symbol-conversion #:add-package-conversion
+ #:*always-convert*
+ #:translate-and-intern-symbol
+ #:lookup-persistent-symbol
+ #:lookup-persistent-symbol-id
+ #:struct-constructor
+ )
)
(in-package "ELE")
@@ -304,3 +267,10 @@
#+cmu
(eval-when (:compile-toplevel)
(proclaim '(optimize (ext:inhibit-warnings 3))))
+
+(defpackage :elephant-user
+ (:use :common-lisp :elephant)
+ (:nicknames :ele-user)
+ (:documentation
+ "A user package for experimenting with Elephant"))
+
\ No newline at end of file
--- /project/elephant/cvsroot/elephant/src/elephant/query.lisp 2007/03/01 02:45:45 1.1
+++ /project/elephant/cvsroot/elephant/src/elephant/query.lisp 2007/03/30 14:34:35 1.2
@@ -40,6 +40,7 @@
(number (funcall (relation-number-function rel) ival (first tvals)))))
(defun get-query-instances (constraints)
+ "Get a list of instances according to the query constraints"
(let ((list nil))
(flet ((collect (inst)
(push inst list)))
@@ -48,7 +49,9 @@
(defun map-class-query (fn constraints)
"Map instances using the query constaints to filter objects, exploiting
- slot indices (for last query) and stack allocated test closures"
+ slot indices (for last query) and stack allocated test closures. This is
+ a minimally optimizing version that uses the first index it finds, and
+ then does a nested loop join on the rest of the parameters."
(assert (not (null constraints)))
(destructuring-bind (class slot relation &rest values) (first constraints)
(flet ((filter-by-relation (inst)
--- /project/elephant/cvsroot/elephant/src/elephant/serializer.lisp 2007/03/03 17:24:59 1.25
+++ /project/elephant/cvsroot/elephant/src/elephant/serializer.lisp 2007/03/30 14:34:35 1.26
@@ -92,18 +92,21 @@
;; Database Version (a list of integers = [version major minor])
(defun serialize-database-version-key (bs)
+ "Given a buffer-stream, encode a key indicating the version using
+ the constant +elephant-version+"
(serialize-reserved-tag bs)
(serialize-system-tag +elephant-version+ bs))
(defun serialize-database-version-value (version bs)
- "Simple serializes a list containing three integers"
- (assert (consp version))
+ "Serializes a list containing three integers to the buffer stream bs"
+ (assert (and (= (length version) 3)))
(destructuring-bind (version major minor) version
(serialize-system-integer version bs)
(serialize-system-integer major bs)
(serialize-system-integer minor bs)))
(defun deserialize-database-version-value (bs)
+ "Deserializes the 3 integer list from buffer stream bs"
(let ((version (deserialize-system-integer bs))
(major (deserialize-system-integer bs))
(minor (deserialize-system-integer bs)))
--- /project/elephant/cvsroot/elephant/src/elephant/serializer1.lisp 2007/02/26 19:12:18 1.12
+++ /project/elephant/cvsroot/elephant/src/elephant/serializer1.lisp 2007/03/30 14:34:35 1.13
@@ -24,11 +24,12 @@
#+sbcl
(:import-from :sb-bignum
%bignum-ref)
- (:import-from :elephant
+ (:import-from #:elephant
get-cached-instance
slot-definition-allocation
slot-definition-name
compute-slots
+ slots-and-values
oid
int-byte-spec
array-type-from-byte
--- /project/elephant/cvsroot/elephant/src/elephant/serializer2.lisp 2007/03/21 14:29:31 1.33
+++ /project/elephant/cvsroot/elephant/src/elephant/serializer2.lisp 2007/03/30 14:34:35 1.34
@@ -29,6 +29,8 @@
slot-definition-allocation
slot-definition-name
compute-slots
+ slots-and-values
+ struct-slots-and-values
oid
int-byte-spec
array-type-from-byte
--- /project/elephant/cvsroot/elephant/src/elephant/variables.lisp 2007/02/02 23:51:58 1.10
+++ /project/elephant/cvsroot/elephant/src/elephant/variables.lisp 2007/03/30 14:34:35 1.11
@@ -38,9 +38,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Optimization parameters
-(defvar *cachesize* 100
- "Size of the OID sequence cache.")
-
(defvar *circularity-initial-hash-size* 50
"This is the default size of the circularity cache used in the serializer")
More information about the Elephant-cvs
mailing list