talent-plan-tinykv/kv/transaction/mvcc/scanner.go
Connor1996 ab9b6a8eae add scanner framework
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
2020-04-30 15:31:26 +08:00

25 lines
824 B
Go

package mvcc
// Scanner is used for reading multiple sequential key/value pairs from the storage layer. It is aware of the implementation
// of the storage layer and returns results suitable for users.
// Invariant: either the scanner is finished and cannot be used, or it is ready to return a value immediately.
type Scanner struct {
// Your Data Here (4C).
}
// NewScanner creates a new scanner ready to read from the snapshot in txn.
func NewScanner(startKey []byte, txn *MvccTxn) *Scanner {
// Your Code Here (4C).
return nil
}
func (scan *Scanner) Close() {
// Your Code Here (4C).
}
// Next returns the next key/value pair from the scanner. If the scanner is exhausted, then it will return `nil, nil, nil`.
func (scan *Scanner) Next() ([]byte, []byte, error) {
// Your Code Here (4C).
return nil, nil, nil
}