diff options
author | gary rong <garyrong0905@gmail.com> | 2018-07-02 16:16:30 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-07-02 16:16:30 +0800 |
commit | a4a2343cdc1946e38da1aea1476642d1744c1354 (patch) | |
tree | c01c563224aaf34a1a391665bcca0b693b9cf0ce /ethdb/database.go | |
parent | fdfd6d3c3963b1b3459e4625458495458b11e8a7 (diff) | |
download | dexon-a4a2343cdc1946e38da1aea1476642d1744c1354.tar dexon-a4a2343cdc1946e38da1aea1476642d1744c1354.tar.gz dexon-a4a2343cdc1946e38da1aea1476642d1744c1354.tar.bz2 dexon-a4a2343cdc1946e38da1aea1476642d1744c1354.tar.lz dexon-a4a2343cdc1946e38da1aea1476642d1744c1354.tar.xz dexon-a4a2343cdc1946e38da1aea1476642d1744c1354.tar.zst dexon-a4a2343cdc1946e38da1aea1476642d1744c1354.zip |
ethdb, core: implement delete for db batch (#17101)
Diffstat (limited to 'ethdb/database.go')
-rw-r--r-- | ethdb/database.go | 10 |
1 files changed, 10 insertions, 0 deletions
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() } |