-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cursor types and implement BatchCursor
GODRIVER-3 GODRIVER-759 GODRIVER-791 Change-Id: I7d4121e7fffcfadd7427a6fc64d97d4c131acbbe
- Loading branch information
Showing
52 changed files
with
1,429 additions
and
1,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package mongo | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
// batchCursor is the interface implemented by types that can provide batches of document results. | ||
// The Cursor type is built on top of this type. | ||
type batchCursor interface { | ||
// ID returns the ID of the cursor. | ||
ID() int64 | ||
|
||
// Next returns true if there is a batch available. | ||
Next(context.Context) bool | ||
|
||
// Batch appends the current batch of documents to dst. RequiredBytes can be used to determine | ||
// the length of the current batch of documents. | ||
// | ||
// If there is no batch available, this method should do nothing. | ||
Batch(dst []byte) []byte | ||
|
||
// RequiredBytes returns the number of bytes required fo rthe current batch. | ||
RequiredBytes() int | ||
|
||
// Err returns the last error encountered. | ||
Err() error | ||
|
||
// Close closes the cursor. | ||
Close(context.Context) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.