-
Notifications
You must be signed in to change notification settings - Fork 44
feat: add ProduceResult
with encoded request size metadata
#276
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
Conversation
Signed-off-by: WenyXu <[email protected]>
39d93c0
to
bc582e9
Compare
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.
I think the end2end test should assert this new field as well.
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.
Added in b1b5c99
|
||
/// The result of the produce call. | ||
#[derive(Debug, Default)] | ||
pub struct ProduceResult { |
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.
pub struct ProduceResult { | |
#[non_exhaustive] | |
pub struct ProduceResult { |
makes it easier to extend this later w/o introducing breaking changes.
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.
Added in a12992f
src/messenger.rs
Outdated
self.version_ranges = ranges; | ||
} | ||
|
||
pub async fn request<R>(&self, msg: R) -> Result<R::ResponseBody, RequestError> |
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.
While this method is technically public, I doubt that anybody really uses it. So I think request
should just return the metadata as well, in the same way that request_with_version_ranges
does. This keeps the API kinda lean and avoids having all sorts of permutations.
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.
Resolved in a12992f
src/protocol/messages/mod.rs
Outdated
} | ||
} | ||
|
||
/// A response body with metadata about the request. |
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.
/// A response body with metadata about the request. | |
/// A response body with metadata about the request & response. |
I think we can make this a bit more generic for future additions.
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.
Updated in a12992f
src/client/producer.rs
Outdated
} | ||
} | ||
|
||
/// The result of the produce call. |
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 result of the produce call. | |
/// The result of the [produce](ProducerClient::produce) call. |
This makes it clearer which API you're referencing 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.
Updated in a12992f
Signed-off-by: WenyXu <[email protected]>
b1b5c99
to
a12992f
Compare
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.
Thank you
Closes #275
This PR introduces a new
ProduceResult
struct that provides enhanced information about produce operations, including both the offsets of produced records and the encoded request size in bytes.New Types
ProduceResult
: A new struct containing:offsets: Vec<i64>
: The offsets of the produced recordsencoded_request_size: usize
: The size of the request encoded in bytesResponseBodyWithMetadata<R>
: A generic wrapper for response bodies that includes metadata about the encoded request sizeAPI Changes
produce()
method to returnProduceResult
instead of just VecProduceResult
with request size informationrequest_with_metadata()
method that returns response with size metadata