MCPcopy Create free account
hub / github.com/apache/brpc / executePipeline

Method executePipeline

src/brpc/couchbase.cpp:2489–2624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2487 return true;
2488}
2489std::vector<CouchbaseOperations::Result> CouchbaseOperations::executePipeline() {
2490 std::vector<CouchbaseOperations::Result> results;
2491
2492 if (!pipeline_active || pipeline_operations_queue.empty()) {
2493 DEBUG_PRINT("No pipeline active or no operations queued");
2494 return results;
2495 }
2496
2497 brpc::Controller cntl;
2498 channel_->CallMethod(NULL, &cntl, &pipeline_request_couchbase_req,
2499 &pipeline_response_couchbase_resp, NULL);
2500
2501 if (cntl.Failed()) {
2502 DEBUG_PRINT("Pipeline execution failed: " << cntl.ErrorText());
2503 // Create failure results for all operations
2504 size_t op_count = pipeline_operations_queue.size();
2505 results.reserve(op_count);
2506
2507 CouchbaseOperations::Result failure_result;
2508 failure_result.success = false;
2509 failure_result.error_message = cntl.ErrorText();
2510
2511 for (size_t i = 0; i < op_count; ++i) {
2512 results.push_back(failure_result);
2513 }
2514
2515 clearPipeline();
2516 return results;
2517 }
2518
2519 // Process each operation in the order they were added
2520 CouchbaseOperations::CouchbaseResponse* response =
2521 &pipeline_response_couchbase_resp;
2522 while (!pipeline_operations_queue.empty()) {
2523 CouchbaseOperations::Result result;
2524 operation_type op_type = pipeline_operations_queue.front();
2525 pipeline_operations_queue.pop();
2526 switch (op_type) {
2527 case GET: {
2528 std::string value;
2529 uint32_t flags = 0;
2530 uint64_t cas = 0;
2531 if (response->popGet(&value, &flags, &cas) == false) {
2532 result.success = false;
2533 result.value = "";
2534 result.error_message = response->lastError();
2535 result.status_code = response->_status_code;
2536 } else {
2537 result.success = true;
2538 result.value = value;
2539 }
2540 results.push_back(result);
2541 break;
2542 }
2543 case UPSERT: {
2544 if (response->popUpsert(NULL) == false) {
2545 result.success = false;
2546 result.value = "";

Callers 1

performOperationsFunction · 0.80

Calls 15

ErrorTextMethod · 0.80
popGetMethod · 0.80
popUpsertMethod · 0.80
popAddMethod · 0.80
popAppendMethod · 0.80
popPrependMethod · 0.80
popDeleteMethod · 0.80
emptyMethod · 0.45
CallMethodMethod · 0.45
FailedMethod · 0.45
sizeMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected