// Scan implements the MVCCStore interface.
Scan implements the MVCCStore interface.
// Scan implements the MVCCStore interface .
func (mvcc *MVCCRocksDB) Scan(startKey, endKey []byte, limit int, startTS uint64, isoLevel kvrpcpb.IsolationLevel, resolvedLocks []uint64) []Pair {
	mvcc.mu.RLock()
	defer mvcc.mu.RUnlock()
	iter, currKey, err := newScanIterator(mvcc.db, startKey, endKey)
	defer iter.Close()
	if err != nil {
		logutil.BgLogger().Error("scan new iterator fail", zap.Error(err))
		return nil
	}
	ok := true
	var pairs []Pair
	for len(pairs) < limit && ok {
		value, err := getValue(iter, currKey, startTS, isoLevel, resolvedLocks)
		if err != nil {
			pairs = append(pairs, Pair{
				Key: currKey,
				Err: errors.Trace(err),
			})
		}
		if value != nil {
			pairs = append(pairs, Pair{
				Key:   currKey,
				Value: value,
			})
		}
		skip := skipDecoder{currKey}
		ok, err = skip.Decode(iter)
		if err != nil {
			logutil.BgLogger().Error("seek to next key error", zap.Error(err))
			break
		}
		currKey = skip.currKey
	}
	return pairs
}
func ( mvcc * MVCCRocksDB ) Scan ( startKey , endKey [ ] byte , limit int , startTS uint64 , isoLevel kvrpcpb . IsolationLevel , resolvedLocks [ ] uint64 ) [ ] Pair { mvcc . mu . RLock ( ) defer mvcc . mu . RUnlock ( ) iter , currKey , err := newScanIterator ( mvcc . db , startKey , endKey ) defer iter . Close ( ) if err != nil { logutil . BgLogger ( ) . Error ( " " , zap . Error ( err ) ) return nil } ok := true var pairs [ ] Pair for len ( pairs ) < limit && ok { value , err := getValue ( iter , currKey , startTS , isoLevel , resolvedLocks ) if err != nil { pairs = append ( pairs , Pair { Key : currKey , Err : errors . Trace ( err ) , } ) } if value != nil { pairs = append ( pairs , Pair { Key : currKey , Value : value , } ) } skip := skipDecoder { currKey } ok , err = skip . Decode ( iter ) if err != nil { logutil . BgLogger ( ) . Error ( " " , zap . Error ( err ) ) break } currKey = skip . currKey } return pairs }
Scan implements the MVCCStore interface.
Scan implements the MVCCStore interface .