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

Function intersects

fdbclient/NativeAPI.actor.cpp:5868–5885  ·  view source on GitHub ↗

If there is any intersection between the two given sets of ranges, returns a range that falls within the intersection

Source from the content-addressed store, hash-verified

5866// If there is any intersection between the two given sets of ranges, returns a range that
5867// falls within the intersection
5868Optional<KeyRangeRef> intersects(VectorRef<KeyRangeRef> lhs, VectorRef<KeyRangeRef> rhs) {
5869 if (lhs.size() && rhs.size()) {
5870 std::sort(lhs.begin(), lhs.end(), compareBegin);
5871 std::sort(rhs.begin(), rhs.end(), compareBegin);
5872
5873 int l = 0, r = 0;
5874 while (l < lhs.size() && r < rhs.size()) {
5875 if (lhs[l].end <= rhs[r].begin)
5876 l++;
5877 else if (rhs[r].end <= lhs[l].begin)
5878 r++;
5879 else
5880 return lhs[l] & rhs[r];
5881 }
5882 }
5883
5884 return Optional<KeyRangeRef>();
5885}
5886
5887ACTOR void checkWrites(Reference<TransactionState> trState,
5888 Future<Void> committed,

Callers 3

commitMutationsMethod · 0.85
intersectsMethod · 0.85

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected