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

Method getRangeStream

fdbclient/NativeAPI.actor.cpp:5539–5576  ·  view source on GitHub ↗

A method for streaming data from the storage server that is more efficient than getRange when reading large amounts of data

Source from the content-addressed store, hash-verified

5537// A method for streaming data from the storage server that is more efficient than getRange when reading large amounts
5538// of data
5539Future<Void> Transaction::getRangeStream(const PromiseStream<RangeResult>& results,
5540 const KeySelector& begin,
5541 const KeySelector& end,
5542 GetRangeLimits limits,
5543 Snapshot snapshot,
5544 Reverse reverse) {
5545 ++trState->cx->transactionLogicalReads;
5546 ++trState->cx->transactionGetRangeStreamRequests;
5547
5548 // FIXME: limits are not implemented yet, and this code has not be tested with reverse=true
5549 ASSERT(!limits.hasByteLimit() && !limits.hasRowLimit() && !reverse);
5550
5551 KeySelector b = begin;
5552 if (b.orEqual) {
5553 CODE_PROBE(true, "Native stream begin orEqual==true");
5554 b.removeOrEqual(b.arena());
5555 }
5556
5557 KeySelector e = end;
5558 if (e.orEqual) {
5559 CODE_PROBE(true, "Native stream end orEqual==true");
5560 e.removeOrEqual(e.arena());
5561 }
5562
5563 if (b.offset >= e.offset && b.getKey() >= e.getKey()) {
5564 CODE_PROBE(true, "Native stream range inverted");
5565 results.sendError(end_of_stream());
5566 return Void();
5567 }
5568
5569 Promise<std::pair<Key, Key>> conflictRange;
5570 if (!snapshot) {
5571 extraConflictRanges.push_back(conflictRange.getFuture());
5572 }
5573
5574 return forwardErrors(
5575 ::getRangeStream(trState, results, getReadVersion(), b, e, limits, conflictRange, snapshot, reverse), results);
5576}
5577
5578Future<Void> Transaction::getRangeStream(const PromiseStream<RangeResult>& results,
5579 const KeySelector& begin,

Calls 9

hasByteLimitMethod · 0.80
hasRowLimitMethod · 0.80
removeOrEqualMethod · 0.80
getKeyMethod · 0.65
VoidClass · 0.50
GetRangeLimitsClass · 0.50
sendErrorMethod · 0.45
push_backMethod · 0.45
getFutureMethod · 0.45

Tested by

no test coverage detected