From b2b614a6869f25dad8f1cfd32281858491bee035 Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Mon, 13 Jul 2020 19:32:26 -0500 Subject: [PATCH] refactor cursor.GetBitmap->tx.GetBitmap;rename to WalkRootRecordPages;err check --- rbf/cursor.go | 38 ++++++++++++++++++++++++-------------- rbf/cursor_test.go | 36 ++++++++++++++++++++++++++++++++++++ rbf/db.go | 2 +- rbf/rbf.go | 10 +++++----- rbf/tx.go | 19 +++++++++++++++---- 5 files changed, 81 insertions(+), 24 deletions(-) diff --git a/rbf/cursor.go b/rbf/cursor.go index 56822341e..60727743d 100644 --- a/rbf/cursor.go +++ b/rbf/cursor.go @@ -9,6 +9,7 @@ import ( "unsafe" "github.com/pilosa/pilosa/v2/roaring" + "github.com/pkg/errors" ) const ( @@ -155,9 +156,10 @@ func (c *Cursor) Add(v uint64) (changed bool, err error) { return false, nil case ContainerTypeBitmap: // Exit if bit set in bitmap container. - pgno, bm, err := cell.GetBitmap(c.tx) + pgno, bm, err := c.tx.GetBitmap(&cell) + if err != nil { - return false, err + return false, errors.Wrap(err, "cursor.Add") } a := cloneArray64(bm) @@ -234,9 +236,9 @@ func (c *Cursor) Remove(v uint64) (changed bool, err error) { } return true, c.putLeafCell(leafArgs{Key: cell.Key, Type: ContainerTypeRLE, N: len(runs), Data: fromInterval16(runs)}) case ContainerTypeBitmap: - pgno, bm, err := cell.GetBitmap(c.tx) + pgno, bm, err := c.tx.GetBitmap(&cell) if err != nil { - return false, err + return false, errors.Wrap(err, "cursor.add") } a := cloneArray64(bm) if a[lo/64]&(1<