Next: , Previous: Persistent Object API, Up: User API Reference


5.3 Persistent Object Indexing

5.3.1 Indexed Object Accessors

— Function: elephant:map-class fn class &key collect oids sc

Perform a map operation over all instances of class. Takes a function of one argument, a class instance.

— Function: elephant:map-inverted-index fn class index &rest args &key start end value from-end collect oids

map-inverted-index maps a function of two variables, taking key and instance, over a subset of class instances in the order defined by the index. Specify the class by classname or class object and index by quoted name. The index may be a slot index, derived index, or a valued association slot.

To map only a subset of key-value pairs, specify the range using the :start and :end keywords; all elements greater than or equal to :start and less than or equal to :end will be traversed regardless of whether the start or end value is in the index.

Use nil in the place of start or end to specify the first element or last element, respectively.

To map a single value, iff it exists, use the :value keyword. This is the only way to travers all nil values.

To map from :end to :start in descending order, set :from-end to true. If :value is used, :from-end is ignored

The 'oids' argument passes the oid of the instance to the provided function instead of the recreated instance.

— Generic Function: elephant:get-instances-by-class persistent-metaclass

Retrieve all instances from the class index as a list of objects

— Generic Function: elephant:get-instance-by-value persistent-metaclass slot-name value

Retrieve instances from a slot index by value. Will return only the first instance if there are duplicates.

— Generic Function: elephant:get-instances-by-value persistent-metaclass slot-name value

Returns a list of all instances where the slot value is equal to value.

— Generic Function: elephant:get-instances-by-range persistent-metaclass slot-name start end

Returns a list of all instances that match values between start and end. An argument of nil to start or end indicates, respectively, the lowest or highest value in the index

— Function: elephant:drop-instances instances &key sc txn-size

Removes a list of persistent objects from all class indices and unbinds any persistent slot values associated with those instances