mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
ethdb/memory: copy byte range
This commit is contained in:
parent
ad34d98cf1
commit
ce07496f18
1 changed files with 3 additions and 2 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
package memorydb
|
package memorydb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
@ -259,8 +260,8 @@ func (b *batch) Delete(key []byte) error {
|
||||||
// DeleteRange removes all keys in the range [start, end) from the batch for later committing.
|
// DeleteRange removes all keys in the range [start, end) from the batch for later committing.
|
||||||
func (b *batch) DeleteRange(start, end []byte) error {
|
func (b *batch) DeleteRange(start, end []byte) error {
|
||||||
b.writes = append(b.writes, keyvalue{
|
b.writes = append(b.writes, keyvalue{
|
||||||
rangeFrom: start,
|
rangeFrom: bytes.Clone(start),
|
||||||
rangeTo: end,
|
rangeTo: bytes.Clone(end),
|
||||||
delete: true,
|
delete: true,
|
||||||
})
|
})
|
||||||
b.size += len(start) + len(end)
|
b.size += len(start) + len(end)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue