2.10 Advanced Topics
The tutorial covers the essential topics and concepts for using
Elephant. Many people will find that these features are the ones that
are most often needed and used in ordinary applications.
More sophisticated uses of Elephant may require additional features
that are covered in the user guide. The following is a list of major
features in the user guide that were not covered in this tutorial.
- Using Multiple Threads and Processes
What constraints must be accommodated to use Elephant data stores in
multiple threads? What capabilities are there to share data stores
among multiple processes or machines?
- Class Heirarchies and Queries
There are some subtle issues to take into account when querying
persistent classes. For example, how do you query a base class of
type people to get subclass instances such as employee, manager,
- Derived Class Indices
You can create your own indices for classes that are arbitrary
lisp functions of the persistent object.
- Dynamic Class Index Management
It is possible to add and remove indexes from classes at runtime.
- Class Definition/Database Conflict Resolution
When you startup lisp, there are potential conflicts between the
class definition and the indexing records in the database. There are
some constraints to account for and some facilities to manage
how slots, class indices and
- Indexed BTrees
Indexed BTrees are just like BTrees, except it is possible to add
indexes which are BTrees who's values are primary keys in the parent
indexed-btree. This allows for multiple ordering and groupings
of the values of a BTree.
- BTree Cursors
If you need to do more than iterate over a collection, or you need
to delete elements of the collection as you iterate cursors are an
important data structure. They implement a variety of operators for
moving backward and forward over a btree, including ranged operations
and iterating of duplicate or unique values.
- Using the Map Operators
Mapping operators can be very efficient if properly utilized.
- Using Multiple Stores
Multiple store controllers can be open simultaneously. However it
does make the code more complex and you need to be careful about how
you use them to avoid crashes and other unpleasant side effects.
- Custom Transaction Architecture
You can implement your own version of
with-transaction using the
underlying controller methods for starting, aborting and committing
transactions. You had better know what you are doing, however!
- Handling Errors and Conditions
There are a variety of errors that can occur in Elephant that need
to be dealt with by applications.
- Deadlock Detection in Berkeley DB
Berkeley DB requires an external process to detect deadlock
conditions among transactions. The :deadlock-detect keyword argument
to open-store for Berkeley DB specs will launch this process on most
Further, see Design Patterns for information about Elephant design patterns, solutions to common problems and other scenarios with multiple possible solutions.