From 8d5757e9dd1891b3d05f7acc7fe3d5a1d664ff6f Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Thu, 30 Jan 2014 17:04:56 -0500 Subject: gofmt --- branch.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'branch.go') 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 } - -- cgit v1.2.3