| 1684 | } |
| 1685 | |
| 1686 | Future<MappedRangeResult> ReadYourWritesTransaction::getMappedRange(KeySelector begin, |
| 1687 | KeySelector end, |
| 1688 | Key mapper, |
| 1689 | GetRangeLimits limits, |
| 1690 | int matchIndex, |
| 1691 | Snapshot snapshot, |
| 1692 | Reverse reverse) { |
| 1693 | if (getDatabase()->apiVersionAtLeast(630)) { |
| 1694 | if (specialKeys.contains(begin.getKey()) && specialKeys.begin <= end.getKey() && |
| 1695 | end.getKey() <= specialKeys.end) { |
| 1696 | CODE_PROBE(true, "Special key space get range (getMappedRange)"); |
| 1697 | throw client_invalid_operation(); // Not support special keys. |
| 1698 | } |
| 1699 | } else { |
| 1700 | if (begin.getKey() == LiteralStringRef("\xff\xff/worker_interfaces")) { |
| 1701 | throw client_invalid_operation(); // Not support special keys. |
| 1702 | } |
| 1703 | } |
| 1704 | |
| 1705 | if (checkUsedDuringCommit()) { |
| 1706 | return used_during_commit(); |
| 1707 | } |
| 1708 | |
| 1709 | if (resetPromise.isSet()) |
| 1710 | return resetPromise.getFuture().getError(); |
| 1711 | |
| 1712 | KeyRef maxKey = getMaxReadKey(); |
| 1713 | if (begin.getKey() > maxKey || end.getKey() > maxKey) |
| 1714 | return key_outside_legal_range(); |
| 1715 | |
| 1716 | // This optimization prevents nullptr operations from being added to the conflict range |
| 1717 | if (limits.isReached()) { |
| 1718 | CODE_PROBE(true, "RYW range read limit 0 (getMappedRange)"); |
| 1719 | return MappedRangeResult(); |
| 1720 | } |
| 1721 | |
| 1722 | if (!limits.isValid()) |
| 1723 | return range_limits_invalid(); |
| 1724 | |
| 1725 | if (begin.orEqual) |
| 1726 | begin.removeOrEqual(begin.arena()); |
| 1727 | |
| 1728 | if (end.orEqual) |
| 1729 | end.removeOrEqual(end.arena()); |
| 1730 | |
| 1731 | if (begin.offset >= end.offset && begin.getKey() >= end.getKey()) { |
| 1732 | CODE_PROBE(true, "RYW range inverted (getMappedRange)"); |
| 1733 | return MappedRangeResult(); |
| 1734 | } |
| 1735 | |
| 1736 | Future<MappedRangeResult> result = |
| 1737 | reverse ? RYWImpl::readWithConflictRangeForGetMappedRange( |
| 1738 | this, RYWImpl::GetMappedRangeReq<true>(begin, end, mapper, matchIndex, limits), snapshot) |
| 1739 | : RYWImpl::readWithConflictRangeForGetMappedRange( |
| 1740 | this, RYWImpl::GetMappedRangeReq<false>(begin, end, mapper, matchIndex, limits), snapshot); |
| 1741 | |
| 1742 | return result; |
| 1743 | } |
nothing calls this directly
no test coverage detected