(resend to the list)
Hi Hans,
Am Samstag, 23. Februar 2008 08:31:17 schrieben Sie:
2008/2/23, Klaus Unger UngerKlaus@gmx.de:
Is it somehow possible with the datastore to run different stores in one lisp process? For example to run multiple instances of the same web-application on the same port on the same machine.
Currently not. We have removed multi-store support at one point because we felt that it was not useful enough to warrant cluttering the API with STORE arguments. I think that it is usually better to put separate applications into distinct Lisp processed as that approach provides better isolation.
I agree that store agruments would be a bad thing, I think thats what special variables are good for.
If you need multiple stores in one application, doing so would involve rebinding the store special variables in a WITH-STORE macro. I can add it if you need it, please let me know. Note that operations involving two stores will not be supported by that and I'd really question if that would make sense.
It would indeed be handy for me. Could you give me a sketch of how that would work? From my understanding the *store* only contains some meta information (counter, path, lock, ..) while the actual objects are stored in the indices, which are stored in class slots that are not affected by the special variable.
- Klaus
Here is my try with the special variable:
BKNR.DATASTORE> (make-instance 'mp-store :directory "/tmp/store1/" :subsystems (list (make-instance 'store-object-subsystem)))
reading store random state restoring #<MP-STORE DIR: "/tmp/store1/"> loading transaction log /tmp/store1/current/transaction-log #<MP-STORE DIR: "/tmp/store1/">
BKNR.DATASTORE> (all-store-objects)
(#<STORE-OBJECT ID: 0>)
BKNR.DATASTORE> (let ((*store* Nil)) (make-instance 'mp-store :directory "/tmp/store2/" :subsystems (list (make-instance 'store-object-subsystem))) (all-store-objects) (close-store))
reading store random state restoring #<MP-STORE DIR: "/tmp/store2/"> NIL
BKNR.DATASTORE> *store*
#<MP-STORE DIR: "/tmp/store1/"> ;; Back in the old store
BKNR.DATASTORE> (all-store-objects)
NIL ;; But the object is gone :(