-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RUST-1713 Bulk Write #1034
RUST-1713 Bulk Write #1034
Conversation
9269180
to
f9c5997
Compare
f790451
to
a491642
Compare
options: BulkWriteOptions, | ||
} | ||
|
||
impl<'de> Deserialize<'de> for WriteModel { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serde doesn't allow configuring different values for whether an enum should be "tagged" for serialization and deserialization, which requires a manual impl here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -75,6 +81,12 @@ const MAX_ENCRYPTED_WRITE_SIZE: usize = 2_097_152; | |||
// The amount of overhead bytes to account for when building a document sequence. | |||
const COMMAND_OVERHEAD_SIZE: usize = 16_000; | |||
|
|||
/// Context about the execution of the operation. | |||
pub(crate) struct ExecutionContext<'a> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future-proofing against the annoyance of having to add a new parameter to every implementation of handle_response
...
description: impl AsRef<str>, | ||
) -> std::result::Result<(), String> { | ||
let description = description.as_ref(); | ||
pub(crate) fn verify_result(&self, error: &Error, description: impl AsRef<str>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might just be personal preference, but returning string errors here rather than performing assertions was making these errors feel very opaque because a) they require us to write errors ourselves rather than use the standard format of assertion and panic error messages and b) we lose info about the exact line where the error occurred. We were just unwrapping the error returned from this method anyway so I don't think we were getting much benefit from this.
src/test/util/fail_point.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a surface-level refactor of this because I thought the old implementation was causing me problems (I was actually just forgetting to store the FailPointGuard
being returned, added #[must_use]
on that type). In retrospect this PR is probably not the place for extra stuff so I can pull this out into another PR it's too distracting 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the lint failure is unrelated, I'll fix in a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a possible change to the serialized name of message
. Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I solemnly swear ✋ that I'm not rubber-stamping this, it's just that it's such a well put together PR that I can't find anything to comment on!
@abr-egn thank you 🙂 |
Implement support for the new
bulkWrite
command. This PR can be reviewed in tandem with the specification changes (mongodb/specifications#1534).I've left some things out of this PR to minimize its size and ensure that it will be a digestible reference implementation. Additional tickets can be found in RUST-1282.