Skip to content

Commit

Permalink
Address review comments..
Browse files Browse the repository at this point in the history
Signed-off-by: ishan16696 <ishan.tyagi@sap.com>
  • Loading branch information
ishan16696 committed Feb 25, 2024
1 parent ea00d4f commit bba77f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tx_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (tx *Tx) check(cfg checkConfig, ch chan error) {
}
} else {
// Check the db file starting from a specified pageId.
if cfg.pageId < 2 || cfg.pageId >= uint64(tx.meta.Pgid()) {
if cfg.pageId < 2 || cfg.pageId >= uint(tx.meta.Pgid()) {
ch <- fmt.Errorf("page ID (%d) out of range [%d, %d)", cfg.pageId, 2, tx.meta.Pgid())
return
}
Expand Down Expand Up @@ -250,20 +250,20 @@ func verifyKeyOrder(pgId common.Pgid, pageType string, index int, key []byte, pr

type checkConfig struct {
kvStringer KVStringer
pageId uint64
pageId uint
}

type CheckOption func(options *checkConfig)

func WithKVStringer(kvStringer KVStringer, pageID uint64) CheckOption {
func WithKVStringer(kvStringer KVStringer, pageID uint) CheckOption {
return func(c *checkConfig) {
c.kvStringer = kvStringer
c.pageId = pageID
}
}

// WithPageId sets a page ID from which the check command starts to check
func WithPageId(pageId uint64) CheckOption {
func WithPageId(pageId uint) CheckOption {
return func(c *checkConfig) {
c.pageId = pageId
}
Expand Down
6 changes: 3 additions & 3 deletions tx_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestTx_Check_CorruptPage(t *testing.T) {
var cErrs []error

t.Log("Check corrupted page.")
errChan := tx.Check(bbolt.WithPageId(uint64(victimPageId)))
errChan := tx.Check(bbolt.WithPageId(uint(victimPageId)))
for cErr := range errChan {
cErrs = append(cErrs, cErr)
}
Expand All @@ -44,7 +44,7 @@ func TestTx_Check_CorruptPage(t *testing.T) {
t.Log("Check valid pages.")
cErrs = cErrs[:0]
for _, pgId := range validPageIds {
errChan = tx.Check(bbolt.WithPageId(uint64(pgId)))
errChan = tx.Check(bbolt.WithPageId(uint(pgId)))
for cErr := range errChan {
cErrs = append(cErrs, cErr)
}
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestTx_Check_WithNestBucket(t *testing.T) {
vErr := db.View(func(tx *bbolt.Tx) error {
var cErrs []error

errChan := tx.Check(bbolt.WithPageId(uint64(bucketRootPageId)))
errChan := tx.Check(bbolt.WithPageId(uint(bucketRootPageId)))
for cErr := range errChan {
cErrs = append(cErrs, cErr)
}
Expand Down

0 comments on commit bba77f5

Please sign in to comment.