| 1379 | } |
| 1380 | |
| 1381 | bool CouchbaseOperations::CouchbaseRequest::appendRequest( |
| 1382 | const butil::StringPiece& key, const butil::StringPiece& value, |
| 1383 | uint32_t flags, uint32_t exptime, uint64_t cas_value, |
| 1384 | std::string collection_name, brpc::Channel* channel, const std::string& server, |
| 1385 | const std::string& bucket) { |
| 1386 | if (value.empty()) { |
| 1387 | DEBUG_PRINT("value to append must be non-empty"); |
| 1388 | return false; |
| 1389 | } |
| 1390 | uint8_t coll_id = 0; // default collection ID |
| 1391 | if (collection_name != "_default") { |
| 1392 | // check if the local cache is empty or not. |
| 1393 | if (local_collection_manifest_cache->empty()) { |
| 1394 | // if local cache is empty, goto global cache or fetch from server |
| 1395 | if (!getCachedOrFetchCollectionId( |
| 1396 | collection_name, &coll_id, metadata_tracking, channel, server, |
| 1397 | bucket, local_collection_manifest_cache)) { |
| 1398 | return false; |
| 1399 | } |
| 1400 | } |
| 1401 | // check if the collection id is available in the local cache |
| 1402 | else if (!getLocalCachedCollectionId(bucket, "_default", collection_name, |
| 1403 | &coll_id)) { |
| 1404 | // if not check in the global cache or fetch from server |
| 1405 | if (!getCachedOrFetchCollectionId( |
| 1406 | collection_name, &coll_id, metadata_tracking, channel, server, |
| 1407 | bucket, local_collection_manifest_cache)) { |
| 1408 | return false; |
| 1409 | } |
| 1410 | } |
| 1411 | } |
| 1412 | return store(policy::CB_BINARY_APPEND, key, value, flags, exptime, cas_value, |
| 1413 | coll_id); |
| 1414 | } |
| 1415 | |
| 1416 | bool CouchbaseOperations::CouchbaseRequest::prependRequest( |
| 1417 | const butil::StringPiece& key, const butil::StringPiece& value, |
no test coverage detected