@@ -401,17 +401,15 @@ size_t CacheTransferStream::getMemoryUsed() const {
401401 return engine.getEpStats ().getEstimatedTotalMemoryUsed ();
402402}
403403
404- CacheTransferStream::Status CacheTransferStream::maybeQueueItem (
405- const StoredValue& sv, Collections::VB::ReadHandle& readHandle) {
406- preQueueCallback (sv);
407-
404+ bool CacheTransferStream::skip (const StoredValue& sv,
405+ Collections::VB::ReadHandle& readHandle) const {
408406 // Check if the sv is eligible for transfer.
409407 // 1. Temporary/Deleted/Pending StoredValues are not eligible.
410408 if (sv.isTempItem () || sv.isDeleted () || sv.isPending ()) {
411409 OBJ_LOG_DEBUG_CTX (*this ,
412410 " CacheTransferStream skipping temp/deleted/pending" ,
413411 {" sv" , nlohmann::json{sv}});
414- return Status::KeepVisiting ;
412+ return true ;
415413 }
416414
417415 // 2. Dropped collection items are not eligible.
@@ -420,7 +418,7 @@ CacheTransferStream::Status CacheTransferStream::maybeQueueItem(
420418 *this ,
421419 " CacheTransferStream skipping as in dropped collection" ,
422420 {" sv" , nlohmann::json{sv}});
423- return Status::KeepVisiting ;
421+ return true ;
424422 }
425423
426424 // 3. StoredValues with a sequence number greater than the stream's maxSeqno
@@ -430,7 +428,7 @@ CacheTransferStream::Status CacheTransferStream::maybeQueueItem(
430428 *this ,
431429 " CacheTransferStream skipping sv with seqno > maxSeqno" ,
432430 {" sv" , nlohmann::json{sv}});
433- return Status::KeepVisiting ;
431+ return true ;
434432 }
435433
436434 // 4. Do checks for a value transfer, these don't apply if the only a
@@ -441,15 +439,15 @@ CacheTransferStream::Status CacheTransferStream::maybeQueueItem(
441439 OBJ_LOG_DEBUG_CTX (*this ,
442440 " CacheTransferStream skipping non-resident" ,
443441 {" sv" , nlohmann::json{sv}});
444- return Status::KeepVisiting ;
442+ return true ;
445443 }
446444
447445 // 4.2 If the sv is expired, it is not eligible.
448446 if (sv.isExpired (ep_real_time ())) {
449447 OBJ_LOG_DEBUG_CTX (*this ,
450448 " CacheTransferStream skipping expired" ,
451449 {" sv" , nlohmann::json{sv}});
452- return Status::KeepVisiting ;
450+ return true ;
453451 }
454452 }
455453
@@ -459,6 +457,18 @@ CacheTransferStream::Status CacheTransferStream::maybeQueueItem(
459457 *this ,
460458 " CacheTransferStream skipping as not allowed by filter" ,
461459 {" sv" , nlohmann::json{sv}});
460+ return true ;
461+ }
462+ return false ;
463+ }
464+
465+ CacheTransferStream::Status CacheTransferStream::maybeQueueItem (
466+ const StoredValue& sv, Collections::VB::ReadHandle& readHandle) {
467+ preQueueCallback (sv);
468+
469+ // Lots of little checks to make to decide if the item found in the
470+ // hash-table should be skipped or queued.
471+ if (skip (sv, readHandle)) {
462472 return Status::KeepVisiting;
463473 }
464474
0 commit comments