hubcio commented on code in PR #3877:
URL: https://github.com/apache/iggy/pull/3877#discussion_r3820339931
##########
foreign/python/src/consumer.rs:
##########
@@ -215,6 +215,29 @@ impl IggyConsumer {
}
}
+/// The consumer polling the messages. It selects both the consumer kind and
the
+/// identifier the server keys the stored offset on.
+#[derive(Clone)]
+#[gen_stub_pyclass_complex_enum]
+#[pyclass(from_py_object)]
+pub enum Consumer {
+ /// A regular consumer, owning its offset on the polled partition.
+ Single { id: PyIdentifier },
+ /// A member of the consumer group, sharing the group's offset.
+ Group { id: PyIdentifier },
+}
+
+impl TryFrom<&Consumer> for RustConsumer {
+ type Error = PyErr;
+
+ fn try_from(value: &Consumer) -> PyResult<RustConsumer> {
+ Ok(match value {
+ Consumer::Single { id } =>
RustConsumer::new(Identifier::try_from(id.clone())?),
Review Comment:
`id.clone()` runs on every poll - a `TryFrom<&PyIdentifier> for Identifier`
impl (or taking the consumer by value) would drop it. tiny thing.
##########
foreign/python/src/client.rs:
##########
@@ -1036,20 +1036,24 @@ impl IggyClient {
}
/// Polls for messages from the specified topic and partition.
Review Comment:
first line still says "from the specified topic and partition" but
`partition_id` is optional now - reword so it matches the new signature.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]