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

Method selectBucketRequest

src/brpc/couchbase.cpp:449–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447// }
448
449bool CouchbaseOperations::CouchbaseRequest::selectBucketRequest(
450 const butil::StringPiece& bucket_name) {
451 if (bucket_name.empty()) {
452 DEBUG_PRINT("Empty bucket name");
453 return false;
454 }
455 // construct the request header
456 const policy::CouchbaseRequestHeader header = {
457 policy::CB_MAGIC_REQUEST,
458 policy::CB_SELECT_BUCKET,
459 butil::HostToNet16(bucket_name.size()),
460 0,
461 policy::CB_BINARY_RAW_BYTES,
462 0,
463 butil::HostToNet32(bucket_name.size()),
464 0,
465 0};
466 if (_buf.append(&header, sizeof(header))) {
467 DEBUG_PRINT("Failed to append header to buffer");
468 return false;
469 }
470 if (_buf.append(bucket_name.data(), bucket_name.size())) {
471 DEBUG_PRINT("Failed to append bucket name to buffer");
472 return false;
473 }
474 ++_pipelined_count;
475 return true;
476}
477
478// HelloRequest sends a Hello request to the Couchbase server, which specifies
479// the client features and capabilities.

Callers 3

mainFunction · 0.80
TEST_FFunction · 0.80
selectBucketMethod · 0.80

Calls 6

HostToNet16Function · 0.85
HostToNet32Function · 0.85
emptyMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45
dataMethod · 0.45

Tested by 1

TEST_FFunction · 0.64