aboutsummaryrefslogtreecommitdiff
path: root/cursor.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-02-10 16:58:16 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-02-10 16:58:16 -0700
commita68bd301db09ef5465f12ff4242696799da5b14d (patch)
treeb6dc2efd0908df4ca7ff270181e46a1e4d85a77c /cursor.go
parentClean up. (diff)
parentAdd freelist. (diff)
downloaddedo-a68bd301db09ef5465f12ff4242696799da5b14d.tar.gz
dedo-a68bd301db09ef5465f12ff4242696799da5b14d.tar.xz
Merge pull request #20 from benbjohnson/freelist
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
}
-