Update of /project/elephant/cvsroot/elephant/src/elephant In directory clnet:/tmp/cvs-serv22773/src/elephant
Modified Files: backend.lisp controller.lisp serializer.lisp Log Message: Repairing the use of the serializer for the SQL side
--- /project/elephant/cvsroot/elephant/src/elephant/backend.lisp 2007/01/25 19:37:53 1.6 +++ /project/elephant/cvsroot/elephant/src/elephant/backend.lisp 2007/01/26 14:41:13 1.7 @@ -39,6 +39,7 @@ #:*elephant-code-version* #:store-controller #:open-controller + #:database-version #:close-controller #:controller-serialize #:controller-deserialize @@ -95,6 +96,7 @@ #:*elephant-code-version* #:store-controller #:open-controller + #:database-version #:close-controller #:controller-serialize #:controller-deserialize @@ -136,4 +138,4 @@ #:register-backend-con-init #:lookup-backend-con-init )) - \ No newline at end of file + --- /project/elephant/cvsroot/elephant/src/elephant/controller.lisp 2007/01/25 19:37:53 1.24 +++ /project/elephant/cvsroot/elephant/src/elephant/controller.lisp 2007/01/26 14:41:13 1.25 @@ -112,8 +112,9 @@ (assert (consp spec)) (setq *store-controller* (get-controller spec)) (load-user-configuration *store-controller*) + (apply #'open-controller *store-controller* args) (initialize-serializer *store-controller*) - (apply #'open-controller *store-controller* args)) + )
(defun close-store (&optional sc) "Conveniently close the store controller." @@ -178,24 +179,7 @@ (setf (controller-serialize sc) 'elephant-serializer2::serialize) (setf (controller-deserialize sc) 'elephant-serializer2::deserialize))))
-;; -;; VERSIONING -;;
-(defmethod database-version ((sc store-controller)) - "A version determination for a given store - controller that is independant of the serializer as the - serializer is dispatched based on the code version which is a - list of the form '(0 6 0)" - (let ((version (controller-version-cached sc))) - (if version version - (let ((path (make-pathname :name "VERSION" :defaults (second (controller-spec sc))))) - (if (probe-file path) - (with-open-file (stream path :direction :input) - (setf (controller-version-cached sc) (read stream))) - (with-open-file (stream path :direction :output) - (setf (controller-version-cached sc) - (write *elephant-code-version* :stream stream))))))))
(defun prior-version-p (v1 v2) "Is v1 an equal or earlier version than v2" @@ -258,6 +242,15 @@ (intern (string-upcase (cdr name)) (car name)))
+ +;; +;; VERSIONING +;; + +(defgeneric database-version (sc) + (:documentation "Backends implement this to store the serializer version") + ) + ;; ;; STORE CONTROLLER PROTOCOL ;; --- /project/elephant/cvsroot/elephant/src/elephant/serializer.lisp 2007/01/21 21:20:04 1.17 +++ /project/elephant/cvsroot/elephant/src/elephant/serializer.lisp 2007/01/26 14:41:13 1.18 @@ -36,19 +36,24 @@ (with-buffer-streams (out-buf) (cl-base64::usb8-array-to-base64-string (elephant-memutil::buffer-read-byte-vector - (serialize x out-buf sc))))) + (serialize x out-buf sc))) + ) +)
(defun convert-buffer-to-base64-string (bs sc) (declare (ignore sc)) (cl-base64::usb8-array-to-base64-string - (elephant-memutil::buffer-read-byte-vector bs))) + (elephant-memutil::buffer-read-byte-vector bs) +) +)
(defun deserialize-from-base64-string (x sc) (with-buffer-streams (other) (deserialize (elephant-memutil::buffer-write-byte-vector other - (cl-base64::base64-string-to-usb8-array x)) + (cl-base64::base64-string-to-usb8-array x) + ) sc) ))