btree

A BTree with a schema of named, Value-typed Column s.

class tinychain.collection.btree.BTree(form=None)[source]

Bases: Collection

A BTree with a schema of named, Value-typed Column s.

count(range=None)[source]

Return the number of keys in this BTree.

To count the number of keys beginning with a specific prefix, call btree[prefix].count().

delete(prefix=None)[source]

Delete the contents of this BTree within the specified range.

If no range is specified, the entire contents of this BTree will be deleted.

first()[source]

Return the first row in this BTree.

If there are no rows, this will raise a NotFoundError.

insert(key)[source]

Insert the given key into this BTree.

If the key is already present, this is a no-op.

reverse()[source]

Return a slice of this BTree with the same range but with its keys in reverse order.

class tinychain.collection.btree.Schema(columns)[source]

Bases: object

A BTree schema which comprises a tuple of Column s.