ethdb, core: implement delete for db batch (#17101)

This commit is contained in:
gary rong
2018-07-02 16:16:30 +08:00
committed by Péter Szilágyi
parent fdfd6d3c39
commit a4a2343cdc
6 changed files with 51 additions and 14 deletions

View File

@ -25,12 +25,17 @@ type Putter interface {
Put(key []byte, value []byte) error
}
// Deleter wraps the database delete operation supported by both batches and regular databases.
type Deleter interface {
Delete(key []byte) error
}
// Database wraps all database operations. All methods are safe for concurrent use.
type Database interface {
Putter
Deleter
Get(key []byte) ([]byte, error)
Has(key []byte) (bool, error)
Delete(key []byte) error
Close()
NewBatch() Batch
}
@ -39,6 +44,7 @@ type Database interface {
// when Write is called. Batch cannot be used concurrently.
type Batch interface {
Putter
Deleter
ValueSize() int // amount of data in the batch
Write() error
// Reset resets the batch for reuse