Previous: Transaction API, Up: User API Reference


5.9 Migration and Upgrading

Upgrade is a call to Migrate with checks for compatability. The migrate methods are included here in case you wish to develop a more specific “partial upgrade” or “partial migrate” of data from one store to another instead of using the top-level copy which migrates all live objects.

— Generic Function: elephant:upgrade sc spec

Given an open store controller from a prior version, open a new store specified by spec and migrate the data from the original store to the new one, upgrading it to the latest version

— Generic Function: elephant:migrate dst src

Migrate an object from the src object, collection or controller to the dst controller. Returns a copy of the object in the new store so you can drop it into a parent object or the root of the dst controller

— Method: elephant:migrate (dst store-controller) (src hash-table)

Migrate each hash element as the types are non-uniform

— Method: elephant:migrate (dst store-controller) (src array)

We really only need to handle arrays of type 't' that point to other objects; fixnum, float, etc array can just be written to the new store but we don't bother to optimize here

— Method: elephant:migrate (dst store-controller) (src cons)

warning: This doesn't work for circular lists

— Method: elephant:migrate (dst store-controller) (src pathname)

Migrate pathname as just return itself

— Method: elephant:migrate (dst store-controller) (src structure-object)

Walks structure slot values and ensures that any persistent references are written back into the slot pointint to the new store

— Method: elephant:migrate (dst store-controller) (src standard-object)

If we have persistent objects that are unindexed and only stored in a standard object slot that is referenced from the root, then it will only be copied by recursing through the slot substructure just as the serializer will, but copying any persistent objects found

— Method: elephant:migrate (dst store-controller) (src indexed-btree)

Also copy the inverse indices for indexed btrees

— Method: elephant:migrate (dst store-controller) (src btree)

Copy an index and it's contents to the target repository

— Method: elephant:migrate (dst store-controller) (src persistent)

Migrate a persistent object and apply a binary (lambda (dst src) ...) function to the new object. Users can override migrate by creating a function that calls the default copy and then does stuff with the slot values. A dynamic variable: *inhibit-slot-copy* can be bound in the caller to keep the new object from having its slots copied

— Method: after elephant:migrate (dst store-controller) (src store-controller)

This method ensures that we reset duplicate object detection over the store-controller

— Method: before elephant:migrate (dst store-controller) (src store-controller)

This method ensures that we reset duplicate object detection over the store-controller

— Method: before elephant:migrate (dst store-controller) (src persistent)

This provides some sanity checking that we aren't trying to copy to the same controller. We also need to be careful about deadlocking our transactions among the two gets/puts. Each leaf migration should be in its own transaction to avoid too many write locks.

— Method: elephant:migrate (dst store-controller) src

Default: standard objects are automatically migrated