mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
handle error
This commit is contained in:
parent
f671be40b4
commit
0cc283e747
1 changed files with 8 additions and 4 deletions
|
|
@ -523,17 +523,21 @@ type batch struct {
|
||||||
|
|
||||||
// Put inserts the given value into the batch for later committing.
|
// Put inserts the given value into the batch for later committing.
|
||||||
func (b *batch) Put(key, value []byte) error {
|
func (b *batch) Put(key, value []byte) error {
|
||||||
err := b.b.Set(key, value, nil)
|
if err := b.b.Set(key, value, nil); err != nil {
|
||||||
b.size += len(key) + len(value)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
b.size += len(key) + len(value)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Delete inserts the key removal into the batch for later committing.
|
// Delete inserts the key removal into the batch for later committing.
|
||||||
func (b *batch) Delete(key []byte) error {
|
func (b *batch) Delete(key []byte) error {
|
||||||
err := b.b.Delete(key, nil)
|
if err := b.b.Delete(key, nil); err != nil {
|
||||||
b.size += len(key)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
b.size += len(key)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// ValueSize retrieves the amount of data queued up for writing.
|
// ValueSize retrieves the amount of data queued up for writing.
|
||||||
func (b *batch) ValueSize() int {
|
func (b *batch) ValueSize() int {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue