Next: Persistent Classes, Previous: The Root, Up: Tutorial
What can you put into the store? An ever-growing list of things: numbers (except for complexes, which will be easy to support), symbols, strings, nil, characters, pathnames, conses, hash-tables, arrays, CLOS objects. Nested and circular things are allowed. You can store basically anything except lambdas, closures, structures, packages and streams. (These may eventually get supported too.)
Unfortunately Berekely DB doesn't understand Lisp, so Lisp data needs to be serialized to enter the database (converted to byte arrays), and deserialized to be read. This introduces some caveats (not unique to Elephant!):
* (setq foo (cons nil nil)) => (NIL) * (add-to-root "my key" foo) => NIL * (add-to-root "my other key" foo) => NIL * (eq (get-from-root "my key") (get-from-root "my other key")) => NIL
* (setf (car foo) T) => T * (get-from-root "my key") => (NIL)
This will affect all aggregate types: objects, conses, hash-tables, et cetera. (You can of course manually re-store the cons.) In this sense elephant does not automatically provide persistent collections. If you want to persist a collection on every access see See Using BTrees.
But don't despair, we'll solve most of these problems in the next section.....