mirror of
https://github.com/talent-plan/tinykv.git
synced 2025-03-28 21:10:23 +08:00
25 lines
824 B
Go
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
|
|
}
|