Skip to content

Commit

Permalink
all: rename offSet to offset
Browse files Browse the repository at this point in the history
Signed-off-by: jsvisa <delweng@gmail.com>
  • Loading branch information
jsvisa committed Apr 5, 2024
1 parent d3f1fe9 commit 271103c
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions core/rawdb/chain_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func InitDatabaseFromFreezer(db ethdb.Database) {
start = time.Now()
logged = start.Add(-7 * time.Second) // Unindex during import is fast, don't double log
hash common.Hash
offset = db.AncientOffSet()
offset = db.AncientOffset()
)

for i := uint64(0) + offset; i < frozen+offset; {
Expand Down Expand Up @@ -108,7 +108,7 @@ func iterateTransactions(db ethdb.Database, from uint64, to uint64, reverse bool
rlp rlp.RawValue
}

if offset := db.AncientOffSet(); offset > from {
if offset := db.AncientOffset(); offset > from {
from = offset
}

Expand Down Expand Up @@ -207,7 +207,7 @@ func iterateTransactions(db ethdb.Database, from uint64, to uint64, reverse bool
// signal received.
func indexTransactions(db ethdb.Database, from uint64, to uint64, interrupt chan struct{}, hook func(uint64) bool) {
// adjust range boundary for pruned block
if offset := db.AncientOffSet(); offset > from {
if offset := db.AncientOffset(); offset > from {
from = offset
}
// short circuit for invalid range
Expand Down Expand Up @@ -310,7 +310,7 @@ func indexTransactionsForTesting(db ethdb.Database, from uint64, to uint64, inte
// signal received.
func unindexTransactions(db ethdb.Database, from uint64, to uint64, interrupt chan struct{}, hook func(uint64) bool) {
// adjust range boundary for pruned block
if offset := db.AncientOffSet(); offset > from {
if offset := db.AncientOffset(); offset > from {
from = offset
}
// short circuit for invalid range
Expand Down
8 changes: 4 additions & 4 deletions core/rawdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ func (db *nofreezedb) ItemAmountInAncient() (uint64, error) {
return 0, errNotSupported
}

// AncientOffSet returns an error as we don't have a backing chain freezer.
func (db *nofreezedb) AncientOffSet() uint64 {
// AncientOffset returns an error as we don't have a backing chain freezer.
func (db *nofreezedb) AncientOffset() uint64 {
return 0
}

Expand Down Expand Up @@ -203,14 +203,14 @@ func ReadOffsetOfLastAncientFreezer(db ethdb.KeyValueReader) uint64 {
// WriteOffsetOfCurrentAncientFreezer writes current offset of ancient freezer into ethdb
func WriteOffsetOfCurrentAncientFreezer(db ethdb.KeyValueWriter, offset uint64) {
if err := db.Put(offsetOfCurrentAncientFreezer, new(big.Int).SetUint64(offset).Bytes()); err != nil {
log.Crit("Failed to store offSetOfAncientFreezer", "err", err)
log.Crit("Failed to store offsetOfAncientFreezer", "err", err)
}
}

// WriteOffsetOfLastAncientFreezer writes the last offset of ancient freezer into ethdb
func WriteOffsetOfLastAncientFreezer(db ethdb.KeyValueWriter, offset uint64) {
if err := db.Put(offsetOfLastAncientFreezer, new(big.Int).SetUint64(offset).Bytes()); err != nil {
log.Crit("Failed to store offSetOfAncientFreezer", "err", err)
log.Crit("Failed to store offsetOfAncientFreezer", "err", err)
}
}

Expand Down
6 changes: 3 additions & 3 deletions core/rawdb/freezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ func (f *Freezer) Ancients() (uint64, error) {

// ItemAmountInAncient returns the actual length of current ancientDB.
func (f *Freezer) ItemAmountInAncient() (uint64, error) {
return f.frozen.Load() - f.AncientOffSet(), nil
return f.frozen.Load() - f.AncientOffset(), nil
}

// AncientOffSet returns the offset of current ancientDB.
func (f *Freezer) AncientOffSet() uint64 {
// AncientOffset returns the offset of current ancientDB.
func (f *Freezer) AncientOffset() uint64 {
return atomic.LoadUint64(&f.offset)
}

Expand Down
4 changes: 2 additions & 2 deletions core/rawdb/freezer_resettable.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ func (f *ResettableFreezer) ItemAmountInAncient() (uint64, error) {
return f.Ancients()
}

// AncientOffSet returns the offset of current ancientDB.
func (f *ResettableFreezer) AncientOffSet() uint64 {
// AncientOffset returns the offset of current ancientDB.
func (f *ResettableFreezer) AncientOffset() uint64 {
return 0
}

Expand Down
4 changes: 2 additions & 2 deletions core/rawdb/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ var (
fastTxLookupLimitKey = []byte("FastTransactionLookupLimit")

// offset of the new updated ancientDB.
offsetOfCurrentAncientFreezer = []byte("offSetOfCurrentAncientFreezer")
offsetOfCurrentAncientFreezer = []byte("offsetOfCurrentAncientFreezer")

// offset of the ancientDB before updated version.
offsetOfLastAncientFreezer = []byte("offSetOfLastAncientFreezer")
offsetOfLastAncientFreezer = []byte("offsetOfLastAncientFreezer")

// badBlockKey tracks the list of bad blocks seen by local
badBlockKey = []byte("InvalidBlock")
Expand Down
6 changes: 3 additions & 3 deletions core/rawdb/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ func (t *table) ItemAmountInAncient() (uint64, error) {
return t.db.ItemAmountInAncient()
}

// AncientOffSet returns the offset of current ancientDB.
func (t *table) AncientOffSet() uint64 {
return t.db.AncientOffSet()
// AncientOffset returns the offset of current ancientDB.
func (t *table) AncientOffset() uint64 {
return t.db.AncientOffset()
}

// TruncateHead is a noop passthrough that just forwards the request to the underlying
Expand Down
12 changes: 6 additions & 6 deletions eth/filters/IDatabase.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ethdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ type AncientReaderOp interface {
// ItemAmountInAncient returns the actual length of current ancientDB.
ItemAmountInAncient() (uint64, error)

// AncientOffSet returns the offset of current ancientDB.
AncientOffSet() uint64
// AncientOffset returns the offset of current ancientDB.
AncientOffset() uint64
}

// AncientReader is the extended ancient reader interface including 'batched' or 'atomic' reading.
Expand Down
4 changes: 2 additions & 2 deletions ethdb/remotedb/remotedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func (db *Database) ItemAmountInAncient() (uint64, error) {
panic("not supported")
}

// AncientOffSet returns an error as we don't have a backing chain freezer.
func (db *Database) AncientOffSet() uint64 {
// AncientOffset returns an error as we don't have a backing chain freezer.
func (db *Database) AncientOffset() uint64 {
panic("not supported")
}

Expand Down

0 comments on commit 271103c

Please sign in to comment.