diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 84018e83f7aeb..05d408da79a2f 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -35,7 +35,7 @@ import ( // ReadCanonicalHash retrieves the hash assigned to a canonical block number. func ReadCanonicalHash(db ethdb.Reader, number uint64) common.Hash { var data []byte - db.AtomicReadAncients(func(reader ethdb.AncientReader) error { + db.ReadAncients(func(reader ethdb.AncientReader) error { data, _ = reader.Ancient(freezerHashTable, number) if len(data) == 0 { // Get it by hash from leveldb @@ -299,7 +299,7 @@ func WriteFastTxLookupLimit(db ethdb.KeyValueWriter, number uint64) { // ReadHeaderRLP retrieves a block header in its raw RLP database encoding. func ReadHeaderRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue { var data []byte - db.AtomicReadAncients(func(reader ethdb.AncientReader) error { + db.ReadAncients(func(reader ethdb.AncientReader) error { // First try to look up the data in ancient database. Extra hash // comparison is necessary since ancient database only maintains // the canonical data. @@ -393,7 +393,7 @@ func ReadBodyRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue // comparison is necessary since ancient database only maintains // the canonical data. var data []byte - db.AtomicReadAncients(func(reader ethdb.AncientReader) error { + db.ReadAncients(func(reader ethdb.AncientReader) error { // Check if the data is in ancients if isCanon(reader, number, hash) { data, _ = reader.Ancient(freezerBodiesTable, number) @@ -410,7 +410,7 @@ func ReadBodyRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue // block at number, in RLP encoding. func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue { var data []byte - db.AtomicReadAncients(func(reader ethdb.AncientReader) error { + db.ReadAncients(func(reader ethdb.AncientReader) error { data, _ = reader.Ancient(freezerBodiesTable, number) if len(data) > 0 { return nil @@ -473,7 +473,7 @@ func DeleteBody(db ethdb.KeyValueWriter, hash common.Hash, number uint64) { // ReadTdRLP retrieves a block's total difficulty corresponding to the hash in RLP encoding. func ReadTdRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue { var data []byte - db.AtomicReadAncients(func(reader ethdb.AncientReader) error { + db.ReadAncients(func(reader ethdb.AncientReader) error { // Check if the data is in ancients if isCanon(reader, number, hash) { data, _ = reader.Ancient(freezerDifficultyTable, number) @@ -533,7 +533,7 @@ func HasReceipts(db ethdb.Reader, hash common.Hash, number uint64) bool { // ReadReceiptsRLP retrieves all the transaction receipts belonging to a block in RLP encoding. func ReadReceiptsRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue { var data []byte - db.AtomicReadAncients(func(reader ethdb.AncientReader) error { + db.ReadAncients(func(reader ethdb.AncientReader) error { // Check if the data is in ancients if isCanon(reader, number, hash) { data, _ = reader.Ancient(freezerReceiptTable, number) diff --git a/core/rawdb/database.go b/core/rawdb/database.go index 779efe8a58268..f7c7f5d3363f2 100644 --- a/core/rawdb/database.go +++ b/core/rawdb/database.go @@ -119,7 +119,7 @@ func (db *nofreezedb) Sync() error { return errNotSupported } -func (db *nofreezedb) AtomicReadAncients(fn func(reader ethdb.AncientReader) error) (err error) { +func (db *nofreezedb) ReadAncients(fn func(reader ethdb.AncientReader) error) (err error) { // Unlike other ancient-related methods, this method does not return // errNotSupported when invoked. // The reason for this is that the caller might want to do several things: diff --git a/core/rawdb/freezer.go b/core/rawdb/freezer.go index 3d76bba779ba1..e19c202adc843 100644 --- a/core/rawdb/freezer.go +++ b/core/rawdb/freezer.go @@ -232,9 +232,9 @@ func (f *freezer) AncientSize(kind string) (uint64, error) { return 0, errUnknownTable } -// AtomicReadAncients runs the given read operation while ensuring that no writes take place +// ReadAncients runs the given read operation while ensuring that no writes take place // on the underlying freezer. -func (f *freezer) AtomicReadAncients(fn func(ethdb.AncientReader) error) (err error) { +func (f *freezer) ReadAncients(fn func(ethdb.AncientReader) error) (err error) { f.writeLock.RLock() defer f.writeLock.RUnlock() return fn(f) diff --git a/core/rawdb/table.go b/core/rawdb/table.go index 69d2d0cd0f6a6..91fc31b660d67 100644 --- a/core/rawdb/table.go +++ b/core/rawdb/table.go @@ -85,8 +85,8 @@ func (t *table) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, erro return t.db.ModifyAncients(fn) } -func (t *table) AtomicReadAncients(fn func(reader ethdb.AncientReader) error) (err error) { - return t.db.AtomicReadAncients(fn) +func (t *table) ReadAncients(fn func(reader ethdb.AncientReader) error) (err error) { + return t.db.ReadAncients(fn) } // TruncateAncients is a noop passthrough that just forwards the request to the underlying diff --git a/ethdb/database.go b/ethdb/database.go index 8f9a4d4f2986d..75921edd49e95 100644 --- a/ethdb/database.go +++ b/ethdb/database.go @@ -93,9 +93,9 @@ type AncientReader interface { // AncientBatchReader is the interface for 'batched' or 'atomic' reading. type AncientBatchReader interface { AncientReader - // AtomicReadAncients runs the given read operation while ensuring that no writes take place + // ReadAncients runs the given read operation while ensuring that no writes take place // on the underlying freezer. - AtomicReadAncients(fn func(AncientReader) error) (err error) + ReadAncients(fn func(AncientReader) error) (err error) } // AncientWriter contains the methods required to write to immutable ancient data.