| 85 | } |
| 86 | |
| 87 | bool SetScanner(const Key& start, const Key& end) { |
| 88 | if (scanner_ != NULL) { |
| 89 | delete scanner_; |
| 90 | } |
| 91 | tera::ErrorCode err; |
| 92 | tera::ScanDescriptor desc(start); |
| 93 | desc.SetEnd(end); |
| 94 | |
| 95 | if ((scanner_ = table_->Scan(desc, &err)) == NULL) { |
| 96 | LOG(ERROR) << "fail to scan the table, reason:" << err.GetReason(); |
| 97 | return false; |
| 98 | } |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | bool NextPair(KVPair* pair) { |
| 103 | if (scanner_ == NULL) { |