A method for streaming data from the storage server that is more efficient than getRange when reading large amounts of data
| 5537 | // A method for streaming data from the storage server that is more efficient than getRange when reading large amounts |
| 5538 | // of data |
| 5539 | Future<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 | |
| 5578 | Future<Void> Transaction::getRangeStream(const PromiseStream<RangeResult>& results, |
| 5579 | const KeySelector& begin, |
no test coverage detected