aboutsummaryrefslogtreecommitdiff
path: root/page.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-06-10 09:38:40 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-06-10 09:38:40 -0600
commitfd7b0efeb514769e600756aa4190989fcdbdc09b (patch)
treefc98d16786934aafffd94d55658931d0658f8cda /page.go
parentMerge pull request #187 from benbjohnson/fix-seek (diff)
downloaddedo-fd7b0efeb514769e600756aa4190989fcdbdc09b.tar.gz
dedo-fd7b0efeb514769e600756aa4190989fcdbdc09b.tar.xz
Increase max nodes per page.
This commit changes the maxNodesPerPage constant so that it is essentially unlimited. Previously, a single large transaction could create more nodes than the mock array could handle. Fixes #188.
Diffstat (limited to 'page.go')
-rw-r--r--page.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/page.go b/page.go
index 78ca898..4430c3d 100644
--- a/page.go
+++ b/page.go
@@ -10,7 +10,6 @@ const pageHeaderSize = int(unsafe.Offsetof(((*page)(nil)).ptr))
const maxAllocSize = 0xFFFFFFF
const minKeysPerPage = 2
-const maxNodesPerPage = 65535
const branchPageElementSize = int(unsafe.Sizeof(branchPageElement{}))
const leafPageElementSize = int(unsafe.Sizeof(leafPageElement{}))
@@ -57,23 +56,23 @@ func (p *page) meta() *meta {
// leafPageElement retrieves the leaf node by index
func (p *page) leafPageElement(index uint16) *leafPageElement {
- n := &((*[maxNodesPerPage]leafPageElement)(unsafe.Pointer(&p.ptr)))[index]
+ n := &((*[0xFFFFFFF]leafPageElement)(unsafe.Pointer(&p.ptr)))[index]
return n
}
// leafPageElements retrieves a list of leaf nodes.
func (p *page) leafPageElements() []leafPageElement {
- return ((*[maxNodesPerPage]leafPageElement)(unsafe.Pointer(&p.ptr)))[:]
+ return ((*[0xFFFFFFF]leafPageElement)(unsafe.Pointer(&p.ptr)))[:]
}
// branchPageElement retrieves the branch node by index
func (p *page) branchPageElement(index uint16) *branchPageElement {
- return &((*[maxNodesPerPage]branchPageElement)(unsafe.Pointer(&p.ptr)))[index]
+ return &((*[0xFFFFFFF]branchPageElement)(unsafe.Pointer(&p.ptr)))[index]
}
// branchPageElements retrieves a list of branch nodes.
func (p *page) branchPageElements() []branchPageElement {
- return ((*[maxNodesPerPage]branchPageElement)(unsafe.Pointer(&p.ptr)))[:]
+ return ((*[0xFFFFFFF]branchPageElement)(unsafe.Pointer(&p.ptr)))[:]
}
// dump writes n bytes of the page to STDERR as hex output.