diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-10 16:58:16 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-10 16:58:16 -0700 |
commit | a68bd301db09ef5465f12ff4242696799da5b14d (patch) | |
tree | b6dc2efd0908df4ca7ff270181e46a1e4d85a77c /node.go | |
parent | Clean up. (diff) | |
parent | Add freelist. (diff) | |
download | dedo-a68bd301db09ef5465f12ff4242696799da5b14d.tar.gz dedo-a68bd301db09ef5465f12ff4242696799da5b14d.tar.xz |
Merge pull request #20 from benbjohnson/freelist
Freelist
Diffstat (limited to 'node.go')
-rw-r--r-- | node.go | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -9,13 +9,13 @@ import ( // node represents an in-memory, deserialized page. type node struct { transaction *RWTransaction - isLeaf bool - unbalanced bool - key []byte - depth int - pgid pgid - parent *node - inodes inodes + isLeaf bool + unbalanced bool + key []byte + depth int + pgid pgid + parent *node + inodes inodes } // minKeys returns the minimum number of inodes this node should have. @@ -76,7 +76,7 @@ func (n *node) nextSibling() *node { return nil } index := n.parent.childIndex(n) - if index >= n.parent.numChildren() - 1 { + if index >= n.parent.numChildren()-1 { return nil } return n.parent.childAt(index + 1) @@ -354,7 +354,3 @@ type inode struct { } type inodes []inode - -func (s inodes) Len() int { return len(s) } -func (s inodes) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func (s inodes) Less(i, j int) bool { return bytes.Compare(s[i].key, s[j].key) == -1 } |