mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core, eth, trie: rename functions
This commit is contained in:
parent
c5890605b3
commit
470cd6098e
5 changed files with 18 additions and 18 deletions
|
|
@ -822,7 +822,7 @@ func (bc *BlockChain) SnapSyncCommitHead(hash common.Hash) error {
|
||||||
// Reset the trie database with the fresh snap synced state.
|
// Reset the trie database with the fresh snap synced state.
|
||||||
root := block.Root()
|
root := block.Root()
|
||||||
if bc.triedb.Scheme() == rawdb.PathScheme {
|
if bc.triedb.Scheme() == rawdb.PathScheme {
|
||||||
if err := bc.triedb.Activate(root); err != nil {
|
if err := bc.triedb.Enable(root); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -403,7 +403,7 @@ func (d *Downloader) synchronise(id string, hash common.Hash, td, ttd *big.Int,
|
||||||
// subsequent state reads, explicitly disable the trie database and state
|
// subsequent state reads, explicitly disable the trie database and state
|
||||||
// syncer is responsible to address and correct any state missing.
|
// syncer is responsible to address and correct any state missing.
|
||||||
if d.blockchain.TrieDB().Scheme() == rawdb.PathScheme {
|
if d.blockchain.TrieDB().Scheme() == rawdb.PathScheme {
|
||||||
if err := d.blockchain.TrieDB().Deactivate(); err != nil {
|
if err := d.blockchain.TrieDB().Disable(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -273,27 +273,27 @@ func (db *Database) Recoverable(root common.Hash) (bool, error) {
|
||||||
return pdb.Recoverable(root), nil
|
return pdb.Recoverable(root), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deactivate disables the database and invalidates all available state layers
|
// Disable deactivates the database and invalidates all available state layers
|
||||||
// as stale to prevent access to the persistent state, which is in the syncing
|
// as stale to prevent access to the persistent state, which is in the syncing
|
||||||
// stage.
|
// stage.
|
||||||
//
|
//
|
||||||
// It's only supported by path-based database and will return an error for others.
|
// It's only supported by path-based database and will return an error for others.
|
||||||
func (db *Database) Deactivate() error {
|
func (db *Database) Disable() error {
|
||||||
pdb, ok := db.backend.(*pathdb.Database)
|
pdb, ok := db.backend.(*pathdb.Database)
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("not supported")
|
return errors.New("not supported")
|
||||||
}
|
}
|
||||||
return pdb.Deactivate()
|
return pdb.Disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activate re-enables database and resets the state tree with the provided.
|
// Enable activates database and resets the state tree with the provided persistent
|
||||||
// persistent state root once the state sync is finished.
|
// state root once the state sync is finished.
|
||||||
func (db *Database) Activate(root common.Hash) error {
|
func (db *Database) Enable(root common.Hash) error {
|
||||||
pdb, ok := db.backend.(*pathdb.Database)
|
pdb, ok := db.backend.(*pathdb.Database)
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("not supported")
|
return errors.New("not supported")
|
||||||
}
|
}
|
||||||
return pdb.Activate(root)
|
return pdb.Enable(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Journal commits an entire diff hierarchy to disk into a single journal entry.
|
// Journal commits an entire diff hierarchy to disk into a single journal entry.
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ func New(diskdb ethdb.Database, config *Config) *Database {
|
||||||
}
|
}
|
||||||
// Disable database in case node is still in the initial state sync stage.
|
// Disable database in case node is still in the initial state sync stage.
|
||||||
if rawdb.ReadSnapSyncStatusFlag(diskdb) == rawdb.StateSyncRunning && !db.readOnly {
|
if rawdb.ReadSnapSyncStatusFlag(diskdb) == rawdb.StateSyncRunning && !db.readOnly {
|
||||||
if err := db.Deactivate(); err != nil {
|
if err := db.Disable(); err != nil {
|
||||||
log.Crit("Failed to disable database", "err", err) // impossible to happen
|
log.Crit("Failed to disable database", "err", err) // impossible to happen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -241,10 +241,10 @@ func (db *Database) Commit(root common.Hash, report bool) error {
|
||||||
return db.tree.cap(root, 0)
|
return db.tree.cap(root, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deactivate disables the database and invalidates all available state layers
|
// Disable deactivates the database and invalidates all available state layers
|
||||||
// as stale to prevent access to the persistent state, which is in the syncing
|
// as stale to prevent access to the persistent state, which is in the syncing
|
||||||
// stage.
|
// stage.
|
||||||
func (db *Database) Deactivate() error {
|
func (db *Database) Disable() error {
|
||||||
db.lock.Lock()
|
db.lock.Lock()
|
||||||
defer db.lock.Unlock()
|
defer db.lock.Unlock()
|
||||||
|
|
||||||
|
|
@ -268,9 +268,9 @@ func (db *Database) Deactivate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activate re-enables database and resets the state tree with the provided.
|
// Enable activates database and resets the state tree with the provided persistent
|
||||||
// persistent state root once the state sync is finished.
|
// state root once the state sync is finished.
|
||||||
func (db *Database) Activate(root common.Hash) error {
|
func (db *Database) Enable(root common.Hash) error {
|
||||||
db.lock.Lock()
|
db.lock.Lock()
|
||||||
defer db.lock.Unlock()
|
defer db.lock.Unlock()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -444,13 +444,13 @@ func TestDisable(t *testing.T) {
|
||||||
defer tester.release()
|
defer tester.release()
|
||||||
|
|
||||||
_, stored := rawdb.ReadAccountTrieNode(tester.db.diskdb, nil)
|
_, stored := rawdb.ReadAccountTrieNode(tester.db.diskdb, nil)
|
||||||
if err := tester.db.Deactivate(); err != nil {
|
if err := tester.db.Disable(); err != nil {
|
||||||
t.Fatal("Failed to deactivate database")
|
t.Fatal("Failed to deactivate database")
|
||||||
}
|
}
|
||||||
if err := tester.db.Activate(types.EmptyRootHash); err == nil {
|
if err := tester.db.Enable(types.EmptyRootHash); err == nil {
|
||||||
t.Fatalf("Invalid activation should be rejected")
|
t.Fatalf("Invalid activation should be rejected")
|
||||||
}
|
}
|
||||||
if err := tester.db.Activate(stored); err != nil {
|
if err := tester.db.Enable(stored); err != nil {
|
||||||
t.Fatal("Failed to activate database")
|
t.Fatal("Failed to activate database")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue