added Close() method to KVBatch interface
This commit is contained in:
parent
2b947e8c14
commit
70105477cf
@ -51,3 +51,7 @@ func (b *EmulatedBatch) Merge(key, val []byte) {
|
|||||||
func (b *EmulatedBatch) Reset() {
|
func (b *EmulatedBatch) Reset() {
|
||||||
b.Ops = b.Ops[:0]
|
b.Ops = b.Ops[:0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *EmulatedBatch) Close() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -36,3 +36,10 @@ func (b *Batch) Reset() {
|
|||||||
b.batch.Reset()
|
b.batch.Reset()
|
||||||
b.merge = store.NewEmulatedMerge(b.store.mo)
|
b.merge = store.NewEmulatedMerge(b.store.mo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Batch) Close() error {
|
||||||
|
b.batch.Reset()
|
||||||
|
b.batch = nil
|
||||||
|
b.merge = nil
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -118,4 +118,7 @@ type KVBatch interface {
|
|||||||
|
|
||||||
// Reset frees resources for this batch and allows reuse
|
// Reset frees resources for this batch and allows reuse
|
||||||
Reset()
|
Reset()
|
||||||
|
|
||||||
|
// Close frees resources
|
||||||
|
Close() error
|
||||||
}
|
}
|
||||||
|
@ -24,3 +24,9 @@ func (b *Batch) Merge(key, val []byte) {
|
|||||||
func (b *Batch) Reset() {
|
func (b *Batch) Reset() {
|
||||||
b.o.Reset()
|
b.o.Reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Batch) Close() error {
|
||||||
|
err := b.o.Close()
|
||||||
|
b.o = nil
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
@ -84,6 +84,7 @@ func (i *batch) Set(key, val []byte) {}
|
|||||||
func (i *batch) Delete(key []byte) {}
|
func (i *batch) Delete(key []byte) {}
|
||||||
func (i *batch) Merge(key, val []byte) {}
|
func (i *batch) Merge(key, val []byte) {}
|
||||||
func (i *batch) Reset() {}
|
func (i *batch) Reset() {}
|
||||||
|
func (i *batch) Close() error { return nil }
|
||||||
|
|
||||||
type writer struct{}
|
type writer struct{}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user