| 355 | } |
| 356 | |
| 357 | bool ScannerImpl::NextRow(tera::ResultStream* result_stream, const std::string& table_name, |
| 358 | bool* finished, std::string* row, std::vector<Column>* notify_columns) { |
| 359 | tera::ErrorCode err; |
| 360 | |
| 361 | // check finish |
| 362 | if (result_stream->Done(&err)) { |
| 363 | *finished = true; |
| 364 | return false; |
| 365 | } |
| 366 | |
| 367 | if (tera::ErrorCode::kOK != err.GetType()) { |
| 368 | LOG(ERROR) << "scanning failed" << err.ToString(); |
| 369 | return false; |
| 370 | } |
| 371 | |
| 372 | notify_columns->clear(); |
| 373 | *row = result_stream->RowName(); |
| 374 | |
| 375 | // scan cell |
| 376 | while (!result_stream->Done(&err) && result_stream->RowName() == *row) { |
| 377 | std::string observe_cf; |
| 378 | std::string observe_qu; |
| 379 | if (quit_) { |
| 380 | return false; |
| 381 | } |
| 382 | |
| 383 | if (!ParseNotifyQualifier(result_stream->Qualifier(), &observe_cf, &observe_qu)) { |
| 384 | LOG(WARNING) << "parse notify qualifier failed: " << result_stream->Qualifier(); |
| 385 | result_stream->Next(); |
| 386 | continue; |
| 387 | } |
| 388 | |
| 389 | Column notify_column = {table_name, observe_cf, observe_qu}; |
| 390 | |
| 391 | notify_columns->push_back(notify_column); |
| 392 | result_stream->Next(); |
| 393 | } |
| 394 | return true; |
| 395 | } |
| 396 | |
| 397 | // example qualifier: C:url |
| 398 | // C: cf; column: url; |