Next: , Previous: Class Indices, Up: Tutorial


2.13 The Store Controller

What is open-store doing? It creates a store-controller object, and sets the special *store-controller* to point to it. The store controller holds the handles to the database environment and tables, and some other bookkeeping. If for some reason you need to run recovery on the database (see sleepycat docs) you can specify that with the :recover and :recover-fatal keys.

To create one by hand one can do,

     * (setq *store-controller* (make-instance 'store-controller :path "testdb"))
     => #<STORE-CONTROLLER {49252F75}>
     
     * (open-controller *store-controller*)
     => #<STORE-CONTROLLER {49252F75}>

but

     * (open-store "testdb"))

is the preferred mechanism.

This opens the environment and database. The persistent-* objects reference the *store-controller* special. (This is in part because slot accessors can't take additional arguments.) If for some reason you want to operate on 2 store controllers, you'll have to do that by flipping the *store-controller* special.

close-store closes the store controller. Alternatively close-controller can be called on a handle. Don't forget to do this or else you may need to run recovery later. There is a with-open-controller macro. Opening and closing a controller is very expensive.