Next: , Up: User Guide


4.1 The Store Controller

An instance of the store-controller class mediates interactions between Lisp and a data store. All elephant operations are performed in the context of a store controller. To be more specific, a data store provides a subclass of store-controller specialized to that data store. Typically this object contains pointers to the disk files, foreign memory regions and any other necessary bookkeeping information to support Elephant operations such as slot writes and btree operations. The store also contains the root objects and other bookeeping common to all data stores.

To obtain a store-controller object, call the function open-store with a store controller specification. The current data store specification formats are:

Valid CLSQL database tags for <sql-db-name> are :SQLITE and :POSTGRESQL. The <sql-connect-command> is what you would pass to CLSQL's connect command.

The open store function uses the first symbol in the specification (i.e. :BDB or :CLSQL) to dispatch instance creation to the specified data store which returns a specialized instance of store-controller. open-store then initializes the store using an internal call to open-controller.

The final step of open-store is to set the global variable *store-controller*. This special variable is used as a default value in the optional or keyword arguments to number of operations such as:

Each of these functions also accepts an explicit store controller argument for use in multiple store environments. Normal applications should only be aware that this global parameter is used. For further discussion of *store-controller* see Multi-repository Operation.

Additionally, open-store accepts data store specific keyword arguments. For example, you can force recovery to be run on Berkeley DB data stores:

     (open-store *my-spec* :recover t)

The data store sections of the user guide (Berkeley DB Data Store and CLSQL Data Store) list all the data-store specific options to various elephant functions.

When you finish your application, close-store will close the store controller. Failing to do this properly may lead to a need to run recovery on the data store during the next session. Again, see the relevant data store sections for more detail.