Merge pull request #8086 from sfc-gh-tclinkenbeard/mark-promisestream-send-nonconst

Mark `PromiseStream::send` non-const
This commit is contained in:
Trevor Clinkenbeard 2022-09-04 14:55:47 -07:00 committed by GitHub
commit 3ce737b2fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 14 deletions

View File

@ -5543,7 +5543,7 @@ Future<RangeResult> Transaction::getRange(const KeySelector& begin,
// A method for streaming data from the storage server that is more efficient than getRange when reading large amounts
// of data
Future<Void> Transaction::getRangeStream(const PromiseStream<RangeResult>& results,
Future<Void> Transaction::getRangeStream(PromiseStream<RangeResult>& results,
const KeySelector& begin,
const KeySelector& end,
GetRangeLimits limits,
@ -5582,7 +5582,7 @@ Future<Void> Transaction::getRangeStream(const PromiseStream<RangeResult>& resul
::getRangeStream(trState, results, getReadVersion(), b, e, limits, conflictRange, snapshot, reverse), results);
}
Future<Void> Transaction::getRangeStream(const PromiseStream<RangeResult>& results,
Future<Void> Transaction::getRangeStream(PromiseStream<RangeResult>& results,
const KeySelector& begin,
const KeySelector& end,
int limit,

View File

@ -363,19 +363,19 @@ private:
public:
// A method for streaming data from the storage server that is more efficient than getRange when reading large
// amounts of data
[[nodiscard]] Future<Void> getRangeStream(const PromiseStream<Standalone<RangeResultRef>>& results,
[[nodiscard]] Future<Void> getRangeStream(PromiseStream<Standalone<RangeResultRef>>& results,
const KeySelector& begin,
const KeySelector& end,
int limit,
Snapshot = Snapshot::False,
Reverse = Reverse::False);
[[nodiscard]] Future<Void> getRangeStream(const PromiseStream<Standalone<RangeResultRef>>& results,
[[nodiscard]] Future<Void> getRangeStream(PromiseStream<Standalone<RangeResultRef>>& results,
const KeySelector& begin,
const KeySelector& end,
GetRangeLimits limits,
Snapshot = Snapshot::False,
Reverse = Reverse::False);
[[nodiscard]] Future<Void> getRangeStream(const PromiseStream<Standalone<RangeResultRef>>& results,
[[nodiscard]] Future<Void> getRangeStream(PromiseStream<Standalone<RangeResultRef>>& results,
const KeyRange& keys,
int limit,
Snapshot snapshot = Snapshot::False,
@ -387,7 +387,7 @@ public:
snapshot,
reverse);
}
[[nodiscard]] Future<Void> getRangeStream(const PromiseStream<Standalone<RangeResultRef>>& results,
[[nodiscard]] Future<Void> getRangeStream(PromiseStream<Standalone<RangeResultRef>>& results,
const KeyRange& keys,
GetRangeLimits limits,
Snapshot snapshot = Snapshot::False,

View File

@ -139,7 +139,8 @@ public:
pair_type endPair(endKey, Val());
map.insert(endPair, true, mf(endPair));
}
Val const& operator[](const Key& k) { return rangeContaining(k).value(); }
Val const& operator[](const Key& k) const { return rangeContaining(k).value(); }
Val& operator[](const Key& k) { return rangeContaining(k).value(); }
Ranges ranges() { return Ranges(iterator(map.begin()), iterator(map.lastItem())); }
ConstRanges ranges() const { return ConstRanges(const_iterator(map.begin()), const_iterator(map.lastItem())); }

View File

@ -1167,9 +1167,9 @@ public:
// stream.send( request )
// Unreliable at most once delivery: Delivers request unless there is a connection failure (zero or one times)
void send(const T& value) const { queue->send(value); }
void send(T&& value) const { queue->send(std::move(value)); }
void sendError(const Error& error) const { queue->sendError(error); }
void send(const T& value) { queue->send(value); }
void send(T&& value) { queue->send(std::move(value)); }
void sendError(const Error& error) { queue->sendError(error); }
// stream.getReply( request )
// Reliable at least once delivery: Eventually delivers request at least once and returns one of the replies if
@ -1178,22 +1178,22 @@ public:
// If a reply is returned, request was or will be delivered one or more times.
// If cancelled, request was or will be delivered zero or more times.
template <class X>
Future<REPLY_TYPE(X)> getReply(const X& value) const {
Future<REPLY_TYPE(X)> getReply(const X& value) {
send(value);
return getReplyPromise(value).getFuture();
}
template <class X>
Future<REPLY_TYPE(X)> getReply(const X& value, TaskPriority taskID) const {
Future<REPLY_TYPE(X)> getReply(const X& value, TaskPriority taskID) {
setReplyPriority(value, taskID);
return getReplyPromise(value).getFuture();
}
template <class X>
Future<X> getReply() const {
Future<X> getReply() {
return getReply(Promise<X>());
}
template <class X>
Future<X> getReplyWithTaskID(TaskPriority taskID) const {
Future<X> getReplyWithTaskID(TaskPriority taskID) {
Promise<X> reply;
reply.getEndpoint(taskID);
return getReply(reply);