[bknr-devel] bknr.indices, the slot NIL is missing from the object

Hans Hübner hans at huebner.org
Sat Feb 23 16:49:16 UTC 2008


Hi Klaus,

I have just committed http://bknr.net/trac/changeset/2600 which adds
multiple store support through the WITH-TRANSACTION macro.  You need to use
the :MAKE-DEFAULT NIL as initarg when making a store instance to prevent
setting the *STORE* special variable.  WITH-STORE must then be used to
select a store to work with:

DATASTORE> (defvar *state* 0)
*STATE*
DATASTORE> (defvar store1 (make-instance 'store :directory "/tmp/store1/"
:make-default nil))
STORE1
DATASTORE> (defvar store2 (make-instance 'store :directory "/tmp/store2/"
:make-default nil))
STORE2
DATASTORE> (deftransaction foo (value) (setf *state* value))
FOO
DATASTORE> (with-store (store1) (foo 1))
1
DATASTORE> (with-store (store2) (foo 2))
2
DATASTORE> (with-store (store1) (restore) *state*)
reading store random state
restoring #<STORE DIR: "/tmp/store1/">
loading transaction log /tmp/store1/current/transaction-log
1
DATASTORE> (with-store (store2) (restore) *state*)
reading store random state
restoring #<STORE DIR: "/tmp/store2/">
loading transaction log /tmp/store2/current/transaction-log
2
DATASTORE>

Let me know if that suits and works for you.

-Hans
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/bknr-devel/attachments/20080223/0e7c64c1/attachment.html>


More information about the Bknr-devel mailing list