aboutsummaryrefslogtreecommitdiffstats
path: root/light/nodeset.go
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2019-03-26 22:48:31 +0800
committerFelix Lange <fjl@users.noreply.github.com>2019-03-26 22:48:31 +0800
commit59e195324643e8f3a18396b529e3350e550fdecc (patch)
tree80850abf25e40b1e3a5bd359dacc654b651d8c73 /light/nodeset.go
parentdf717abc999add34c5725ab86dce1fcee968ca10 (diff)
downloadgo-tangerine-59e195324643e8f3a18396b529e3350e550fdecc.tar
go-tangerine-59e195324643e8f3a18396b529e3350e550fdecc.tar.gz
go-tangerine-59e195324643e8f3a18396b529e3350e550fdecc.tar.bz2
go-tangerine-59e195324643e8f3a18396b529e3350e550fdecc.tar.lz
go-tangerine-59e195324643e8f3a18396b529e3350e550fdecc.tar.xz
go-tangerine-59e195324643e8f3a18396b529e3350e550fdecc.tar.zst
go-tangerine-59e195324643e8f3a18396b529e3350e550fdecc.zip
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.
Diffstat (limited to 'light/nodeset.go')
-rw-r--r--light/nodeset.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/light/nodeset.go b/light/nodeset.go
index 3b556108a..a8bf4f6c6 100644
--- a/light/nodeset.go
+++ b/light/nodeset.go
@@ -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