aboutsummaryrefslogtreecommitdiff
path: root/branch.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-01-30 14:05:26 -0800
committerBen Johnson <benbjohnson@yahoo.com>2014-01-30 14:05:26 -0800
commitd087fb44197a6e3dcb06ca2b831575c1fc239bcd (patch)
tree15503ce52ea1346876df77543b24e6c23594cb03 /branch.go
parentBadges. (diff)
parentgofmt (diff)
downloaddedo-d087fb44197a6e3dcb06ca2b831575c1fc239bcd.tar.gz
dedo-d087fb44197a6e3dcb06ca2b831575c1fc239bcd.tar.xz
Merge pull request #2 from benbjohnson/master
gofmt
Diffstat (limited to 'branch.go')
-rw-r--r--branch.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/branch.go b/branch.go
index 7cba9d4..d752ac6 100644
--- a/branch.go
+++ b/branch.go
@@ -8,7 +8,7 @@ import (
// branch represents a temporary in-memory branch page.
type branch struct {
parent *branch
- items branchItems
+ items branchItems
}
// size returns the size of the branch after serialization.
@@ -80,7 +80,7 @@ func (b *branch) write(p *page) {
func (b *branch) split(pageSize int) []*branch {
// Ignore the split if the page doesn't have at least enough nodes for
// multiple pages or if the data can fit on a single page.
- if len(b.items) <= (minKeysPerPage * 2) || b.size() < pageSize {
+ if len(b.items) <= (minKeysPerPage*2) || b.size() < pageSize {
return []*branch{b}
}
@@ -95,7 +95,7 @@ func (b *branch) split(pageSize int) []*branch {
for index, item := range b.items {
nodeSize := bnodeSize + len(item.key)
- if (len(current.items) >= minKeysPerPage && index < len(b.items)-minKeysPerPage && size+nodeSize > threshold) {
+ if len(current.items) >= minKeysPerPage && index < len(b.items)-minKeysPerPage && size+nodeSize > threshold {
size = pageHeaderSize
branches = append(branches, current)
current = &branch{}
@@ -113,10 +113,9 @@ type branchItems []branchItem
type branchItem struct {
pgid pgid
- key []byte
+ key []byte
}
func (s branchItems) Len() int { return len(s) }
func (s branchItems) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s branchItems) Less(i, j int) bool { return bytes.Compare(s[i].key, s[j].key) == -1 }
-