From a4a2343cdc1946e38da1aea1476642d1744c1354 Mon Sep 17 00:00:00 2001 From: gary rong Date: Mon, 2 Jul 2018 16:16:30 +0800 Subject: ethdb, core: implement delete for db batch (#17101) --- ethdb/database.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ethdb/database.go') diff --git a/ethdb/database.go b/ethdb/database.go index f4a5ce2c8..e32c912f9 100644 --- a/ethdb/database.go +++ b/ethdb/database.go @@ -388,6 +388,12 @@ func (b *ldbBatch) Put(key, value []byte) error { return nil } +func (b *ldbBatch) Delete(key []byte) error { + b.b.Delete(key) + b.size += 1 + return nil +} + func (b *ldbBatch) Write() error { return b.db.Write(b.b, nil) } @@ -453,6 +459,10 @@ func (tb *tableBatch) Put(key, value []byte) error { return tb.batch.Put(append([]byte(tb.prefix), key...), value) } +func (tb *tableBatch) Delete(key []byte) error { + return tb.batch.Delete(append([]byte(tb.prefix), key...)) +} + func (tb *tableBatch) Write() error { return tb.batch.Write() } -- cgit