feat: reintroduce clone and rewind for cursors #2647
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
These two commits add back support for cloning and rewinding cursors.
What changed?
The changes should be fairly straightforward, but I wanted to call out a few design decisions:
- I had originally intendedcloneto be an abstract method onAbstractCursor, forcing us to implement it for all possible cursor subclasses. This would have unfortunately required us to makeAbstractCursorgeneric over the subclass types, since the following signature results in type ambiguity at the point of implementation in the subclass:abstract clone(): thisTherefore,
cloneis implemented by hand inAbstractCursorsubclasses. I only implemented it forFindCursorandAggregateCursorbecause it's likely that's where legacy users have actually used this feature.There is a correction in the
rewindimplementation regarding sessions. When a session is started as part of cursor initialization I had originally marked this as anexplicit: truestart, however, this is clearly an implicit session the driver is creating in the absence of an explicitly provided one.Are there any files to ignore?
none