Next: , Previous: BTree API, Up: User API Reference


5.6 Btree Cursors

Cursors are objects of type cursor (see Class elephant:cursor) which provide methods for complex traversals of BTrees.

— Macro: elephant:with-btree-cursor var &body body

Macro which opens a named cursor on a BTree (primary or not), evaluates the forms, then closes the cursor.

— Generic Function: elephant:make-cursor bt

Construct a cursor for traversing BTrees.

— Generic Function: elephant:cursor-close cursor

Close the cursor. Make sure to close cursors before the enclosing transaction is closed!

— Generic Function: elephant:cursor-duplicate cursor

Duplicate a cursor.

Each of the following methods return multiple values consisting of (exists? key value).

— Generic Function: elephant:cursor-current cursor

Get the key / value at the cursor position. Returns has-pair key value, where has-pair is a boolean indicating there was a pair.

— Generic Function: elephant:cursor-first cursor

Move the cursor to the beginning of the BTree, returning has-pair key value.

— Generic Function: elephant:cursor-last cursor

Move the cursor to the end of the BTree, returning has-pair key value.

— Generic Function: elephant:cursor-next cursor

Advance the cursor, returning has-pair key value.

— Generic Function: elephant:cursor-prev cursor

Move the cursor back, returning has-pair key value.

— Generic Function: elephant:cursor-set cursor key

Move the cursor to a particular key, returning has-pair key value.

— Generic Function: elephant:cursor-set-range cursor key

Move the cursor to the first key-value pair with key greater or equal to the key argument, according to the lisp sorter. Returns has-pair key value.

— Generic Function: elephant:cursor-get-both cursor key value

Moves the cursor to a particular key / value pair, returning has-pair key value.

— Generic Function: elephant:cursor-get-both-range cursor key value

Moves the cursor to the first key / value pair with key equal to the key argument and value greater or equal to the value argument. Not really useful for us since primaries don't have duplicates. Returns has-pair key value.

— Generic Function: elephant:cursor-delete cursor

Delete by cursor. The cursor is at an invalid position, and uninitialized, after a successful delete.

— Generic Function: elephant:cursor-put cursor value &key key

Overwrite value at current cursor location. Currently does not properly move the cursor.