MCPcopy Create free account
hub / github.com/apple/foundationdb / getMappedRange

Method getMappedRange

fdbclient/ReadYourWrites.actor.cpp:1686–1743  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1684}
1685
1686Future<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}

Callers

nothing calls this directly

Calls 11

MappedRangeResultClass · 0.85
isReachedMethod · 0.80
removeOrEqualMethod · 0.80
getKeyMethod · 0.65
apiVersionAtLeastMethod · 0.45
containsMethod · 0.45
isSetMethod · 0.45
getErrorMethod · 0.45
getFutureMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected