From 26f6fefeadf1b3e38b86a0a12ba8d1cbb7f347d3 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Thu, 30 Jan 2014 18:22:02 -0500 Subject: Add RWTransaction.write(). --- leaf.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'leaf.go') 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() -- cgit v1.2.3