diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-10 16:58:16 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-10 16:58:16 -0700 |
commit | a68bd301db09ef5465f12ff4242696799da5b14d (patch) | |
tree | b6dc2efd0908df4ca7ff270181e46a1e4d85a77c /cursor.go | |
parent | Clean up. (diff) | |
parent | Add freelist. (diff) | |
download | dedo-a68bd301db09ef5465f12ff4242696799da5b14d.tar.gz dedo-a68bd301db09ef5465f12ff4242696799da5b14d.tar.xz |
Merge pull request #20 from benbjohnson/freelist
Freelist
Diffstat (limited to 'cursor.go')
-rw-r--r-- | cursor.go | 10 |
1 files changed, 1 insertions, 9 deletions
@@ -43,9 +43,7 @@ func (c *Cursor) Get(key []byte) []byte { } func (c *Cursor) search(key []byte, p *page) { - if (p.flags & (p_branch | p_leaf)) == 0 { - panic("invalid page type: " + p.typ()) - } + _assert((p.flags&(p_branch|p_leaf)) != 0, "invalid page type: "+p.typ()) e := pageElementRef{page: p} c.stack = append(c.stack, e) @@ -95,11 +93,6 @@ func (c *Cursor) top() (*page, uint16) { return ptr.page, ptr.index } -// page returns the page that the cursor is currently pointing at. -func (c *Cursor) page() *page { - return c.stack[len(c.stack)-1].page -} - // element returns the leaf element that the cursor is currently positioned on. func (c *Cursor) element() *leafPageElement { ref := c.stack[len(c.stack)-1] @@ -123,4 +116,3 @@ func (c *Cursor) node(t *RWTransaction) *node { _assert(n.pgid == c.stack[len(c.stack)-1].page.id, "node/page mismatch b: %d != %d", n.pgid, c.stack[len(c.stack)-1].page.id) return n } - |