diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-30 19:26:10 -0800 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-30 19:26:10 -0800 |
commit | d05191d164dbab56adbb3a17a62f66a62695c6d3 (patch) | |
tree | 3f270655af94ff2dbbce62f6065d4f1c24030c71 /leaf.go | |
parent | Merge pull request #2 from benbjohnson/master (diff) | |
parent | Add RWTransaction.write(). (diff) | |
download | dedo-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.go | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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() |