From bba77f5034dc46903708f3abcc7cd92351288df9 Mon Sep 17 00:00:00 2001 From: Ishan Tyagi Date: Sun, 25 Feb 2024 23:22:33 +0530 Subject: [PATCH] Address review comments.. Signed-off-by: ishan16696 --- tx_check.go | 8 ++++---- tx_check_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tx_check.go b/tx_check.go index 9fbf14cdb..2011f0ec4 100644 --- a/tx_check.go +++ b/tx_check.go @@ -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 } @@ -250,12 +250,12 @@ 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 @@ -263,7 +263,7 @@ func WithKVStringer(kvStringer KVStringer, pageID uint64) CheckOption { } // 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 } diff --git a/tx_check_test.go b/tx_check_test.go index a0ce69a29..af3610897 100644 --- a/tx_check_test.go +++ b/tx_check_test.go @@ -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) } @@ -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) } @@ -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) }