dbreader

package
Version: v0.0.0-...-4333e8d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ScanBreak = errors.New("scan break")

ScanBreak is returnd by ScanFunc to break the scan loop.

Functions

func NewIterator

func NewIterator(txn *badger.Txn, reverse bool, startKey, endKey []byte) *badger.Iterator

Types

type BatchGetFunc

type BatchGetFunc = func(key, value []byte, err error)

type DBReader

type DBReader struct {
	StartKey []byte
	EndKey   []byte
	// 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

func NewDBReader(startKey, endKey []byte, txn *badger.Txn) *DBReader

func (*DBReader) BatchGet

func (r *DBReader) BatchGet(keys [][]byte, startTS uint64, f BatchGetFunc)

func (*DBReader) Close

func (r *DBReader) Close()

func (*DBReader) Get

func (r *DBReader) Get(key []byte, startTS uint64) ([]byte, error)

func (*DBReader) GetExtraIter

func (r *DBReader) GetExtraIter() *badger.Iterator

func (*DBReader) GetIter

func (r *DBReader) GetIter() *badger.Iterator

func (*DBReader) GetKeyByStartTs

func (r *DBReader) GetKeyByStartTs(startKey, endKey []byte, startTs uint64) ([]byte, error)

func (*DBReader) GetMvccInfoByKey

func (r *DBReader) GetMvccInfoByKey(key []byte, isRowKey bool, mvccInfo *kvrpcpb.MvccInfo) error

GetMvccInfoByKey fills MvccInfo reading committed keys from db

func (*DBReader) GetTxn

func (r *DBReader) GetTxn() *badger.Txn

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).

func (*DBReader) Scan

func (r *DBReader) Scan(startKey, endKey []byte, limit int, startTS uint64, proc ScanProcessor) error

type ScanFunc

type ScanFunc = func(key, value []byte) error

ScanFunc accepts key and value, should not keep reference to them. Returns ScanBreak will break the scan loop.

type ScanProcessor

type ScanProcessor interface {
	// Process accepts key and value, should not keep reference to them.
	// Returns ScanBreak 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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL