| 432 | } |
| 433 | |
| 434 | void TableImpl::CommitScan(ScanTask* scan_task, const std::string& server_addr) { |
| 435 | tabletnode::TabletNodeClient tabletnode_client(thread_pool_, server_addr); |
| 436 | ResultStreamImpl* stream = scan_task->stream; |
| 437 | ScanTabletRequest* request = scan_task->request; |
| 438 | ScanTabletResponse* response = scan_task->response; |
| 439 | response->Clear(); |
| 440 | |
| 441 | ScanDescImpl* impl = stream->GetScanDesc(); |
| 442 | request->set_sequence_id(last_sequence_id_++); |
| 443 | request->set_table_name(name_); |
| 444 | request->set_start(impl->GetStartRowKey()); |
| 445 | request->set_end(impl->GetEndRowKey()); |
| 446 | request->set_snapshot_id(impl->GetSnapshot()); |
| 447 | request->set_timeout(impl->GetPackInterval()); |
| 448 | if (impl->GetStartColumnFamily() != "") { |
| 449 | request->set_start_family(impl->GetStartColumnFamily()); |
| 450 | } |
| 451 | if (impl->GetStartQualifier() != "") { |
| 452 | request->set_start_qualifier(impl->GetStartQualifier()); |
| 453 | } |
| 454 | if (impl->GetStartTimeStamp() != 0) { |
| 455 | request->set_start_timestamp(impl->GetStartTimeStamp()); |
| 456 | } |
| 457 | if (impl->GetMaxVersion() != 0) { |
| 458 | request->set_max_version(impl->GetMaxVersion()); |
| 459 | } |
| 460 | request->set_max_qualifiers(impl->GetMaxQualifiers()); |
| 461 | if (impl->GetBufferSize() != 0) { |
| 462 | request->set_buffer_limit(impl->GetBufferSize()); |
| 463 | } |
| 464 | if (impl->GetNumberLimit() != 0) { |
| 465 | request->set_number_limit(impl->GetNumberLimit()); |
| 466 | } |
| 467 | if (impl->GetTimerRange() != NULL) { |
| 468 | TimeRange* time_range = request->mutable_timerange(); |
| 469 | time_range->CopyFrom(*(impl->GetTimerRange())); |
| 470 | } |
| 471 | if (impl->GetFilterDesc()) { |
| 472 | request->mutable_filter()->CopyFrom(*(impl->GetFilterDesc())); |
| 473 | } |
| 474 | for (int32_t i = 0; i < impl->GetSizeofColumnFamilyList(); ++i) { |
| 475 | tera::ColumnFamily* column_family = request->add_cf_list(); |
| 476 | column_family->CopyFrom(*(impl->GetColumnFamily(i))); |
| 477 | } |
| 478 | |
| 479 | VLOG(20) << "table " << request->table_name() << ", start_key " << request->start() |
| 480 | << ", end_key " << request->end() << ", scan to " << server_addr |
| 481 | << "timeout:" << request->timeout(); |
| 482 | request->set_timestamp(get_micros()); |
| 483 | |
| 484 | access_builder_->BuildRequest(request); |
| 485 | |
| 486 | std::function<void(ScanTabletRequest*, ScanTabletResponse*, bool, int)> done = |
| 487 | std::bind(&TableImpl::ScanCallBackWrapper, std::weak_ptr<TableImpl>(shared_from_this()), |
| 488 | scan_task, _1, _2, _3, _4); |
| 489 | tabletnode_client.ScanTablet(request, response, done); |
| 490 | } |
| 491 |
nothing calls this directly
no test coverage detected