type Index … type LessFunction … type btreeString … // Less satisfies the BTree.Less interface using the btreeString's LessFunction. func (s btreeString) Less(i btree.Item) bool { … } type BTreeIndex … // Initialize populates the BTree tree with data from the keys channel, // according to the passed less function. It's destructive to the BTreeIndex. func (i *BTreeIndex) Initialize(less LessFunction, keys <-chan string) { … } // Insert inserts the given key (only) into the BTree tree. func (i *BTreeIndex) Insert(key string) { … } // Delete removes the given key (only) from the BTree tree. func (i *BTreeIndex) Delete(key string) { … } // Keys yields a maximum of n keys in order. If the passed 'from' key is empty, // Keys will return the first n keys. If the passed 'from' key is non-empty, the // first key in the returned slice will be the key that immediately follows the // passed key, in key order. func (i *BTreeIndex) Keys(from string, n int) []string { … } // rebuildIndex does the work of regenerating the index // with the given keys. func rebuild(less LessFunction, keys <-chan string) *btree.BTree { … }