[bknr-devel] bknr.indices, the slot NIL is missing from the object
Klaus Unger
UngerKlaus at gmx.de
Sun Feb 24 04:11:11 UTC 2008
Hi Hans,
thanks for the commits. If i got it right with-store does not apply to the
STORE-OBJECT-SUBSYSTEM which is based on indices. Therfore it is not possible
to use with-store for parallel stores based on all-store-objects and friends,
right?
In regards to the transaction log it does work for me, and it is a handy
thing, but not what I was originally looking for. What I meant would be like:
> DATASTORE> (with-store (store1) (make-object 'store-object))
=> #<STORE-OBJECT ID: 0>
> DATASTORE> (with-store (store2) (make-object 'foo-store-object))
=> #<FOO-STORE-OBJECT ID: 0>
> DATASTORE> (with-store (store1) (all-store-objects))
(#<STORE-OBJECT ID: 0>)
> DATASTORE> (with-store (store2) (all-store-objects))
(#<FOO-STORE-OBJECT ID: 0>)
This is not really meant as serial, but more like a multi threaded parallel
execution. Obviously it would be possible to do this prepending a (restore),
but this would bei a performance nightmare and require additional
synchronization.
From how I understand the code this would require to make
indexed-class-indices and index-effective-slot-definition-indices dependant
on the current *store* for persistent-class and
persistent-effective-slot-definition.
- Klaus
P.S.: I begin to feel guilty for always nagging, so I have to emphasize again
that I am really thankful for the commununication and your patience. Also
bknr is already really helpful for me in its current form! If we can be
improve it - even better.
Am Samstag, 23. Februar 2008 17:49:16 schrieb Hans Hübner:
> 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
More information about the Bknr-devel
mailing list