aboutsummaryrefslogtreecommitdiff
path: root/cursor.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-02-09 15:52:19 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-02-10 14:04:01 -0700
commit509e93dff4cedf88d91ba2c99385da0b4e41eb6a (patch)
treeb6dc2efd0908df4ca7ff270181e46a1e4d85a77c /cursor.go
parentClean up. (diff)
downloaddedo-509e93dff4cedf88d91ba2c99385da0b4e41eb6a.tar.gz
dedo-509e93dff4cedf88d91ba2c99385da0b4e41eb6a.tar.xz
Add freelist.
Diffstat (limited to 'cursor.go')
-rw-r--r--cursor.go10
1 files changed, 1 insertions, 9 deletions
diff --git a/cursor.go b/cursor.go
index c76aab1..d993668 100644
--- a/cursor.go
+++ b/cursor.go
@@ -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
}
-