Update: Release 0.9 is now available!

Introduction

Elephant is a persistent object protocol and database for Common Lisp. The persistent protocol component of elephant overrides class creation and standard slot accesses using the Meta Object Protocol (MOP) to render slot values persistent. Database functionality includes the ability to persistently index and retrieve ordered sets of class instances and ordinary lisp values.

Values are stored persistently on disk by one or more 'data stores', which currently consist of Berkeley DB and SQL servers via CL-SQL. A pure-lisp data store is under development. Elephant inherits the ACID properties of these stores, and by design is transactional, multi-threaded, and in the case of Berkeley DB, process safe.

The core elephant code base is available under the LLGPL license. Data stores each come with their own, separate license.

Key Features

Limitations

Elephant is not a complete persistence solution, although it provides most of the features as other alternatives. Functions, closures, and class objects cannot be stored. Garbage collection is only supported via an offline migrate interface which will compact the database by only copying reachable instances. Explicit deletion of data is also possible and some data stores will exploit reuse freed space to reduce the total disk utilization.

Perhaps the most frustrating limitation, and the one requiring the most effort to work around is that aggregate objects (arrays, lists, hash tables) do not support persistent operations. That is if you store a list, reload it and use (setf (cdr list) new-list) the in-memory list will not be the same as that on disk. Any list that is loaded from a slot or index will result in a freshly consed list. Elephant solves these problem by introducing two primitive data structures, persistent sets and BTrees.

Elephant's database facilities are limited to explicit storage in BTrees via persistent class and slot indexing. The Elephant roadmap includes some significant feature enhancements for querying the database that should make Elephant simpler to use and useful across a wide variety of applications. See the Trac Site for more information.

Caveats aside, Elephant is used in active websites and other projects that require significant reliability and has held up well under some heavy usage patterns. The 0.9 release has patched many of the problems identified in these uses. See the download page for more details.