[rucksack-devel] Too many seperate transactions mess up rucksack
John Janecek
nopa90 at gmail.com
Thu Jun 26 23:48:12 UTC 2008
>
> How do you know that not all accounts end up in the rucksack?
> Could you show the code that you use for determining this? Or
> do you somehow inspect this manually?
>
> Arthur
>
Here is rest of code :)
class definition
(defvar *rs-dir* (merge-pathnames "Projects/sand-box/data1/"
(user-homedir-pathname)))
(with-rucksack (rs *rs-dir* );:if-exists :supersede)
(with-transaction ()
(defclass account ()
((username :initform nil
:initarg :username
:index :number-index
:accessor username-of)
(password :initform nil
:initarg :password
:accessor password-of)
)
(:index t)
(:metaclass persistent-class))))
then function that prints and dumps objects
(defmethod print-object ((obj account) stream)
(print-unreadable-object (obj stream :type t)
(with-slots (username password) obj
(format stream "~A ~A"
username password))))
(defun print-accounts ()
(with-rucksack (rs *rs-dir*)
(with-transaction ()
(let ((i 0))
(rucksack-map-class rs 'account
(lambda (object)
(print i)
(print object)
(setf i (+ i 1))
))))
nil
))
So i run (make-test-data) then if i dump the accounts sometimes not all of
them ended up inside the rucksack.
if i run (make-test-data) a second times, ussually only first few accounts
created end up in rucksack.
if i do (make-test-data1) it seems ok.
Possibly problem is i do not understand how to use rucksack properly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/rucksack-devel/attachments/20080627/c04f9255/attachment.html>
More information about the rucksack-devel
mailing list