api

Function summary
close btree
create filespec &key (type :default) (minimum-degree 3) (if-exists :error) (block-size 4096) (unique t)
delete btree key
insert btree key value
map ret-type btree func &key from to
max btree
min btree
open filespec &key (type :default) (minimum-degree 3) (block-size 4096) (if-exists :overwrite) (if-does-not-exist :error if-does-not-exist-p) (unique t)
print btree &optional (stream *standard-output*)
search btree key
search>= btree key
validate btree
map   ret-type btree func &key from to  [Function]

Map function func over B-tree. ret-type is either nil or 'list. Function receives key and value as parameters. Key parameters :from and :to can be used to set lower bound (inclusive) and higher bound (exclusive) for mapping. Thus, mapping applies to a range of keys :from <= key < :to.

search   btree key  [Function]

Returns two values: value associated with the key in B-tree and the key, if the key is found from B-tree. If the key is not found returns values nil and nil. If B-tree is non-unique the returned value is a list of values.

search>=   btree key  [Function]

Returns two values: value associated with the key greater or equal than given key in B-tree and the key, if the such key is found from B-tree. If no such key is found from B-tree, returns values nil and nil. If B-tree is non-unique the returned value is a list of values.

max   btree  [Function]

Returns two values from B-tree, or nil if B-tree is empty. If B-tree is non-empty the first value is associated value of max key in B-tree and the second value is the max key of B-tree.

min   btree  [Function]

Returns two values from B-tree, or nil if B-tree is empty. If B-tree is non-empty the first value is associated value of min key in B-tree and the second value is the min key of B-tree.

insert   btree key value  [Function]

Insert (key, value) pair to the given B-tree. If B-tree is unique and the key exists, the associated value is replaced with the value. If B-tree is non-unique, the value is pushed to the list associated with the key. Thus, newest value is first value in the list.

create   filespec &key (type :default) (minimum-degree 3) (if-exists :error) (block-size 4096) (unique t)  [Function]

Create new file based B-tree to given filespec.

B-tree with :default type is a B-tree with (unsigned-byte 32) keys and values. Type :string B-tree has anything readable as keys and values.

Minimum degree defines minimum and maximum number of keys (and children) on each node. Refer to B-tree definition for exact meaning.

Key parameter if-exists defines behavior in case the given filespec exists.

Block size defines the size of the used disk blocks.

Unique parameter defines B-tree's uniqueness. If t each key can have only one associated value, if nil key value is a list of values. Insert pushes new value to the list keeping newest value in the front of the list.

open   filespec &key (type :default) (minimum-degree 3) (block-size 4096) (if-exists :overwrite) (if-does-not-exist :error if-does-not-exist-p) (unique t)  [Function]

Open or create B-tree.

close   btree  [Function]

Close open B-tree.

print   btree &optional (stream *standard-output*)  [Function]

Write B-tree to a stream.

delete   btree key  [Function]

Delete key and its associated value(s) from B-tree.

validate   btree  [Function]

Validates B-tree structure. Traverses whole B-tree and checks that structure is valid.