Description
CB++ only applies the mutation state if scan consistency is not defined.
if (scan_consistency) { |
switch (scan_consistency.value()) { |
case couchbase::core::query_scan_consistency::not_bounded: |
body["scan_consistency"] = "not_bounded"; |
break; |
case couchbase::core::query_scan_consistency::request_plus: |
check_scan_wait = true; |
body["scan_consistency"] = "request_plus"; |
break; |
}
|
} else if (!mutation_state.empty()) { |
check_scan_wait = true; |
body["scan_consistency"] = "at_plus"; |
tao::json::value scan_vectors = tao::json::empty_object;
|
for (const auto& token : mutation_state) { |
auto* bucket = scan_vectors.find(token.bucket_name());
|
if (bucket == nullptr) { |
scan_vectors[token.bucket_name()] = tao::json::empty_object;
|
bucket = scan_vectors.find(token.bucket_name());
|
}
|
auto& bucket_obj = bucket->get_object();
|
bucket_obj[std::to_string(token.partition_id())] =
|
std::vector<tao::json::value>{ token.sequence_number(), std::to_string(token.partition_uuid()) };
|
}
|
body["scan_vectors"] = scan_vectors; |
}
|
The SDK always sets a scan consistency even if not defined in the options which makes using consistentWith impossible as CB++ never includes the scan vector in the query request
export function viewScanConsistencyToCpp(
|
mode: ViewScanConsistency | undefined
|
): CppViewScanConsistency {
|
// Unspecified is allowed, and means no sync durability. |
if (mode === null || mode === undefined) { |
return binding.view_scan_consistency.not_bounded |
}
|
if (mode === ViewScanConsistency.NotBounded) { |
return binding.view_scan_consistency.not_bounded |
} else if (mode === ViewScanConsistency.UpdateAfter) { |
return binding.view_scan_consistency.update_after |
} else if (mode === ViewScanConsistency.RequestPlus) { |
return binding.view_scan_consistency.request_plus |
}
|
throw new errs.InvalidArgumentError() |
}
|