core, ethdb, trie: mode dirty data to clean cache on flush (#19307)

This PR is a more advanced form of the dirty-to-clean cacher (#18995),
where we reuse previous database write batches as datasets to uncache,
saving a dirty-trie-iteration and a dirty-trie-rlp-reencoding per block.
This commit is contained in:
Martin Holst Swende
2019-03-26 15:48:31 +01:00
committed by Felix Lange
parent df717abc99
commit 59e1953246
12 changed files with 156 additions and 67 deletions

View File

@ -60,6 +60,15 @@ func (db *NodeSet) Put(key []byte, value []byte) error {
return nil
}
// Delete removes a node from the set
func (db *NodeSet) Delete(key []byte) error {
db.lock.Lock()
defer db.lock.Unlock()
delete(db.nodes, string(key))
return nil
}
// Get returns a stored node
func (db *NodeSet) Get(key []byte) ([]byte, error) {
db.lock.RLock()
@ -138,6 +147,11 @@ func (n *NodeList) Put(key []byte, value []byte) error {
return nil
}
// Delete panics as there's no reason to remove a node from the list.
func (n *NodeList) Delete(key []byte) error {
panic("not supported")
}
// DataSize returns the aggregated data size of nodes in the list
func (n NodeList) DataSize() int {
var size int