// ScanLock implements the MVCCStore interface.
ScanLock implements the MVCCStore interface.
// ScanLock implements the MVCCStore interface .
func (mvcc *MVCCRocksDB) ScanLock(startKey, endKey []byte, maxTS uint64) ([]*kvrpcpb.LockInfo, error) {
	mvcc.mu.RLock()
	defer mvcc.mu.RUnlock()
	iter, currKey, err := newScanIterator(mvcc.db, startKey, endKey)
	defer iter.Close()
	if err != nil {
		return nil, errors.Trace(err)
	}
	var locks []*kvrpcpb.LockInfo
	for iter.Valid() {
		dec := lockDecoder{expectKey: currKey}
		ok, err := dec.Decode(iter)
		if err != nil {
			return nil, errors.Trace(err)
		}
		if ok && dec.lock.startTS <= maxTS {
			locks = append(locks, &kvrpcpb.LockInfo{
				PrimaryLock: dec.lock.primary,
				LockVersion: dec.lock.startTS,
				Key:         currKey,
			})
		}
		skip := skipDecoder{currKey: currKey}
		_, err = skip.Decode(iter)
		if err != nil {
			return nil, errors.Trace(err)
		}
		currKey = skip.currKey
	}
	return locks, nil
}
func ( mvcc * MVCCRocksDB ) ScanLock ( startKey , endKey [ ] byte , maxTS uint64 ) ( [ ] * kvrpcpb . LockInfo , error ) { mvcc . mu . RLock ( ) defer mvcc . mu . RUnlock ( ) iter , currKey , err := newScanIterator ( mvcc . db , startKey , endKey ) defer iter . Close ( ) if err != nil { return nil , errors . Trace ( err ) } var locks [ ] * kvrpcpb . LockInfo for iter . Valid ( ) { dec := lockDecoder { expectKey : currKey } ok , err := dec . Decode ( iter ) if err != nil { return nil , errors . Trace ( err ) } if ok && dec . lock . startTS <= maxTS { locks = append ( locks , & kvrpcpb . LockInfo { PrimaryLock : dec . lock . primary , LockVersion : dec . lock . startTS , Key : currKey , } ) } skip := skipDecoder { currKey : currKey } _ , err = skip . Decode ( iter ) if err != nil { return nil , errors . Trace ( err ) } currKey = skip . currKey } return locks , nil }
ScanLock implements the MVCCStore interface.
ScanLock implements the MVCCStore interface .