type node … // root returns the top-level node this node is attached to. func (n *node) root() *node { … } // minKeys returns the minimum number of inodes this node should have. func (n *node) minKeys() int { … } // size returns the size of the node after serialization. func (n *node) size() int { … } // sizeLessThan returns true if the node is less than a given size. // This is an optimization to avoid calculating a large node when we only need // to know if it fits inside a certain page size. func (n *node) sizeLessThan(v uintptr) bool { … } // pageElementSize returns the size of each page element based on the type of node. func (n *node) pageElementSize() uintptr { … } // childAt returns the child node at a given index. func (n *node) childAt(index int) *node { … } // childIndex returns the index of a given child node. func (n *node) childIndex(child *node) int { … } // numChildren returns the number of children. func (n *node) numChildren() int { … } // nextSibling returns the next node with the same parent. func (n *node) nextSibling() *node { … } // prevSibling returns the previous node with the same parent. func (n *node) prevSibling() *node { … } // put inserts a key/value. func (n *node) put(oldKey, newKey, value []byte, pgId pgid, flags uint32) { … } // del removes a key from the node. func (n *node) del(key []byte) { … } // read initializes the node from a page. func (n *node) read(p *page) { … } // write writes the items onto one or more pages. // The page should have p.id (might be 0 for meta or bucket-inline page) and p.overflow set // and the rest should be zeroed. func (n *node) write(p *page) { … } // split breaks up a node into multiple smaller nodes, if appropriate. // This should only be called from the spill() function. func (n *node) split(pageSize uintptr) []*node { … } // splitTwo breaks up a node into two smaller nodes, if appropriate. // This should only be called from the split() function. func (n *node) splitTwo(pageSize uintptr) (*node, *node) { … } // splitIndex finds the position where a page will fill a given threshold. // It returns the index as well as the size of the first page. // This is only be called from split(). func (n *node) splitIndex(threshold int) (index, sz uintptr) { … } // spill writes the nodes to dirty pages and splits nodes as it goes. // Returns an error if dirty pages cannot be allocated. func (n *node) spill() error { … } // rebalance attempts to combine the node with sibling nodes if the node fill // size is below a threshold or if there are not enough keys. func (n *node) rebalance() { … } // removes a node from the list of in-memory children. // This does not affect the inodes. func (n *node) removeChild(target *node) { … } // dereference causes the node to copy all its inode key/value references to heap memory. // This is required when the mmap is reallocated so inodes are not pointing to stale data. func (n *node) dereference() { … } // free adds the node's underlying page to the freelist. func (n *node) free() { … } func compareKeys(left, right []byte) int { … } type nodes … func (s nodes) Len() int { … } func (s nodes) Swap(i, j int) { … } func (s nodes) Less(i, j int) bool { … } type inode … type inodes …