aboutsummaryrefslogtreecommitdiff
path: root/leaf.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-01-30 19:26:10 -0800
committerBen Johnson <benbjohnson@yahoo.com>2014-01-30 19:26:10 -0800
commitd05191d164dbab56adbb3a17a62f66a62695c6d3 (patch)
tree3f270655af94ff2dbbce62f6065d4f1c24030c71 /leaf.go
parentMerge pull request #2 from benbjohnson/master (diff)
parentAdd RWTransaction.write(). (diff)
downloaddedo-d05191d164dbab56adbb3a17a62f66a62695c6d3.tar.gz
dedo-d05191d164dbab56adbb3a17a62f66a62695c6d3.tar.xz
Merge pull request #3 from benbjohnson/spill
Spill to dirty pages, write to disk
Diffstat (limited to 'leaf.go')
-rw-r--r--leaf.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/leaf.go b/leaf.go
index 84cb08d..c86e041 100644
--- a/leaf.go
+++ b/leaf.go
@@ -8,6 +8,7 @@ import (
// leaf represents an in-memory, deserialized leaf page.
type leaf struct {
+ pgid pgid
parent *branch
items leafItems
}
@@ -39,10 +40,10 @@ func (l *leaf) put(key []byte, value []byte) {
// read initializes the item data from an on-disk page.
func (l *leaf) read(p *page) {
- ncount := int(p.count)
- l.items = make(leafItems, ncount)
+ l.pgid = p.id
+ l.items = make(leafItems, int(p.count))
lnodes := (*[maxNodesPerPage]lnode)(unsafe.Pointer(&p.ptr))
- for i := 0; i < ncount; i++ {
+ for i := 0; i < int(p.count); i++ {
lnode := &lnodes[i]
item := &l.items[i]
item.key = lnode.key()