func (m *memDbBuffer) Reset() {
	m.db.Reset()
}
Reset cleanup the MemBuffer.
package kv
import (
	"bytes"
	"context"
	"sync/atomic"
	"github.com/pingcap/errors"
	"github.com/pingcap/tidb/kv/memdb"
)
type memDbBuffer struct {
	db              *memdb.DB
	entrySizeLimit  int
	bufferSizeLimit uint64
}
type memDbIter struct {
	iter    memdb.Iterator
	start   []byte
	end     []byte
	reverse bool
}
func NewMemDbBuffer(initBlockSize int) MemBuffer {
	return &memDbBuffer{
		db:              memdb.New(initBlockSize),
		entrySizeLimit:  TxnEntrySizeLimit,
		bufferSizeLimit: atomic.LoadUint64(&TxnTotalSizeLimit),
	}
}
func (m *memDbBuffer) Iter(k Key, upperBound Key) (Iterator, error) {
	i := &memDbIter{
		iter:    m.db.NewIterator(),
		start:   k,
		end:     upperBound,
		reverse: false,
	}
	if k == nil {
		i.iter.SeekToFirst()
	} else {
		i.iter.Seek(k)
	}
	return i, nil
}
func (m *memDbBuffer) SetCap(cap int) {
}
func (m *memDbBuffer) IterReverse(k Key) (Iterator, error) {
	i := &memDbIter{
		iter:    m.db.NewIterator(),
		end:     k,
		reverse: true,
	}
	if k == nil {
		i.iter.SeekToLast()
	} else {
		i.iter.SeekForExclusivePrev(k)
	}
	return i, nil
}
func (m *memDbBuffer) Get(ctx context.Context, k Key) ([]byte, error) {
	v := m.db.Get(k)
	if v == nil {
		return nil, ErrNotExist
	}
	return v, nil
}
func (m *memDbBuffer) Set(k Key, v []byte) error {
	if len(v) == 0 {
		return errors.Trace(ErrCannotSetNilValue)
	}
	if len(k)+len(v) > m.entrySizeLimit {
		return ErrEntryTooLarge.GenWithStackByArgs(m.entrySizeLimit, len(k)+len(v))
	}
	m.db.Put(k, v)
	if m.Size() > int(m.bufferSizeLimit) {
		return ErrTxnTooLarge.GenWithStackByArgs(m.Size())
	}
	return nil
}
func (m *memDbBuffer) Delete(k Key) error {
	m.db.Put(k, nil)
	return nil
}
func (m *memDbBuffer) Size() int {
	return m.db.Size()
}
func (m *memDbBuffer) Len() int {
	return m.db.Len()
}