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

Function sendRequest

src/brpc/couchbase.cpp:1807–2096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1805}
1806
1807bool sendRequest(CouchbaseOperations::operation_type op_type, const std::string& key,
1808 const std::string& value, std::string collection_name,
1809 CouchbaseOperations::Result* result, brpc::Channel* channel,
1810 const std::string& server, const std::string& bucket,
1811 CouchbaseOperations::CouchbaseRequest* request,
1812 CouchbaseOperations::CouchbaseResponse* response) {
1813 if (channel == nullptr) {
1814 DEBUG_PRINT("No channel found, make sure to call Authenticate() first");
1815 result->error_message =
1816 "No channel found, make sure to call Authenticate() first";
1817 return false;
1818 }
1819 if (server.empty()) {
1820 DEBUG_PRINT("Server is empty, make sure to call Authenticate() first");
1821 result->error_message =
1822 "Server is empty, make sure to call Authenticate() first";
1823 return false;
1824 }
1825 if (bucket.empty()) {
1826 DEBUG_PRINT("No bucket selected, make sure to call SelectBucket() first");
1827 result->error_message =
1828 "No bucket selected, make sure to call SelectBucket() first";
1829 return false;
1830 }
1831 brpc::Controller cntl;
1832 bool request_created = false;
1833 switch (op_type) {
1834 case CouchbaseOperations::GET:
1835 request_created =
1836 request->getRequest(key, collection_name, channel, server, bucket);
1837 break;
1838 case CouchbaseOperations::UPSERT:
1839 request_created = request->upsertRequest(
1840 key, value, 0, 0, 0, collection_name, channel, server, bucket);
1841 break;
1842 case CouchbaseOperations::ADD:
1843 request_created = request->addRequest(
1844 key, value, 0, 0, 0, collection_name, channel, server, bucket);
1845 break;
1846 case CouchbaseOperations::APPEND:
1847 request_created = request->appendRequest(
1848 key, value, 0, 0, 0, collection_name, channel, server, bucket);
1849 break;
1850 case CouchbaseOperations::PREPEND:
1851 request_created = request->prependRequest(
1852 key, value, 0, 0, 0, collection_name, channel, server, bucket);
1853 break;
1854 case CouchbaseOperations::DELETE:
1855 request_created =
1856 request->deleteRequest(key, collection_name, channel, server, bucket);
1857 break;
1858 default:
1859 DEBUG_PRINT("Unsupported operation type");
1860 result->success = false;
1861 result->value = "";
1862 result->error_message = "Unsupported operation type";
1863 return false;
1864 }

Callers 6

getMethod · 0.85
upsertMethod · 0.85
delete_Method · 0.85
addMethod · 0.85
appendMethod · 0.85
prependMethod · 0.85

Calls 15

getRequestMethod · 0.80
upsertRequestMethod · 0.80
addRequestMethod · 0.80
appendRequestMethod · 0.80
prependRequestMethod · 0.80
deleteRequestMethod · 0.80
ErrorTextMethod · 0.80
popGetMethod · 0.80
popUpsertMethod · 0.80
popAddMethod · 0.80
popAppendMethod · 0.80

Tested by

no test coverage detected