| 1414 | } |
| 1415 | |
| 1416 | bool CouchbaseOperations::CouchbaseRequest::prependRequest( |
| 1417 | const butil::StringPiece& key, const butil::StringPiece& value, |
| 1418 | uint32_t flags, uint32_t exptime, uint64_t cas_value, |
| 1419 | std::string collection_name, brpc::Channel* channel, const std::string& server, |
| 1420 | const std::string& bucket) { |
| 1421 | if (value.empty()) { |
| 1422 | DEBUG_PRINT("value to prepend must be non-empty"); |
| 1423 | return false; |
| 1424 | } |
| 1425 | uint8_t coll_id = 0; // default collection ID |
| 1426 | if (collection_name != "_default") { |
| 1427 | // check if the local cache is empty or not. |
| 1428 | if (local_collection_manifest_cache->empty()) { |
| 1429 | // if local cache is empty, goto global cache or fetch from server |
| 1430 | if (!getCachedOrFetchCollectionId( |
| 1431 | collection_name, &coll_id, metadata_tracking, channel, server, |
| 1432 | bucket, local_collection_manifest_cache)) { |
| 1433 | return false; |
| 1434 | } |
| 1435 | } |
| 1436 | // check if the collection id is available in the local cache |
| 1437 | else if (!getLocalCachedCollectionId(bucket, "_default", collection_name, |
| 1438 | &coll_id)) { |
| 1439 | // if not check in the global cache or fetch from server |
| 1440 | if (!getCachedOrFetchCollectionId( |
| 1441 | collection_name, &coll_id, metadata_tracking, channel, server, |
| 1442 | bucket, local_collection_manifest_cache)) { |
| 1443 | return false; |
| 1444 | } |
| 1445 | } |
| 1446 | } |
| 1447 | return store(policy::CB_BINARY_PREPEND, key, value, flags, exptime, cas_value, |
| 1448 | coll_id); |
| 1449 | } |
| 1450 | |
| 1451 | bool CouchbaseOperations::CouchbaseResponse::popAuthenticate( |
| 1452 | uint64_t* cas_value) { |
no test coverage detected