Documentation ¶
Index ¶
- Variables
- func NewIterator(txn *badger.Txn, reverse bool, startKey, endKey []byte) *badger.Iterator
- type BatchGetFunc
- type DBReader
- func (r *DBReader) BatchGet(keys [][]byte, startTS uint64, f BatchGetFunc)
- func (r *DBReader) CheckWriteItemForRcCheckTSRead(readTS uint64, item *badger.Item) error
- func (r *DBReader) Close()
- func (r *DBReader) Get(key []byte, startTS uint64) ([]byte, error)
- func (r *DBReader) GetExtraIter() *badger.Iterator
- func (r *DBReader) GetIter() *badger.Iterator
- func (r *DBReader) GetKeyByStartTs(startKey, endKey []byte, startTs uint64) ([]byte, error)
- func (r *DBReader) GetMvccInfoByKey(key []byte, _ bool, mvccInfo *kvrpcpb.MvccInfo) error
- func (r *DBReader) GetTxn() *badger.Txn
- func (r *DBReader) ReverseScan(startKey, endKey []byte, limit int, startTS uint64, proc ScanProcessor) error
- func (r *DBReader) Scan(startKey, endKey []byte, limit int, startTS uint64, proc ScanProcessor) error
- type ScanFunc
- type ScanProcessor
Constants ¶
This section is empty.
Variables ¶
var ErrScanBreak = errors.New("scan break error")
ErrScanBreak is returned by ScanFunc to break the scan loop.
Functions ¶
Types ¶
type BatchGetFunc ¶
BatchGetFunc defines a batch get function.
type DBReader ¶
type DBReader struct { StartKey []byte EndKey []byte RcCheckTS bool // contains filtered or unexported fields }
DBReader reads data from DB, for read-only requests, the locks must already be checked before DBReader is created.
func NewDBReader ¶
NewDBReader returns a new *DBReader.
func (*DBReader) BatchGet ¶
func (r *DBReader) BatchGet(keys [][]byte, startTS uint64, f BatchGetFunc)
BatchGet batch gets keys.
func (*DBReader) CheckWriteItemForRcCheckTSRead ¶
CheckWriteItemForRcCheckTSRead checks the data version if `RcCheckTS` isolation level is used.
func (*DBReader) GetExtraIter ¶
GetExtraIter returns the extra *badger.Iterator of a *DBReader.
func (*DBReader) GetKeyByStartTs ¶
GetKeyByStartTs gets a key with the start ts.
func (*DBReader) GetMvccInfoByKey ¶
GetMvccInfoByKey fills MvccInfo reading committed keys from db
func (*DBReader) ReverseScan ¶
func (r *DBReader) ReverseScan(startKey, endKey []byte, limit int, startTS uint64, proc ScanProcessor) error
ReverseScan implements the MVCCStore interface. The search range is [startKey, endKey).
type ScanFunc ¶
ScanFunc accepts key and value, should not keep reference to them. Returns ErrScanBreak will break the scan loop.
type ScanProcessor ¶
type ScanProcessor interface { // Process accepts key and value, should not keep reference to them. // Returns ErrScanBreak will break the scan loop. Process(key, value []byte) error // SkipValue returns if we can skip the value. SkipValue() bool }
ScanProcessor process the key/value pair.